From 710c7aed400eb320581f160dc9cd0f4cba8676a8 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 3 Sep 2010 11:09:57 +0100 Subject: [PATCH] build: Use Makefile.introspection Whenever possible, instead of writing our own rules for generating GIR files and typelibs. --- clutter/Makefile.am | 95 +++++++++++++---------------------- clutter/cogl/cogl/Makefile.am | 36 ++++++------- clutter/json/Makefile.am | 41 ++++++++------- configure.ac | 23 +++------ 4 files changed, 85 insertions(+), 110 deletions(-) diff --git a/clutter/Makefile.am b/clutter/Makefile.am index 451786235..ee1b7565a 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -315,8 +315,12 @@ nodist_clutter_HEADERS = \ DISTCLEANFILES += clutter-version.h EXTRA_DIST += clutter-version.h.in +# these are the gir files we generate BUILT_GIRSOURCES = +# these are the gir files we scan +INTROSPECTION_GIRS = + if LOCAL_JSON_GLIB json_gir_include=--include-uninstalled=$(top_builddir)/clutter/json/ClutterJson-@CLUTTER_API_VERSION@.gir @@ -332,38 +336,25 @@ else json_gir_include=--include=Json-1.0 endif # LOCAL_JSON_GLIB +-include $(INTROSPECTION_MAKEFILE) + if HAVE_INTROSPECTION -# We can't reference the list of COGL header files, since they are in a -# subdir Makefile.am, so just extract them from cogl.h instead. The doc -# comments for COGL are in the headers, so we don't need the source files. +INTROSPECTION_GIRS += Clutter-@CLUTTER_API_VERSION@.gir -Clutter-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la - $(QUIET_SCAN)$(INTROSPECTION_SCANNER) \ - $(INTROSPECTION_SCANNER_ARGS) \ - --quiet \ - --namespace Clutter --nsversion=@CLUTTER_API_VERSION@ \ - --pkg-export clutter-1.0 \ - --warn-all \ - $(INCLUDES) \ - $(AM_CPPFLAGS) \ - --c-include='clutter/clutter.h' \ - --pkg-export=clutter-1.0 \ - --include=GL-1.0 \ - --include=GObject-2.0 \ - --include=Atk-1.0 \ - --include=Pango-1.0 \ - --include=PangoCairo-1.0 \ - --include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir \ - $(json_gir_include) \ - --library=libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(clutter_HEADERS) \ - $(nodist_clutter_HEADERS) \ - $(source_c) \ - $(built_source_c) +Clutter-@CLUTTER_API_VERSION@.gir: libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la Makefile -BUILT_GIRSOURCES += Clutter-@CLUTTER_API_VERSION@.gir +Clutter_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Clutter +Clutter_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ +Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la +Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = $(clutter_HEADERS) $(nodist_clutter_HEADERS) $(source_c) $(built_source_c) +Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) +Clutter_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 Atk-1.0 Pango-1.0 PangoCairo-1.0 +Clutter_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ + --warn-all \ + --c-include='clutter/clutter.h' \ + --pkg-export clutter-1.0 \ + $(json_gir_include) \ + --include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir # ClutterJson.gir and Cogl.gir are used included into Clutter.gir, so need # to be built before the typelib is generated @@ -386,45 +377,31 @@ BUILT_GIRSOURCES += Cogl-@CLUTTER_API_VERSION@.gir # for Cogl and ClutterJson. cally_sources=$(top_srcdir)/clutter/cally/*.h $(top_srcdir)/clutter/cally/*.c cally_introspection_files=$(filter-out %-private.h, $(cally_sources)) -Cally-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) Clutter-@CLUTTER_API_VERSION@.gir - $(QUIET_SCAN)$(INTROSPECTION_SCANNER) \ - $(INTROSPECTION_SCANNER_ARGS) \ - --quiet \ - --namespace Cally --nsversion=@CLUTTER_API_VERSION@ \ - $(INCLUDES) \ - $(AM_CPPFLAGS) \ - --c-include='cally/cally.h' \ - --include=Pango-1.0 \ - $(json_gir_include) \ - --include-uninstalled=$(top_builddir)/clutter/cogl/cogl/Cogl-@CLUTTER_API_VERSION@.gir \ - --include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir \ - --library=libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(cally_introspection_files) -BUILT_GIRSOURCES += Cally-@CLUTTER_API_VERSION@.gir +Cally-@CLUTTER_API_VERSION@.gir: Clutter-@CLUTTER_API_VERSION@.gir Makefile -Cally-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir +Cally_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally +Cally_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ +Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-@CLUTTER_SONAME_INFIX@-@CLUTTER_API_VERSION@.la +Cally_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cally_introspection_files) +Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) +Cally_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ + --warn-all \ + --c-include='cally/cally.h' \ + --add-include-path $(top_builddir)/clutter \ + --include-uninstalled $(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir + +INTROSPECTION_GIRS += Cally-@CLUTTER_API_VERSION@.gir # INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to # install anything - we need to install inside our prefix. girdir = $(datadir)/gir-1.0 -gir_DATA = $(BUILT_GIRSOURCES) +dist_gir_DATA = $(BUILT_GIRSOURCES) $(INTROSPECTION_GIRS) typelibsdir = $(libdir)/girepository-1.0/ +typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) $(INTROSPECTION_GIRS:.gir=.typelib) -typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) - -%.typelib: %.gir $(INTROSPECTION_COMPILER) - $(QUIET_COMP) \ - LD_LIBRARY_PATH=.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \ - $(INTROSPECTION_COMPILER) \ - --includedir=$(srcdir) \ - --includedir=. \ - $(INTROSPECTION_COMPILER_ARGS) $< -o $(@F) - -CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) +CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA) endif # HAVE_INTROSPECTION gcov_sources = $(source_c) diff --git a/clutter/cogl/cogl/Makefile.am b/clutter/cogl/cogl/Makefile.am index 4de6fae2b..6b25a63d2 100644 --- a/clutter/cogl/cogl/Makefile.am +++ b/clutter/cogl/cogl/Makefile.am @@ -235,26 +235,26 @@ coglincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl coglinclude_HEADERS = $(cogl_headers) nodist_coglinclude_HEADERS = cogl-defines.h cogl-enum-types.h -if HAVE_INTROSPECTION -Cogl-@CLUTTER_API_VERSION@.gir: Makefile $(INTROSPECTION_SCANNER) libclutter-cogl.la - $(QUIET_SCAN)$(INTROSPECTION_SCANNER) \ - $(INTROSPECTION_SCANNER_ARGS) \ - --quiet \ - --namespace Cogl --nsversion=@CLUTTER_API_VERSION@ \ - $(INCLUDES) \ - $(AM_CPPFLAGS) \ - --c-include='cogl/cogl.h' \ - --include=GL-1.0 \ - --include=GObject-2.0 \ - --library=libclutter-cogl.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(cogl_headers) cogl-enum-types.h +-include $(INTROSPECTION_MAKEFILE) -BUILT_GIRSOURCES = Cogl-@CLUTTER_API_VERSION@.gir +INTROSPECTION_GIRS = + +if HAVE_INTROSPECTION + +Cogl-@CLUTTER_API_VERSION@.gir: libclutter-cogl.la Makefile + +Cogl_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cogl +Cogl_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ +Cogl_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-cogl.la +Cogl_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cogl_headers) cogl-enum-types.h +Cogl_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) +Cogl_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 +Cogl_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h' + +INTROSPECTION_GIRS += Cogl-@CLUTTER_API_VERSION@.gir girdir = $(datadir)/gir-1.0 -gir_DATA = $(BUILT_GIRSOURCES) +dist_gir_DATA = $(INTROSPECTION_GIRS) -CLEANFILES += $(BUILT_GIRSOURCES) +CLEANFILES += $(INTROSPECTION_GIRS) endif diff --git a/clutter/json/Makefile.am b/clutter/json/Makefile.am index 19d5080f5..cf6d16c8d 100644 --- a/clutter/json/Makefile.am +++ b/clutter/json/Makefile.am @@ -20,9 +20,6 @@ source_h_priv = \ noinst_LTLIBRARIES = libclutter-json.la -libclutter_json_la_SOURCES = $(source_c) $(source_h) $(source_h_priv) -libclutter_json_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) - INCLUDES = \ -I$(top_srcdir) \ -DG_DISABLE_SINGLE_INCLUDES \ @@ -31,32 +28,40 @@ INCLUDES = \ -DJSON_COMPILATION AM_CFLAGS = $(MAINTAINER_CFLAGS) +AM_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) clutterjsondir = $(includedir)/clutter-@CLUTTER_API_VERSION@/clutter/json clutterjson_HEADERS = $(source_h) +libclutter_json_la_SOURCES = $(source_c) $(source_h) $(source_h_priv) + noinst_DATA = CLEANFILES = +-include $(INTROSPECTION_MAKEFILE) + +INTROSPECTION_GIRS = + if HAVE_INTROSPECTION + BUILT_GIRSOURCES = -ClutterJson-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-json.la - $(QUIET_SCAN)$(INTROSPECTION_SCANNER) \ - $(INTROSPECTION_SCANNER_ARGS) \ - --quiet \ - --namespace ClutterJson --nsversion=@CLUTTER_API_VERSION@ \ - $(INCLUDES) \ - --include=GObject-2.0 \ - --library=libclutter-json.la \ - --libtool="$(top_builddir)/libtool" \ - --output $@ \ - $(clutterjson_HEADERS) \ - $(source_c) +ClutterJson-@CLUTTER_API_VERSION@.gir: libclutter-json.la Makefile -BUILT_GIRSOURCES += ClutterJson-@CLUTTER_API_VERSION@.gir +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = ClutterJson +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@ +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_LIBS = libclutter-json.la +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_FILES = $(clutterjson_HEADERS) $(source_c) +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(INCLUDES) $(AM_CPPFLAGS) +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GObject-2.0 +ClutterJson_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \ + --warn-all \ + --identifier-prefix=Json \ + --symbol-prefix=json -noinst_DATA += $(BUILT_GIRSOURCES) +INTROSPECTION_GIRS += ClutterJson-@CLUTTER_API_VERSION@.gir + +girdir = $(datadir)/gir-1.0 +dist_gir_DATA = $(INTROSPECTION_GIRS) -CLEANFILES += $(BUILT_GIRSOURCES) endif diff --git a/configure.ac b/configure.ac index 41a4ca511..d7b2a128f 100644 --- a/configure.ac +++ b/configure.ac @@ -62,20 +62,13 @@ AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define dist-bzip2 check-news] AM_SILENT_RULES([yes]) -CLUTTER_MAJOR_VERSION=clutter_major_version -CLUTTER_MINOR_VERSION=clutter_minor_version -CLUTTER_MICRO_VERSION=clutter_micro_version -CLUTTER_VERSION=clutter_version -CLUTTER_API_VERSION=clutter_api_version -CLUTTER_MAJORMINOR=clutter_major_version.clutter_minor_version -CLUTTER_RELEASE_STATUS=clutter_release_status -AC_SUBST(CLUTTER_MAJOR_VERSION) -AC_SUBST(CLUTTER_MINOR_VERSION) -AC_SUBST(CLUTTER_MICRO_VERSION) -AC_SUBST(CLUTTER_VERSION) -AC_SUBST(CLUTTER_API_VERSION) -AC_SUBST(CLUTTER_MAJORMINOR) -AC_SUBST(CLUTTER_RELEASE_STATUS) +AC_SUBST([CLUTTER_MAJOR_VERSION], [clutter_major_version]) +AC_SUBST([CLUTTER_MINOR_VERSION], [clutter_minor_version]) +AC_SUBST([CLUTTER_MICRO_VERSION], [clutter_micro_version]) +AC_SUBST([CLUTTER_VERSION], [clutter_version]) +AC_SUBST([CLUTTER_API_VERSION], [clutter_api_version]) +AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0]) +AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status]) m4_define([lt_current], [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)]) m4_define([lt_revision], [clutter_interface_age]) @@ -88,7 +81,6 @@ CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION" AC_SUBST(CLUTTER_LT_VERSION) AC_SUBST(CLUTTER_LT_LDFLAGS) -AC_SUBST(CLUTTER_LINK_FLAGS) dnl ======================================================================== @@ -121,6 +113,7 @@ AC_TRY_LINK([], [int main (void) { return 0; }], AC_MSG_RESULT([no]) ]) LDFLAGS="${clutter_LDFLAGS}" +AC_SUBST(CLUTTER_LINK_FLAGS) dnl ========================================================================