[the-board] [build] Modernize introspection build with introspection.m4
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [build] Modernize introspection build with introspection.m4
- Date: Fri, 26 Nov 2010 16:10:05 +0000 (UTC)
commit d4e241bf6b301c6baf2f93a25564f5a38147b1e8
Author: Lucas Rocha <lucasr gnome org>
Date: Fri Nov 26 14:56:14 2010 +0000
[build] Modernize introspection build with introspection.m4
.gitignore | 1 -
configure.ac | 9 +----
m4/introspection.m4 | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/Makefile-tb.am | 49 +++++++++-----------------
src/Makefile.am | 9 +++++
5 files changed, 122 insertions(+), 40 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3af0b53..7f15f64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,7 +60,6 @@ data/style/Makefile
data/style/Makefile.in
data/things/Makefile
data/things/Makefile.in
-m4/
po/Makefile.in.in~
po/Makevars.template
po/Rules-quot
diff --git a/configure.ac b/configure.ac
index 3709548..e87aa6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,8 @@ PKG_PROG_PKG_CONFIG([0.22])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
+GOBJECT_INTROSPECTION_REQUIRE([0.9.6])
+
## don't rerun to this point if we abort
AC_CACHE_SAVE
@@ -57,13 +59,6 @@ PKG_CHECK_MODULES(THE_BOARD,
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)
-PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, [gobject-introspection-1.0])
-G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-AC_SUBST(G_IR_SCANNER)
-
-G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-AC_SUBST(G_IR_COMPILER)
-
#### define absolute path to srcdir for debugging-only code
ABSOLUTE_TOP_SRCDIR=`cd ${srcdir} && pwd`
AC_DEFINE_UNQUOTED(ABSOLUTE_TOP_SRCDIR, "$ABSOLUTE_TOP_SRCDIR", [full path to srcdir])
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..589721c
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+ dnl enable/disable introspection
+ m4_if([$2], [require],
+ [dnl
+ enable_introspection=yes
+ ],[dnl
+ AC_ARG_ENABLE(introspection,
+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+ [Enable introspection for this build]),,
+ [enable_introspection=auto])
+ ])dnl
+
+ AC_MSG_CHECKING([for gobject-introspection])
+
+ dnl presence/version checking
+ AS_CASE([$enable_introspection],
+ [no], [dnl
+ found_introspection="no (disabled, use --enable-introspection to enable)"
+ ],dnl
+ [yes],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+ found_introspection=yes,
+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+ ],dnl
+ [auto],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+ ],dnl
+ [dnl
+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+ ])dnl
+
+ AC_MSG_RESULT([$found_introspection])
+
+ INTROSPECTION_SCANNER=
+ INTROSPECTION_COMPILER=
+ INTROSPECTION_GENERATE=
+ INTROSPECTION_GIRDIR=
+ INTROSPECTION_TYPELIBDIR=
+ if test "x$found_introspection" = "xyes"; then
+ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+ INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+ fi
+ AC_SUBST(INTROSPECTION_SCANNER)
+ AC_SUBST(INTROSPECTION_COMPILER)
+ AC_SUBST(INTROSPECTION_GENERATE)
+ AC_SUBST(INTROSPECTION_GIRDIR)
+ AC_SUBST(INTROSPECTION_TYPELIBDIR)
+ AC_SUBST(INTROSPECTION_CFLAGS)
+ AC_SUBST(INTROSPECTION_LIBS)
+ AC_SUBST(INTROSPECTION_MAKEFILE)
+
+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
diff --git a/src/Makefile-tb.am b/src/Makefile-tb.am
index 330bc52..bc92d4d 100644
--- a/src/Makefile-tb.am
+++ b/src/Makefile-tb.am
@@ -64,35 +64,20 @@ EXTRA_DIST += \
tb/tb-enum-types.h.in \
tb/tb-enum-types.c.in
-gir_DATA += Tb-1.0.gir
-
-Tb-1.0.gir: $(G_IR_SCANNER) libtb-1.0.la Makefile
- $(AM_V_GEN) $(G_IR_SCANNER) \
- --namespace=Tb \
- --nsversion=1.0 \
- --warn-all \
- --include=Clutter-1.0 \
- --include=GdkPixbuf-2.0 \
- --include=Gtk-3.0 \
- --include=Mx-1.0 \
- --pkg=clutter-1.0 \
- --pkg=mx-1.0 \
- --pkg=gdk-pixbuf-2.0 \
- --pkg=gtk+-3.0 \
- --libtool="$(LIBTOOL)" \
- --library=libtb-1.0.la \
- $(addprefix $(srcdir)/,$(tb_source_h)) \
- $(addprefix $(srcdir)/,$(tb_source_c)) \
- $(srcdir)/tb-enum-types.h \
- $(AM_CPPFLAGS) \
- $(tb_cflags) \
- -o $@
-
-CLEANFILES += Tb-1.0.gir
-
-typelib_DATA += Tb-1.0.typelib
-
-Tb-1.0.typelib: libtb-1.0.la Tb-1.0.gir
- $(AM_V_GEN) $(G_IR_COMPILER) Tb-1.0.gir -o $@
-
-CLEANFILES += Tb-1.0.typelib
+INTROSPECTION_GIRS += Tb-1.0.gir
+
+Tb-1.0.gir: libtb-1.0.la Makefile
+Tb_1_0_gir_NAMESPACE = Tb
+Tb_1_0_gir_VERSION = 1.0
+Tb_1_0_gir_LIBS = libtb-1.0.la
+Tb_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(tb_cflags)
+Tb_1_0_gir_SCANNERFLAGS = --warn-all
+Tb_1_0_gir_INCLUDES = \
+ Clutter-1.0 \
+ GdkPixbuf-2.0 \
+ Gtk-3.0 \
+ Mx-1.0
+Tb_1_0_gir_FILES = \
+ $(addprefix $(srcdir)/,$(tb_source_h)) \
+ $(addprefix $(srcdir)/,$(tb_source_c)) \
+ $(srcdir)/tb-enum-types.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 71ee950..b32e0f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,7 @@ typelib_DATA =
EXTRA_DIST =
CLEANFILES =
BUILT_SOURCES =
+INTROSPECTION_GIRS =
# convenience command for doing Makefile variable substitutions in non-Makefile
# files (scripts, service files, etc.)
@@ -37,9 +38,17 @@ do_subst = sed -e 's|@abs_top_srcdir[ ]|$(abs_top_srcdir)|g' \
-e 's|@pkglibdir[ ]|$(pkglibdir)|g' \
-e 's|@pkgdatadir[ ]|$(pkgdatadir)|g'
+# gobject-introspection rules
+include $(INTROSPECTION_MAKEFILE)
+
include Makefile-js.am
include Makefile-tb.am
+gir_DATA += $(INTROSPECTION_GIRS)
+typelib_DATA += $(gir_DATA:.gir=.typelib)
+
+CLEANFILES += gir_DATA typelib_DATA
+
libexec_PROGRAMS += the-board-start
the_board_start_SOURCES = main.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]