[PATCH (v2)] Use separate soname when building against GTK-3



The GTK-3 library is not ABI compatible with GTK-2. Thus when
GTK-VNC builds against GTK-3 it is not ABI compatible with a
build done against GTK-2. It is thus neccessasry to allow for
parallel install of GTK-2 and GTK-3 builds. This is done by
changing the library name, pkgconfig name and include file
locations

 GTK-2:

    libgtk-vnc-1.0.so
    gtk-vnc-1.0.pc
    /usr/include/gtk-vnc-1.0

 GTK-3:

    libgtk-vnc-2.0.so
    gtk-vnc-2.0.pc
    /usr/include/gtk-vnc-2.0

NB, when enabling GTK-3, the traditional python bindings will
be disabled. The new GObject Introspection support provide an
alternative python binding for users of GTK-3

* gtk-vnc-1.0.pc.in: Fix to only use GTK-2
* gtk-vnc-2.0.pc.in: New for GTK-3 support
* src/Makefile.am: Different sonames & include dirs when
  building against GTK3
* configure.ac: Disable python binding with GTK3
* README: Add note about GTK3
* Makefile.am: Install new pkgconfig file for GTK3
---
 Makefile.am          |    3 +-
 README               |   13 ++++++++++++
 configure.ac         |   11 +++++++++-
 examples/Makefile.am |    2 +-
 gtk-vnc-1.0.pc.in    |    2 +-
 gtk-vnc-2.0.pc.in    |   11 ++++++++++
 src/Makefile.am      |   51 ++++++++++++++++++++++++++++++++-----------------
 7 files changed, 71 insertions(+), 22 deletions(-)
 create mode 100644 gtk-vnc-2.0.pc.in

diff --git a/Makefile.am b/Makefile.am
index 1b65ee2..85119ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,12 +1,13 @@
 SUBDIRS = gnulib/lib src tools examples plugin gnulib/tests po
 ACLOCAL_AMFLAGS = -I gnulib/m4 ${ACLOCAL_FLAGS}
 
-pkgconfig_DATA = @PACKAGE -1 0 pc gvnc-1.0.pc
+pkgconfig_DATA = @PACKAGE -$(GTK_VNC_API_VERSION).pc gvnc-1.0.pc
 pkgconfigdir = $(libdir)/pkgconfig
 
 EXTRA_DIST =				\
 	gvnc-1.0.pc.in			\
 	$(PACKAGE)-1.0.pc.in		\
+	$(PACKAGE)-2.0.pc.in		\
 	$(PACKAGE).spec.in		\
 	$(PACKAGE).spec			\
 	mingw32-$(PACKAGE).spec.in	\
diff --git a/README b/README
index 8aeaf98..7c9deaa 100644
--- a/README
+++ b/README
@@ -29,6 +29,19 @@ To browse or report bugs, go to our bugzilla page at:
 Installation caveats
 --------------------
 
+ * GTK3: The build defaults to using GTK2. To enable GTK3 support
+   the flag '--with-gtk' must be passed to configure.
+
+         ./configure --with-gtk=3.0
+
+   NB: the traditional python bindings are disabled when gtk3
+   is used. Applications should use the GObject introspection
+   bindings instead.
+
+   NB: when built against GTK3, the library name for gtk-vnc
+   will become 'gtk-vnc-2.0.so' and the pkg-config file will
+   also be 'gtk-vnc-2.0'.  The gvnc library is unaffected.
+
  * NetBSD: You must run configure using
 
     --with-coroutine=gthread
diff --git a/configure.ac b/configure.ac
index 5e273f1..a3091fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,14 +85,17 @@ AC_MSG_RESULT([$with_gtk])
 case "$with_gtk" in
   2.0) GTK_API_VERSION=2.0
        GTK_REQUIRED=2.18.0
+       GTK_VNC_API_VERSION=1.0
        ;;
   3.0) GTK_API_VERSION=3.0
        GTK_REQUIRED=2.90.4
+       GTK_VNC_API_VERSION=2.0
        ;;
 esac
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
+AC_SUBST([GTK_VNC_API_VERSION])
 AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
 AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
@@ -105,7 +108,12 @@ AC_ARG_WITH(python,
    *)      AC_MSG_ERROR([bad value ${withval} for python option]) ;;
  esac],[withval=yes])
 
-WITH_PYTHON=$withval
+if test "$with_gtk" = "3.0"
+then
+  WITH_PYTHON=no
+else
+  WITH_PYTHON=$withval
+fi
 
 GTK_VNC_COMPILE_WARNINGS
 
@@ -384,6 +392,7 @@ AC_CONFIG_FILES(
   po/Makefile.in
   gvnc-1.0.pc
   gtk-vnc-1.0.pc
+  gtk-vnc-2.0.pc
   gtk-vnc.spec
   mingw32-gtk-vnc.spec
   )
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 767a235..8b26e41 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -6,7 +6,7 @@ noinst_PROGRAMS = gvncviewer
 endif
 
 gvncviewer_SOURCES = gvncviewer.c
-gvncviewer_LDADD = ../src/libgtk-vnc-1.0.la @GTK_CFLAGS@ \
+gvncviewer_LDADD = ../src/libgtk-vnc-$(GTK_VNC_API_VERSION).la @GTK_CFLAGS@ \
 		   @VIEW_LIBS@
 gvncviewer_CFLAGS = @GTK_CFLAGS@ @WARNING_CFLAGS@ \
 		    @VIEW_CFLAGS@ -I$(top_srcdir)/src/
diff --git a/gtk-vnc-1.0.pc.in b/gtk-vnc-1.0.pc.in
index 1859228..1f9af79 100644
--- a/gtk-vnc-1.0.pc.in
+++ b/gtk-vnc-1.0.pc.in
@@ -5,7 +5,7 @@ includedir= includedir@
 
 Name: GTK-VNC
 Description: GTK widget for a VNC client
-Requires: gvnc-1.0 = @VERSION@, gtk+- GTK_API_VERSION@ >= @GTK_REQUIRED@
+Requires: gvnc-1.0 = @VERSION@, gtk+-2.0 >= @GTK_REQUIRED@
 Version: @VERSION@
 Libs: -L${libdir} -lgtk-vnc-1.0
 Cflags: -I${includedir}/gtk-vnc-1.0
diff --git a/gtk-vnc-2.0.pc.in b/gtk-vnc-2.0.pc.in
new file mode 100644
index 0000000..b2cb24b
--- /dev/null
+++ b/gtk-vnc-2.0.pc.in
@@ -0,0 +1,11 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+Name: GTK-VNC
+Description: GTK widget for a VNC client
+Requires: gvnc-1.0 = @VERSION@, gtk+-3.0 >= @GTK_REQUIRED@
+Version: @VERSION@
+Libs: -L${libdir} -lgtk-vnc-2.0
+Cflags: -I${includedir}/gtk-vnc-2.0
diff --git a/src/Makefile.am b/src/Makefile.am
index b4dcd70..0a94954 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 
 EXTRA_DIST = libgvnc_sym.version libgtk-vnc_sym.version vncmarshal.txt
 
-lib_LTLIBRARIES = libgvnc-1.0.la libgtk-vnc-1.0.la
+lib_LTLIBRARIES = libgvnc-1.0.la
 
 BUILT_SOURCES =
 if USE_VERSION_DEFS
@@ -79,14 +79,12 @@ libgvnc_1_0_la_SOURCES += coroutine_gthread.c
 EXTRA_DIST += continuation.h continuation.c coroutine_ucontext.c
 endif
 
-
-
-libgtk_vnc_1_0_la_LIBADD = \
+gtk_vnc_LIBADD = \
 			@GTK_LIBS@ \
 			@X11_LIBS@ \
 			libgvnc-1.0.la \
 			../gnulib/lib/libgnu.la
-libgtk_vnc_1_0_la_CFLAGS = \
+gtk_vnc_CFLAGS = \
 			@GTK_CFLAGS@ \
 			@X11_CFLAGS@ \
 			@WARNING_CFLAGS@ \
@@ -95,18 +93,15 @@ libgtk_vnc_1_0_la_CFLAGS = \
 			-DG_LOG_DOMAIN=\"gtk-vnc\" \
 			-I$(top_srcdir)/gnulib/lib \
 			-I../gnulib/lib
-libgtk_vnc_1_0_la_LDFLAGS = \
-			$(VERSION_SCRIPT_FLAGS)$(GTK_VNC_VERSION_FILE) \
-			-version-info 0:1:0 $(NO_UNDEFINED_FLAGS)
 
-gtk_vnc_includedir = $(includedir)/gtk-vnc-1.0/
+gtk_vnc_includedir = $(includedir)/gtk-vnc-$(GTK_VNC_API_VERSION)/
 gtk_vnc_include_HEADERS = \
 			vncdisplay.h \
 			vncdisplayenums.h \
 			vncgrabsequence.h \
 			vncimageframebuffer.h
 
-libgtk_vnc_1_0_la_SOURCES = \
+gtk_vnc_SOURCES = \
 			vncimageframebuffer.h vncimageframebuffer.c \
 			vncdisplay.h vncdisplay.c \
 			vncdisplayenums.h vncdisplayenums.c \
@@ -114,6 +109,25 @@ libgtk_vnc_1_0_la_SOURCES = \
 			vncgrabsequence.h vncgrabsequence.c \
 			vncmarshal.h vncmarshal.c
 
+gtk_vnc_LDFLAGS = \
+			$(VERSION_SCRIPT_FLAGS)$(GTK_VNC_VERSION_FILE) \
+			$(NO_UNDEFINED_FLAGS)
+
+if HAVE_GTK_2
+lib_LTLIBRARIES += libgtk-vnc-1.0.la
+libgtk_vnc_1_0_la_LIBADD = $(gtk_vnc_LIBADD)
+libgtk_vnc_1_0_la_CFLAGS = $(gtk_vnc_CFLAGS)
+libgtk_vnc_1_0_la_LDFLAGS = $(gtk_vnc_LDFLAGS) -version-info 0:1:0
+libgtk_vnc_1_0_la_SOURCES = $(gtk_vnc_SOURCES)
+else
+lib_LTLIBRARIES += libgtk-vnc-2.0.la
+libgtk_vnc_2_0_la_LIBADD = $(gtk_vnc_LIBADD)
+libgtk_vnc_2_0_la_CFLAGS = $(gtk_vnc_CFLAGS)
+libgtk_vnc_2_0_la_LDFLAGS = $(gtk_vnc_LDFLAGS) -version-info 0:2:0
+libgtk_vnc_2_0_la_SOURCES = $(gtk_vnc_SOURCES)
+endif
+
+
 vncdisplayenums.c: vncdisplay.h
 	$(AM_V_GEN)glib-mkenums    --fhead "#include <glib-object.h>\n" \
 			--fhead "#include \"vncdisplayenums.h\"\n\n" \
@@ -184,7 +198,7 @@ CLEANFILES = vncmarshal.c vncmarshal.h \
 if WITH_PYTHON
 pyexec_LTLIBRARIES = gtkvnc.la
 
-gtkvnc_la_LIBADD = libgtk-vnc-1.0.la @PYGTK_LIBS@
+gtkvnc_la_LIBADD = libgtk-vnc-$(GTK_VNC_API_VERSION).la @PYGTK_LIBS@
 gtkvnc_la_CFLAGS = @GTK_CFLAGS@ @PYTHON_INCLUDES@ \
 		   @PYGTK_CFLAGS@ @WARNING_PYTHON_CFLAGS@
 gtkvnc_la_LDFLAGS = -module -avoid-version -fPIC
@@ -247,15 +261,15 @@ GVnc-1.0.gir: libgvnc-1.0.la $(G_IR_SCANNER) Makefile.am
                 --pkg=gobject-2.0 \
                 $(GVNC_INTROSPECTION_SRCS)
 
-GtkVnc-1.0.gir: GVnc-1.0.gir libgtk-vnc-1.0.la $(G_IR_SCANNER) Makefile.am
+GtkVnc-$(GTK_VNC_API_VERSION).gir: GVnc-1.0.gir libgtk-vnc-$(GTK_VNC_API_VERSION).la $(G_IR_SCANNER) Makefile.am
 	$(AM_V_GEN)$(G_IR_SCANNER) -v \
                 --namespace GtkVnc \
-                --nsversion 1.0 \
+                --nsversion $(GTK_VNC_API_VERSION) \
 		--include GObject-2.0 \
-		--include Gtk-2.0 \
+		--include Gtk-$(GTK_API_VERSION) \
 		--include GVnc-1.0 \
 		--strip-prefix=Vnc \
-                --library=$(builddir)/libgtk-vnc-1.0.la \
+                --library=$(builddir)/libgtk-vnc-$(GTK_VNC_API_VERSION).la \
                 --add-include-path=$(top_srcdir) \
                 --add-include-path=$(srcdir) \
                 --add-include-path=$(builddir) \
@@ -267,19 +281,20 @@ GtkVnc-1.0.gir: GVnc-1.0.gir libgtk-vnc-1.0.la $(G_IR_SCANNER) Makefile.am
                 --pkg=gthread-2.0 \
                 --pkg=gdk-pixbuf-2.0 \
                 --pkg=gobject-2.0 \
-                --pkg=gtk+-2.0 \
+                --pkg=gtk+-$(GTK_API_VERSION) \
                 $(GTK_VNC_INTROSPECTION_SRCS)
 
 girdir = $(datadir)/gir-1.0
-gir_DATA = GVnc-1.0.gir GtkVnc-1.0.gir
+gir_DATA = GVnc-1.0.gir GtkVnc-$(GTK_VNC_API_VERSION).gir
 
 typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = GVnc-1.0.typelib GtkVnc-1.0.typelib
+typelibs_DATA = GVnc-1.0.typelib GtkVnc-$(GTK_VNC_API_VERSION).typelib
 
 %.typelib: %.gir
 	$(AM_V_GEN)$(G_IR_COMPILER) \
 		--includedir=$(srcdir) \
 		--includedir=$(builddir) \
+		--includedir=$(girdir) \
 		-o $@ $<
 
 CLEANFILES += $(gir_DATA) $(typelibs_DATA)
-- 
1.7.1.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]