[gexiv2] build: Use m4 introspection macros



commit 18781b8b0a2144b620a60aaf329b054ec481a001
Author: Jens Georg <mail jensge org>
Date:   Sat Apr 23 09:43:42 2016 +0200

    build: Use m4 introspection macros
    
    Also fix the package name presented in the GIR file (was gobject-2.0)
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765827

 Makefile.am  |   48 ++++++++++++++++++++++--------------------------
 configure.ac |   22 +++++++++-------------
 2 files changed, 31 insertions(+), 39 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b3eb244..43a776b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 pkgconfigdir     = $(libdir)/pkgconfig
 GEXIV2_publicdir = $(includedir)/gexiv2
 girdir           = $(datadir)/gir-1.0
-typelibdir       = `pkg-config gobject-introspection-no-export-1.0 --variable typelibdir`
+typelibdir       = $(INTROSPECTION_TYPELIBDIR)
 py2gidir         = $(PYTHON2_GIDIR)
 py3gidir         = $(PYTHON3_GIDIR)
 vapidir          = $(datadir)/vala/vapi
@@ -24,7 +24,7 @@ EXTRA_DIST = \
 # Installed Files #
 pkgconfig_DATA  = @PACKAGE_NAME  pc
 lib_LTLIBRARIES = lib PACKAGE_NAME@.la
-if ENABLE_INTROSPECTION
+if HAVE_INTROSPECTION
 gir_DATA        = GExiv2-$(GIR_VERSION).gir
 typelib_DATA    = GExiv2-$(GIR_VERSION).typelib
 # No introspection, no .gi file for the Python module to call into
@@ -130,28 +130,24 @@ endif
 
 # Optional Introspection #
 
-if ENABLE_INTROSPECTION
-TYPELIB_FILES=GExiv2-$(GIR_VERSION).typelib GExiv2-$(GIR_VERSION).gir
-CLEANFILES=$(TYPELIB_FILES)
+-include $(INTROSPECTION_MAKEFILE)
+if HAVE_INTROSPECTION
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = \
+                            --symbol-prefix= PACKAGE_NAME@             \
+                            --add-include-path=$(BUILD_DIR) \
+                            --pkg-export=gexiv2 \
+                            $(WARN_SCANNERFLAGS)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(BUILD_DIR)
+
+GExiv2- GIR_VERSION@.gir: lib PACKAGE_NAME@.la
+GExiv2_ GIR_VERSION_U@_gir_INCLUDES = GObject-2.0
+GExiv2_ GIR_VERSION_U@_gir_CFLAGS = -I$(srcdir) -I PACKAGE_NAME@
+GExiv2_ GIR_VERSION_U@_gir_LIBS = lib PACKAGE_NAME@.la
+GExiv2_ GIR_VERSION_U@_gir_FILES = $(GEXIV2_public_HEADERS)
+GExiv2_ GIR_VERSION_U@_gir_NAMESPACE = GExiv2
+GExiv2_ GIR_VERSION_U@_gir_VERSION = $(GIR_VERSION)
+INTROSPECTION_GIRS += GExiv2-$(GIR_VERSION).gir
+
+CLEANFILES = $(gir_DATA) $(typelib_DATA)
 endif
-
-BUILD_DIR=gexiv2
-
-%.typelib: %.gir
-       g-ir-compiler --includedir=$(BUILD_DIR) -o $@ $<
-
-GExiv2-$(GIR_VERSION).gir: lib PACKAGE_NAME@.la
-       g-ir-scanner --verbose                          \
-               --namespace=GExiv2                      \
-               --nsversion=$(GIR_VERSION)              \
-               --symbol-prefix= PACKAGE_NAME@              \
-               -I$(srcdir)                                                      \
-               --include=GObject-2.0                   \
-               --add-include-path=$(BUILD_DIR)         \
-               --output $@                             \
-               -I @PACKAGE_NAME@                           \
-               $(GEXIV2_public_HEADERS)      \
-               --library lib PACKAGE_NAME@.la                \
-               $(LIBTOOL)                              \
-               --pkg=gobject-2.0
-
diff --git a/configure.ac b/configure.ac
index 2a4c895..095f3c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,13 +24,18 @@ m4_define([gexiv2_micro_version], [3])
 m4_define([gexiv2_real_version],
           [gexiv2_major_version.gexiv2_minor_version.gexiv2_micro_version])
 m4_define([gexiv2_version], [gexiv2_real_version])
+m4_define([gexiv2_gir_version], [gexiv2_major_version.gexiv2_minor_version])
+m4_define([gexiv2_gir_version_u], m4_joinall([_], gexiv2_major_version,
+          gexiv2_minor_version))
 
 # Set to target (stable) major.minor version
 #
 # This was necessary because the typelib files don't seem to load if the
 # version info has more than one period in it.
-GIR_VERSION=0.10
+GIR_VERSION=gexiv2_gir_version
 AC_SUBST(GIR_VERSION)
+GIR_VERSION_U=gexiv2_gir_version_u
+AC_SUBST(GIR_VERSION_U)
 
 m4_define([glib_required_version], [2.26.1])
 m4_define([exiv2_required_version], [0.21])
@@ -106,20 +111,11 @@ fi
 # Introspection #
 #################
 
-AC_MSG_CHECKING([enable introspection])
-AC_ARG_ENABLE(introspection,
-              [  --enable-introspection  enable introspection [[default=no]]],
-              if eval "test x$enable_introspection = xyes"; then
-              enable_introspection="yes"
-              fi,
-              enable_introspection=no)
-
-AM_CONDITIONAL(ENABLE_INTROSPECTION, test "x$enable_introspection" = "xyes")
-AC_MSG_RESULT([$enable_introspection])
+GOBJECT_INTROSPECTION_CHECK([0.6.4])
 
 enable_python2="no (introspection disabled)"
 enable_python3="no (introspection disabled)"
-if test "x$enable_introspection" = "xyes"; then
+if test "x$found_introspection" = "xyes"; then
     # Used to determine where Python wants the .gi file to be installed ...
     # if Python is not installed, PYTHON2 and PYTHON3 will be empty
     PYTHON="import gi; print(gi._overridesdir)"
@@ -241,7 +237,7 @@ AC_MSG_RESULT([
 GExiv2 will be built with prefix $prefix for $host (cross-compiling: $cross_compiling).
 
 Options:
-    Introspection:      $enable_introspection
+    Introspection:      $found_introspection
     Python2 binding:    $enable_python2
     Python3 binding:    $enable_python3
     Tests and utils:    $enable_tests


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