[pygobject/gsoc2009: 127/160] Make gi an optional build through --enable-gi



commit 07893f36d697cd7052ede6952c3f3ae6ff9ba29d
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Mon Aug 10 23:38:11 2009 +0200

    Make gi an optional build through --enable-gi

 configure.ac              |   25 ++++++++++++++-----------
 gi/Makefile.am            |   30 ++++++++++++++++--------------
 gi/overrides/Makefile.am  |    8 ++++----
 gi/repository/Makefile.am |    9 +++++----
 gobject/Makefile.am       |    4 ++--
 gobject/pygobject.c       |    6 +++---
 6 files changed, 44 insertions(+), 38 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ccf6db5..615f2b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,17 +200,20 @@ if test -n "$export_dynamic"; then
   GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"`
 fi
 
-dnl gobject_introspection
-PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= gobject_introspection_required_version,
-	have_gobject_introspection=true, have_gobject_introspection=false)
-AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
-AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
-AM_CONDITIONAL(BUILD_GOBJECT_INTROSPECTION, $have_gobject_introspection)
-if test "$have_gobject_introspection" = true; then
- AC_DEFINE(HAVE_GIREPOSITORY_H,1,[Define to 1 if you have the <girepository.h> header file.])
-fi
-if test -n "$export_dynamic"; then
-  GOBJECT_INTROSPECTION_LIBS=`echo $GOBJECT_INTROSPECTION_LIBS | sed -e "s/$export_dynamic//"`
+dnl gi
+AC_ARG_ENABLE(gi,
+  AC_HELP_STRING([--enable-gi], [Enable gobject-introspection bindings building]),
+  enable_gi=$enableval,
+  enable_gi=no)
+AM_CONDITIONAL(BUILD_GI, test "$enable_gi" != no)
+if test "$enable_gi" != no; then
+  PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= gobject_introspection_required_version)
+  AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
+  AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
+  AC_DEFINE(HAVE_PYGI_H,1,[Define to 1 if you have the <pygi.h> header file.])
+  if test -n "$export_dynamic"; then
+    GOBJECT_INTROSPECTION_LIBS=`echo $GOBJECT_INTROSPECTION_LIBS | sed -e "s/$export_dynamic//"`
+  fi
 fi
 
 dnl add required cflags ...
diff --git a/gi/Makefile.am b/gi/Makefile.am
index f2ea927..e0404a7 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -1,8 +1,12 @@
 AUTOMAKE_OPTIONS = 1.7
+PLATFORM_VERSION = 2.0
 
-SUBDIRS = repository overrides
+pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION)
+pkgpyexecdir = $(pyexecdir)/gtk-2.0
 
-PLATFORM_VERSION = 2.0
+if BUILD_GI
+
+SUBDIRS = repository overrides
 
 INCLUDES = \
 	-I$(top_srcdir)/gobject \
@@ -10,14 +14,11 @@ INCLUDES = \
 	$(PYGOBJECT_CFLAGS) \
 	$(GOBJECT_INTROSPECTION_CFLAGS)
 
-pkgincludedir = $(includedir)/pygtk-$(PLATFORM_VERSION)
+# headers
 pkginclude_HEADERS = pygi.h
 
-# gi extension modules
-pkgpyexecdir = $(pyexecdir)/gtk-2.0/gi
-
-# gi python scripts
-pygidir = $(pkgpyexecdir)
+# gi Python scripts and modules
+pygidir = $(pkgpyexecdir)/gi
 pygi_PYTHON = \
 	types.py \
 	module.py \
@@ -30,8 +31,8 @@ if PLATFORM_WIN32
 common_ldflags += -no-undefined
 endif
 
-# repo module
-_gi_la_CFLAGS = -O0 -Werror
+# _gi module
+_gi_la_CFLAGS = -O0
 _gi_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gi
 _gi_la_LIBADD = $(GOBJECT_INTROSPECTION_LIBS)
 _gi_la_SOURCES = \
@@ -47,11 +48,12 @@ _gi_la_SOURCES = \
 
 pygi_LTLIBRARIES = _gi.la
 
-if BUILD_GOBJECT_INTROSPECTION
+
+.la.so:
+	$(LN_S) .libs/$@ $@ || true
+
 all: $(pygi_LTLIBRARIES:.la=.so)
 clean-local:
 	rm -f $(pygi_LTLIBRARIES:.la=.so)
-.la.so:
-	$(LN_S) .libs/$@ $@ || true
-endif
 
+endif # BUILD_GI
diff --git a/gi/overrides/Makefile.am b/gi/overrides/Makefile.am
index 02bbd3b..779b945 100644
--- a/gi/overrides/Makefile.am
+++ b/gi/overrides/Makefile.am
@@ -1,11 +1,11 @@
 AUTOMAKE_OPTIONS = 1.7
 PLATFORM_VERSION = 2.0
 
-# gi-overrides extension modules
-pkgpyexecdir = $(pyexecdir)/gtk-2.0/gi/overrides
+# package
+pkgpyexecdir = $(pyexecdir)/gtk-2.0/gi
 
-# gi-overrides python scripts
-pygioverridesdir = $(pkgpyexecdir)
+# gi-overrides Python scripts and modules
+pygioverridesdir = $(pkgpyexecdir)/overrides
 pygioverrides_PYTHON = \
 	Gtk.py \
 	Gdk.py \
diff --git a/gi/repository/Makefile.am b/gi/repository/Makefile.am
index a95507f..0cbf846 100644
--- a/gi/repository/Makefile.am
+++ b/gi/repository/Makefile.am
@@ -1,11 +1,12 @@
 AUTOMAKE_OPTIONS = 1.7
 PLATFORM_VERSION = 2.0
 
-# gi-repository extension modules
-pkgpyexecdir = $(pyexecdir)/gtk-2.0/gi/repository
 
-# gi-repository python scripts
-pygirepositorydir = $(pkgpyexecdir)
+# package
+pkgpyexecdir = $(pyexecdir)/gtk-2.0/gi
+
+# gi-repository Python scripts and modules
+pygirepositorydir = $(pkgpyexecdir)/repository
 pygirepository_PYTHON = \
 	__init__.py
 
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index f3b776a..3aedbfd 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -38,7 +38,7 @@ _gobject_la_CFLAGS = \
 	$(FFI_CFLAGS) \
 	$(GLIB_CFLAGS) \
 	 -DPY_SSIZE_T_CLEAN
-if BUILD_GOBJECT_INTROSPECTION
+if BUILD_GI
 _gobject_la_CFLAGS += \
 	-I$(top_srcdir)/gi \
 	$(GOBJECT_INTROSPECTION_CFLAGS)
@@ -48,7 +48,7 @@ _gobject_la_LIBADD = \
 	$(GLIB_LIBS) \
 	$(FFI_LIBS) \
 	$(top_builddir)/glib/libpyglib-2 0- PYTHON_BASENAME@.la
-if BUILD_GOBJECT_INTROSPECTION
+if BUILD_GI
 _gobject_la_LIBADD += \
 	$(GOBJECT_INTROSPECTION_LIBS)
 endif
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index db8e2a3..0786adc 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -25,7 +25,7 @@
 #endif
 
 #include <pyglib.h>
-#if HAVE_GIREPOSITORY_H
+#if HAVE_PYGI_H
 #   include <pygi.h>
 #endif
 #include "pygobject-private.h"
@@ -960,7 +960,7 @@ pygobject_new_full(GObject *obj, gboolean sink, gpointer g_class)
         if (inst_data)
             tp = inst_data->type;
         else {
-#if HAVE_GIREPOSITORY_H
+#if HAVE_PYGI_H
             GIRepository *repository;
             GType g_type;
             GIBaseInfo *info;
@@ -980,7 +980,7 @@ pygobject_new_full(GObject *obj, gboolean sink, gpointer g_class)
                 tp = pygobject_lookup_class(G_OBJECT_CLASS_TYPE(g_class));
             else
                 tp = pygobject_lookup_class(G_OBJECT_TYPE(obj));
-#if HAVE_GIREPOSITORY_H
+#if HAVE_PYGI_H
             }
 #endif
         }



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