[gnome-keyring: 1/3] Port to GTK+ 3



commit 41853fa7f5af2440be5e1008ee665e0be10343fe
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Aug 25 14:43:55 2010 +0100

    Port to GTK+ 3
    
    Add a --with-gtk=[2.0|3.0] option to configure to allow building against
    GTK+ 2 or GTK+ 3. Closes: bgo#624570

 configure.in                   |   34 ++++++++++++++++++++++++++++++++--
 docs/reference/gcr/Makefile.am |    5 ++---
 gcr/.gitignore                 |    1 +
 gcr/Makefile.am                |   14 +++++++-------
 gcr/gcr.pc.in                  |    8 ++++----
 gcr/tests/Makefile.am          |    2 +-
 tool/.gitignore                |    1 +
 tool/Makefile.am               |   16 +++++++++++-----
 ui/.gitignore                  |    1 +
 ui/Makefile.am                 |   18 ++++++++++++------
 10 files changed, 72 insertions(+), 28 deletions(-)
---
diff --git a/configure.in b/configure.in
index 8d0e430..c950e8a 100644
--- a/configure.in
+++ b/configure.in
@@ -24,7 +24,8 @@ GP11_REVISION=0
 GP11_AGE=0
 
 # GCR package versioning
-GCR_MAJOR=0
+GCR_MAJOR_GTK2=0
+GCR_MAJOR_GTK3=1
 GCR_MINOR=0
 GCR_MICRO=0
 
@@ -81,9 +82,36 @@ PKG_CHECK_MODULES(GIO, glib-2.0 >= 2.16.0 gio-2.0)
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.20.0)
+AC_MSG_CHECKING([which GTK+ version to compile against])
+AC_ARG_WITH([gtk],
+	[AS_HELP_STRING([--with-gtk=2.0|3.0],[which GTK+ version to compile against (default: 2.0)])],
+	[case "$with_gtk" in
+		2.0|3.0) ;;
+		*) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
+	esac],
+	[with_gtk=2.0])
+AC_MSG_RESULT([$with_gtk])
+
+case "$with_gtk" in
+	2.0)
+		GCR_MAJOR=$GCR_MAJOR_GTK2
+		GCR_VERSION_SUFFIX=
+		GTK_API_VERSION=2.0
+		GTK_REQUIRED=2.20.0
+	;;
+	3.0)
+		GCR_MAJOR=$GCR_MAJOR_GTK3
+		GCR_VERSION_SUFFIX=-$GCR_MAJOR
+		GTK_API_VERSION=3.0
+		GTK_REQUIRED=2.90.0
+	;;
+esac
+
+PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
+AC_SUBST(GTK_API_VERSION)
+AM_CONDITIONAL([HAVE_GTK3],[test "$with_gtk" = "3.0"])
 
 GETTEXT_PACKAGE=gnome-keyring
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain name])
@@ -596,6 +624,7 @@ AC_SUBST(GP11_MAJOR)
 GCR_LT_RELEASE=$GCR_CURRENT:$GCR_REVISION:$GCR_AGE
 AC_SUBST(GCR_LT_RELEASE)
 AC_SUBST(GCR_MAJOR)
+AC_SUBST(GCR_VERSION_SUFFIX)
 
 AC_SUBST(DAEMON_CFLAGS)
 AC_SUBST(DAEMON_LIBS)
@@ -680,6 +709,7 @@ echo "CONFIGURATION"
 echo "  SSH Agent:            $ssh_status"
 echo "  GPG Agent:            $gpg_status"
 echo "  Root Certificates:    $root_status"
+echo "  GTK+ Version:         $GTK_API_VERSION"
 echo
 echo "BUILD"
 echo "  Debug Build:          $debug_status"
diff --git a/docs/reference/gcr/Makefile.am b/docs/reference/gcr/Makefile.am
index 43eba2b..fd9955b 100644
--- a/docs/reference/gcr/Makefile.am
+++ b/docs/reference/gcr/Makefile.am
@@ -12,8 +12,7 @@ AUTOMAKE_OPTIONS = 1.6
 DOC_MODULE=gcr
 
 # Uncomment for versioned docs and specify the version of the module, e.g. '2'.
-#DOC_MODULE_VERSION=2
-
+DOC_MODULE_VERSION= GCR_MAJOR@
 
 # The top-level SGML file. You can change this if you want to.
 DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
@@ -79,7 +78,7 @@ expand_content_files=
 # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
 # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
 GTKDOC_CFLAGS= -I$(top_srcdir) -I$(top_builddir) $(GOBJECT_CFLAGS) -Wno-error
-GTKDOC_LIBS= $(GOBJECT_LIBS) $(top_builddir)/$(DOC_MODULE)/lib$(DOC_MODULE).la
+GTKDOC_LIBS= $(GOBJECT_LIBS) $(top_builddir)/$(DOC_MODULE)/lib$(DOC_MODULE)@GCR_VERSION_SUFFIX  la
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
 include $(top_srcdir)/gtk-doc.make
diff --git a/gcr/.gitignore b/gcr/.gitignore
index 9822220..37f3b39 100644
--- a/gcr/.gitignore
+++ b/gcr/.gitignore
@@ -1,2 +1,3 @@
 /gcr.pc
 /gcr-0.pc
+/gcr-1.pc
diff --git a/gcr/Makefile.am b/gcr/Makefile.am
index d76cd59..6ec1c9b 100644
--- a/gcr/Makefile.am
+++ b/gcr/Makefile.am
@@ -2,7 +2,7 @@
 # UI BUILDER
 # 
 
-uidir = $(datadir)/gcr/ui/
+uidir = $(datadir)/gcr GCR_VERSION_SUFFIX@/ui/
 
 ui_DATA = \
 	gcr-certificate-basics-widget.ui \
@@ -12,7 +12,7 @@ ui_DATA = \
 # ------------------------------------------------------------------
 # HEADERS
 
-incdir = $(includedir)/gcr
+incdir = $(includedir)/gcr GCR_VERSION_SUFFIX@
 
 inc_HEADERS = \
 	gcr.h \
@@ -40,9 +40,9 @@ INCLUDES = \
 BUILT_SOURCES = \
 	gcr-marshal.c gcr-marshal.h
 
-lib_LTLIBRARIES = libgcr.la
+lib_LTLIBRARIES = libgcr GCR_VERSION_SUFFIX@.la
 
-libgcr_la_SOURCES = \
+libgcr GCR_VERSION_SUFFIX@_la_SOURCES = \
 	gcr-certificate.c gcr-certificate.h \
 	gcr-certificate-basics-widget.c gcr-certificate-basics-widget.h \
 	gcr-certificate-details-widget.c gcr-certificate-details-widget.h \
@@ -56,16 +56,16 @@ libgcr_la_SOURCES = \
 	gcr-unlock-options-widget.c gcr-unlock-options-widget.h \
 	$(BUILT_SOURCES)
 
-libgcr_la_CFLAGS = \
+libgcr GCR_VERSION_SUFFIX@_la_CFLAGS = \
 	-DPKCS11_MODULE_PATH=\""$(libdir)/gnome-keyring/gnome-keyring-pkcs11.so"\" \
 	-DGCR_API_SUBJECT_TO_CHANGE \
 	-DUIDIR=\""$(uidir)"\"
     
-libgcr_la_LDFLAGS = \
+libgcr GCR_VERSION_SUFFIX@_la_LDFLAGS = \
     	-version-info $(GCR_LT_RELEASE) \
 	-no-undefined -export-symbols-regex 'gcr_*'
     
-libgcr_la_LIBADD = \
+libgcr GCR_VERSION_SUFFIX@_la_LIBADD = \
 	$(top_builddir)/egg/libegg.la \
 	$(top_builddir)/egg/libegg-entry-buffer.la \
 	$(top_builddir)/gp11/libgp11.la \
diff --git a/gcr/gcr.pc.in b/gcr/gcr.pc.in
index 56c4b51..264ecdd 100644
--- a/gcr/gcr.pc.in
+++ b/gcr/gcr.pc.in
@@ -6,9 +6,9 @@ datarootdir= datarootdir@
 datadir= datadir@
 sysconfdir= sysconfdir@
 
-Name: gcr
+Name: gcr GCR_VERSION_SUFFIX@
 Description: GObject and GUI library for high level crypto parsing and display
 Version: @VERSION@
-Requires: glib-2.0 gtk+-2.0 libtasn1 gp11-0
-Libs: -L${libdir} -lgcr
-Cflags: -I${includedir}/gcr
+Requires: glib-2.0 gtk+- GTK_API_VERSION@ libtasn1 gp11-0
+Libs: -L${libdir} -lgcr GCR_VERSION_SUFFIX@
+Cflags: -I${includedir}/gcr GCR_VERSION_SUFFIX@
diff --git a/gcr/tests/Makefile.am b/gcr/tests/Makefile.am
index d100859..0e33394 100644
--- a/gcr/tests/Makefile.am
+++ b/gcr/tests/Makefile.am
@@ -28,7 +28,7 @@ ui_test_details_CFLAGS = \
 	$(GTK_CFLAGS)
 	
 ui_test_details_LDADD = \
-	$(top_builddir)/gcr/libgcr.la \
+	$(top_builddir)/gcr/libgcr GCR_VERSION_SUFFIX@.la \
 	$(GTK_LIBS) \
 	$(LIBGCRYPT_LIBS)
 
diff --git a/tool/.gitignore b/tool/.gitignore
index a264247..22f1045 100644
--- a/tool/.gitignore
+++ b/tool/.gitignore
@@ -1 +1,2 @@
 /gnome-keyring
+/gnome-keyring-1
diff --git a/tool/Makefile.am b/tool/Makefile.am
index 9bb405d..01fc9d8 100644
--- a/tool/Makefile.am
+++ b/tool/Makefile.am
@@ -1,5 +1,5 @@
 bin_PROGRAMS= \
-	gnome-keyring
+	gnome-keyring GCR_VERSION_SUFFIX@
 
 INCLUDES=	\
 	-I$(top_srcdir) \
@@ -8,19 +8,25 @@ INCLUDES=	\
 	$(GOBJECT_CFLAGS) \
 	$(GLIB_CFLAGS)
 	
-gnome_keyring_SOURCES = \
+gnome_keyring GCR_VERSION_SUFFIX@_SOURCES = \
 	gkr-tool.c gkr-tool.h \
 	gkr-tool-import.c
 	
-gnome_keyring_CFLAGS = \
+gnome_keyring GCR_VERSION_SUFFIX@_CFLAGS = \
 	-DGCR_API_SUBJECT_TO_CHANGE \
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"
 
-gnome_keyring_LDADD = \
+gnome_keyring GCR_VERSION_SUFFIX@_LDADD = \
 	$(top_builddir)/gp11/libgp11.la \
-	$(top_builddir)/gcr/libgcr.la \
+	$(top_builddir)/gcr/libgcr GCR_VERSION_SUFFIX@.la \
 	$(top_builddir)/egg/libegg.la \
 	$(GTHREAD_LIBS) \
 	$(GTK_LIBS) \
 	$(GCRYPT_LIBS) \
 	$(DAEMON_LIBS)
+
+# Install a link from gnome-keyring â?? gnome-keyring GCR_VERSION_SUFFIX@ to maintain compatibility
+if HAVE_GTK3
+install-exec-hook:
+	@test -e "$(DESTDIR)$(bindir)/gnome-keyring" || (cd $(DESTDIR)$(bindir) && $(LN_S) gnome-keyring GCR_VERSION_SUFFIX@ gnome-keyring)
+endif
diff --git a/ui/.gitignore b/ui/.gitignore
index 8b27ca3..ba5902d 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -1 +1,2 @@
 /gnome-keyring-prompt
+/gnome-keyring-prompt-1
diff --git a/ui/Makefile.am b/ui/Makefile.am
index 4d156a0..23876d6 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -21,7 +21,7 @@ INCLUDES= \
 # UI BUILDER
 #
 
-uidir = $(datadir)/gnome-keyring/ui/
+uidir = $(datadir)/gnome-keyring GCR_VERSION_SUFFIX@/ui/
 
 ui_DATA = \
 	gku-prompt.ui
@@ -59,21 +59,27 @@ EXTRA_DIST = \
 #
 
 libexec_PROGRAMS= \
-	gnome-keyring-prompt
+	gnome-keyring-prompt GCR_VERSION_SUFFIX@
 
-gnome_keyring_prompt_SOURCES = \
+gnome_keyring_prompt GCR_VERSION_SUFFIX@_SOURCES = \
 	gku-prompt-tool.c \
 	gku-prompt-util.c gku-prompt-util.h
 
-gnome_keyring_prompt_LDADD = \
+gnome_keyring_prompt GCR_VERSION_SUFFIX@_LDADD = \
 	$(top_builddir)/egg/libegg-prompt.la \
 	$(top_builddir)/egg/libegg-entry-buffer.la \
-	$(top_builddir)/gcr/libgcr.la \
+	$(top_builddir)/gcr/libgcr GCR_VERSION_SUFFIX@.la \
 	$(LIBGCRYPT_LIBS) \
 	$(GTK_LIBS)
 
-gnome_keyring_prompt_CFLAGS = \
+gnome_keyring_prompt GCR_VERSION_SUFFIX@_CFLAGS = \
 	-DUIDIR=\""$(uidir)"\" \
 	-DGCR_API_SUBJECT_TO_CHANGE \
 	$(LIBGCRYPT_CFLAGS) \
 	$(GTK_CFLAGS)
+
+# Install a link from gnome-keyring-prompt â?? gnome-keyring-prompt GCR_VERSION_SUFFIX@ to maintain compatibility
+if HAVE_GTK3
+install-exec-hook:
+	@test -e "$(DESTDIR)$(libexecdir)/gnome-keyring-prompt" || (cd $(DESTDIR)$(libexecdir) && $(LN_S) gnome-keyring-prompt GCR_VERSION_SUFFIX@ gnome-keyring-prompt)
+endif



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