[gucharmap] Add dual gtk build
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gucharmap] Add dual gtk build
- Date: Sat, 12 Jun 2010 13:49:55 +0000 (UTC)
commit 538160490c8c599c8a0472a384e986aec4f1ff44
Author: Christian Persch <chpe gnome org>
Date: Sat Jun 12 15:49:28 2010 +0200
Add dual gtk build
Allow building against gtk 2 or gtk 3. (gtk 3 is untested)
Makefile.am | 8 +++-
configure.ac | 60 ++++++++++++++++++++++++++++++++--
docs/reference/Makefile.am | 5 ++-
gucharmap-2.pc.in => gucharmap.pc.in | 6 ++--
gucharmap/Makefile.am | 58 ++++++++++++++++++++-------------
help/Makefile.am | 7 +++-
6 files changed, 111 insertions(+), 33 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6e125c5..ae35ce3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,11 @@ NULL =
ACLOCAL_AMFLAGS = -I m4
GITIGNOREFILES = m4
-SUBDIRS = po pixmaps gucharmap bindings docs
+SUBDIRS = po pixmaps gucharmap docs
+
+if HAVE_GTK_2
+SUBDIRS += bindings
+endif
if HAVE_GNOME_DOC_UTILS
SUBDIRS += help
@@ -22,7 +26,7 @@ schema_in_files = gucharmap.schemas.in
schema_DATA = $(schema_in_files:.schemas.in=.schemas)
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gucharmap-2.pc
+pkgconfig_DATA = gucharmap-$(GUCHARMAP_API_PC_VERSION).pc
EXTRA_DIST = \
ChangeLog.pre-2-23 \
diff --git a/configure.ac b/configure.ac
index 4591234..b94673c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,9 +77,53 @@ then
fi
AM_CONDITIONAL(OS_WIN32, test "x$os_win32" = "xyes")
+# Which gtk+ API version to compile against
+
+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) GTK_API_VERSION=2.0
+ GTK_REQUIRED=2.14.0
+ GUCHARMAP_API_VERSION=2.0
+ GUCHARMAP_API_MAJOR_VERSION=2
+ GUCHARMAP_API_MINOR_VERSION=0
+ GUCHARMAP_API_PC_VERSION=2
+ GUCHARMAP_LIBRARY_SUFFIX=
+ ;;
+ 2.0) GTK_API_VERSION=3.0
+ GTK_REQUIRED=2.90.0
+ GUCHARMAP_API_VERSION=3.0
+ GUCHARMAP_API_MAJOR_VERSION=3
+ GUCHARMAP_API_MINOR_VERSION=0
+ GUCHARMAP_API_PC_VERSION=3.0
+ GUCHARMAP_LIBRARY_SUFFIX="-$GUCHARMAP_API_VERSION"
+ ;;
+esac
+
+AC_SUBST([GTK_API_VERSION])
+AC_SUBST([GUCHARMAP_API_VERSION])
+AC_SUBST([GUCHARMAP_API_MAJOR_VERSION])
+AC_SUBST([GUCHARMAP_API_MINOR_VERSION])
+AC_SUBST([GUCHARMAP_API_PC_VERSION])
+AC_SUBST([GUCHARMAP_LIBRARY_SUFFIX_U],[AS_TR_SH([$GUCHARMAP_LIBRARY_SUFFIX])])
+
+AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
+AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
+
GLIB_REQUIRED=2.16.3
-GTK_REQUIRED=2.14.0
-PKG_CHECK_MODULES([GTK],[glib-2.0 >= $GLIB_REQUIRED gtk+-2.0 >= $GTK_REQUIRED])
+
+PKG_CHECK_MODULES([GTK],[
+ glib-2.0 >= $GLIB_REQUIRED
+ gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
+])
GLIB_GENMARSHAL="$($PKG_CONFIG --variable=glib_genmarshal glib-2.0)"
AC_SUBST([GLIB_GENMARSHAL])
@@ -152,6 +196,10 @@ AM_GLIB_GNU_GETTEXT
# Python Bindings
# ***************
+# Only support this on gtk+-2.0; on 3.0 you should just use gobject-introspection
+
+if test "$with_gtk" = "2.0"; then
+
AC_MSG_CHECKING([whether python bindings are requested])
AC_ARG_ENABLE([python-bindings],
AS_HELP_STRING([--enable-python-bindings],[Enable python bindings]),
@@ -212,6 +260,10 @@ if test "$enable_python_bindings" = "yes"; then
AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
fi
+else # with_gtk = 3.0
+ enable_python_bindings=no
+fi # with_gtk = 2.0
+
AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS],[test "$enable_python_bindings" = "yes"])
# ***
@@ -267,7 +319,6 @@ AC_SUBST([AM_LDFLAGS])
AC_CONFIG_FILES([
Makefile
-gucharmap-2.pc
gucharmap.desktop.in
gucharmap.nsi
gucharmap.spec
@@ -281,9 +332,12 @@ help/Makefile
help/it/Makefile
help/ja/Makefile
help/zh_CN/Makefile
+help/zh_HK/Makefile
help/zh_TW/Makefile
pixmaps/Makefile
po/Makefile.in
])
+AC_CONFIG_FILES([gucharmap-${GUCHARMAP_API_PC_VERSION}.pc:gucharmap.pc.in],[GUCHARMAP_API_PC_VERSION=$GUCHARMAP_API_PC_VERSION])
+
AC_OUTPUT
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 870c08c..4f2a9f6 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -3,6 +3,9 @@ NULL =
# The name of the module.
DOC_MODULE = gucharmap
+# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
+DOC_MODULE_VERSION = $(GUCHARMAP_API_VERSION)
+
# The top-level SGML file.
DOC_MAIN_SGML_FILE = gucharmap-docs.sgml
@@ -47,7 +50,7 @@ INCLUDES = \
$(GTK_CFLAGS)
GTKDOC_LIBS = \
- $(top_builddir)/gucharmap/libgucharmap.la \
+ $(top_builddir)/gucharmap/libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la \
$(GTK_LIBS) \
$(INTL_LIBS)
diff --git a/gucharmap-2.pc.in b/gucharmap.pc.in
similarity index 54%
rename from gucharmap-2.pc.in
rename to gucharmap.pc.in
index 44d1a8f..664f90a 100644
--- a/gucharmap-2.pc.in
+++ b/gucharmap.pc.in
@@ -6,7 +6,7 @@ includedir= includedir@
Name: gucharmap
Description: GTK+ Unicode Character Map
Version: @VERSION@
-Requires: gtk+-2.0 glib-2.0
+Requires: gtk+- GTK_API_VERSION@ glib-2.0
Requires.private: @GCONFPKGS@
-Libs: -L${libdir} -lgucharmap
-Cflags: -I${includedir}/gucharmap-2
+Libs: -L${libdir} -lgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@
+Cflags: -I${includedir}/gucharmap- GUCHARMAP_API_VERSION@
diff --git a/gucharmap/Makefile.am b/gucharmap/Makefile.am
index b1850f5..5063944 100644
--- a/gucharmap/Makefile.am
+++ b/gucharmap/Makefile.am
@@ -18,7 +18,7 @@
NULL =
-lib_LTLIBRARIES = libgucharmap.la
+lib_LTLIBRARIES = libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la
BUILT_SOURCES = \
gucharmap-marshal.c \
@@ -27,7 +27,7 @@ BUILT_SOURCES = \
gucharmap-type-builtins.h \
$(NULL)
-libgucharmap_la_SOURCES = \
+libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_SOURCES = \
gucharmap-block-chapters-model.c \
gucharmap-block-chapters-model.h \
gucharmap-block-codepoint-list.c \
@@ -63,9 +63,9 @@ libgucharmap_la_SOURCES = \
unicode-versions.h \
$(NULL)
-nodist_libgucharmap_la_SOURCES = $(BUILT_SOURCES)
+nodist_libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_SOURCES = $(BUILT_SOURCES)
-libgucharmap_la_CPPFLAGS = \
+libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_CPPFLAGS = \
-I$(top_srcdir) \
-DGUCHARMAP_COMPILATION \
-DDATADIR=\"$(datadir)\" \
@@ -80,21 +80,21 @@ libgucharmap_la_CPPFLAGS = \
$(DISABLE_DEPRECATED) \
$(AM_CPPFLAGS)
-libgucharmap_la_CFLAGS = \
+libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_CFLAGS = \
$(GTK_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS)
-libgucharmap_la_LDFLAGS = \
+libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
-version-info $(LIBGUCHARMAP_LT_VERSION) \
-export-symbols-regex "^gucharmap_*" \
$(AM_LDFLAGS)
-libgucharmap_la_LIBADD = \
+libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@_la_LIBADD = \
$(GTK_LIBS) \
$(INTLLIBS)
-libgucharmapincludedir = $(includedir)/gucharmap-2/gucharmap
+libgucharmapincludedir = $(includedir)/gucharmap-$(GUCHARMAP_API_VERSION)/gucharmap
libgucharmapinclude_HEADERS = \
gucharmap-block-chapters-model.h \
gucharmap-block-codepoint-list.h \
@@ -113,9 +113,9 @@ nodist_libgucharmapinclude_HEADERS = \
gucharmap-type-builtins.h \
$(NULL)
-bin_PROGRAMS = gucharmap
+bin_PROGRAMS = gucharmap- GUCHARMAP_API_MAJOR_VERSION@ GUCHARMAP_API_MINOR_VERSION@
-gucharmap_SOURCES = \
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_SOURCES = \
gucharmap-mini-fontsel.c \
gucharmap-mini-fontsel.h \
gucharmap-print-operation.c \
@@ -129,7 +129,7 @@ gucharmap_SOURCES = \
main.c \
$(NULL)
-gucharmap_CPPFLAGS = \
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_CPPFLAGS = \
-I$(top_srcdir) \
-DDATADIR=\"$(datadir)\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
@@ -143,23 +143,23 @@ gucharmap_CPPFLAGS = \
$(DISABLE_DEPRECATED) \
$(AM_CPPFLAGS)
-gucharmap_CFLAGS = \
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_CFLAGS = \
$(GTK_CFLAGS) \
$(GCONF_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS)
-gucharmap_LDFLAGS = \
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_LDFLAGS = \
$(AM_LDFLAGS)
-gucharmap_LDADD = \
- libgucharmap.la \
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_LDADD = \
+ libgucharmap GUCHARMAP_LIBRARY_SUFFIX_U@.la \
$(GTK_LIBS) \
$(GCONF_LIBS) \
$(INTL_LIBS)
if OS_WIN32
-gucharmap_LDADD += gucharmaprc.o
+gucharmap_ GUCHARMAP_API_MAJOR_VERSION@_ GUCHARMAP_API_MINOR_VERSION@_LDADD += gucharmaprc.o
gucharmaprc.o: gucharmaprc.rc
$(AM_V_GEN) windres -i $< -o $@
endif
@@ -204,12 +204,16 @@ gucharmap-type-builtins.c: gucharmap-type-builtins.c.template $(libgucharmapincl
if ENABLE_INTROSPECTION
girdir = $(GIRDIR)
-gir_DATA = Gucharmap-2.0.gir
+gir_DATA = Gucharmap-$(GUCHARMAP_API_VERSION).gir
typelibdir = $(GIRTYPELIBDIR)
-typelib_DATA = Gucharmap-2.0.typelib
+typelib_DATA = Gucharmap-$(GUCHARMAP_API_VERSION).typelib
-Gucharmap-2.0.gir: $(G_IR_SCANNER) libgucharmap.la $(libgucharmapinclude_HEADERS) Makefile
+if HAVE_GTK_3
+Gucharmap-$(GUCHARMAP_API_VERSION).gir: $(G_IR_SCANNER) libgucharmap-$(GUCHARMAP_API_VERSION).la $(libgucharmapinclude_HEADERS) Makefile
+else
+Gucharmap-$(GUCHARMAP_API_VERSION).gir: $(G_IR_SCANNER) libgucharmap.la $(libgucharmapinclude_HEADERS) Makefile
+endif
$(AM_V_GEN) PKG_CONFIG_PATH=$(top_builddir):$$PKG_CONFIG_PATH \
$(G_IR_SCANNER) \
--verbose \
@@ -217,11 +221,11 @@ Gucharmap-2.0.gir: $(G_IR_SCANNER) libgucharmap.la $(libgucharmapinclude_HEADERS
--nsversion=2.0 \
--include=GLib-2.0 \
--include=GObject-2.0 \
- --include=Gtk-2.0 \
- --library=gucharmap \
+ --include=Gtk-$(GTK_API_VERSION) \
+ --library=gucharmap GUCHARMAP_LIBRARY_SUFFIX_U@ \
--libtool="$(LIBTOOL)" \
--output $@ \
- --pkg gucharmap-2 \
+ --pkg gucharmap-$(GUCHARMAP_API_PC_VERSION) \
-I$(top_srcdir) \
-I$(top_builddir) \
-DGUCHARMAP_COMPILATION \
@@ -249,7 +253,7 @@ CLEANFILES = \
# don't do the symlink stuff if this is windows
if !OS_WIN32
# install a symlink to the binary called "charmap"
-install-exec-hook:
+install-exec-hook: install-exec-compat-symlinks
test -e "$(DESTDIR)$(bindir)/charmap" \
|| (cd "$(DESTDIR)$(bindir)" && $(LN_S) gucharmap charmap) ; \
test -e "$(DESTDIR)$(bindir)/gnome-character-map" \
@@ -265,4 +269,12 @@ uninstall-local:
endif # !OS_WIN32
+install-exec-compat-symlinks:
+if HAVE_GTK_2
+if !OS_WIN32
+ test -e "$(DESTDIR)$(bindir)/gucharmap" \
+ || (cd "$(DESTDIR)$(bindir)" && $(LN_S) gucharmap-2.0 gucharmap) ;
+endif
+endif
+
-include $(top_srcdir)/git.mk
diff --git a/help/Makefile.am b/help/Makefile.am
index 4da9dde..a1e40a3 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -12,6 +12,11 @@ DOC_LINGUAS = bg ca cs de el en_GB es fi fr ko oc pt_BR ru sv vi
# Please remember also to remove help/langcode/Makefile from toplevel
# configure.ac's AC_CONFIG_FILES, and remove your directory from
# the SUBDIRS below.
-SUBDIRS = it ja zh_CN zh_TW
+#
+# Only continue to support these for gtk 2
+
+if HAVE_GTK_2
+SUBDIRS = it ja zh_CN zh_HK zh_TW
+endif
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]