[gtkglext] add gobject-introspection support



commit a9d7fc524273e419f4639826f2bb39f1cff2655f
Author: Anton Gorenko <ex rzrjck gmail com>
Date:   Thu Sep 30 22:09:13 2010 +0600

    add gobject-introspection support
    
    (cherry picked from commit 8ba11ba74fbdf00fc2a719db175e054f4c96354c)
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>

 Makefile.am               |    5 +-
 configure.ac              |    8 +++-
 gdk/Makefile.am           |   49 +++++++++++++++++++++++
 gtk/Makefile.am           |   37 ++++++++++++++++++
 m4macros/introspection.m4 |   94 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 190 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index cba483b..7f16ddd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@
 SUBDIRS = gdk gtk docs examples
 
 ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
 
 EXTRA_DIST = \
        README.win32                    \
@@ -16,7 +16,8 @@ EXTRA_DIST = \
        gtkglext-uninstalled.pc.in      \
        gtkglext.nsi.in                 \
        gtkglext.nsi                    \
-       setup-gtkglext.sh
+       setup-gtkglext.sh               \
+       m4macros/introspection.m4
 
 ## Copy .pc files to target-specific names
 GDK_TARGET = @gdktarget@
diff --git a/configure.ac b/configure.ac
index 5b73aa8..936f585 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_CONFIG_MACRO_DIR([m4macros])
 cflags_set=${CFLAGS+set}
 
 # Initialize automake stuff
-AM_INIT_AUTOMAKE([1.11 no-define dist-bzip2 dist-zip dist-xz])
+AM_INIT_AUTOMAKE([1.11 no-define -Wno-portability dist-bzip2 dist-zip dist-xz])
 
 # Support silent build rules, requires at least automake-1.11. Enable
 # by either passing --enable-silent-rules to configure or passing V=0
@@ -120,6 +120,12 @@ AC_PROG_LN_S
 AC_PATH_PROGS([PERL], [perl5 perl])
 
 ##################################################
+# GObject introspection
+##################################################
+
+GOBJECT_INTROSPECTION_CHECK([0.9.3])
+
+##################################################
 # Checks for gtk-doc and docbook-tools
 ##################################################
 
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 108387f..7260532 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -4,6 +4,8 @@
 SUBDIRS = $(gdktarget)
 DIST_SUBDIRS = x11 win32 quartz
 
+CLEANFILES =
+
 EXTRA_DIST = \
        gdkglversion.h.in       \
        gdkglext.def
@@ -199,5 +201,52 @@ gdkglextglextincludedir = $(includedir)/gtkglext- GTKGLEXT_API_VERSION@/gdk/glex
 gdkglextglextinclude_HEADERS = $(gdkglext_glext_public_h_sources)
 
 #
+# Introspection
+#
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS =
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = \
+       $(filter-out gdkgldebug.h gdkglglext.h, $(gdkglext_headers)) \
+       $(gdkglext_c_sources) \
+       $(gdkglext_built_c_sources)
+
+if USE_X11
+introspection_sources += \
+       x11/gdkglconfig-x11.c   \
+       x11/gdkglcontext-x11.c  \
+       x11/gdkgldrawable-x11.c \
+       x11/gdkgloverlay-x11.c  \
+       x11/gdkglpixmap-x11.c   \
+       x11/gdkglquery-x11.c    \
+       x11/gdkglwindow-x11.c
+endif # USE_X11
+
+GdkGLExt-1.0.gir: $(gdkglext_targetlib)
+GdkGLExt_1_0_gir_INCLUDES = Gdk-3.0
+GdkGLExt_1_0_gir_SCANNERFLAGS = \
+       --warn-all \
+       --identifier-prefix=GdkGL \
+       --symbol-prefix=gdk_gl \
+       --symbol-prefix=gdk
+GdkGLExt_1_0_gir_CFLAGS = $(common_includes)
+GdkGLExt_1_0_gir_LIBS = $(gdkglext_targetlib)
+GdkGLExt_1_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += GdkGLExt-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif # HAVE_INTROSPECTION
+
+#
 # Extra rules
 #
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 99e2592..5c85b0b 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1,6 +1,8 @@
 ## -*- Makefile -*-
 ## Makefile.am for gtkglext/gtk
 
+CLEANFILES =
+
 EXTRA_DIST = \
        gtkglversion.h.in       \
        gtkglext.def
@@ -98,3 +100,38 @@ libgtkglext_win32_ API_MJ@_ API_MI@_la_SOURCES = $(gtkglext_sources)
 libgtkglext_win32_ API_MJ@_ API_MI@_la_LDFLAGS = $(common_ldflags)
 libgtkglext_win32_ API_MJ@_ API_MI@_la_LIBADD = $(common_libadd)
 libgtkglext_win32_ API_MJ@_ API_MI@_la_DEPENDENCIES = $(gtkglext_def)
+
+#
+# Introspection
+#
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=../gdk
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --includedir=../gdk
+
+if HAVE_INTROSPECTION
+introspection_sources = \
+       $(gtkglext_public_h_sources) \
+       $(gtkglext_c_sources)
+
+GtkGLExt-1.0.gir: $(gtkglext_targetlib)
+GtkGLExt_1_0_gir_INCLUDES = Gtk-3.0 GdkGLExt-1.0
+GtkGLExt_1_0_gir_SCANNERFLAGS = \
+       --warn-all \
+       --identifier-prefix=GtkGL \
+       --symbol-prefix=gtk_gl \
+       --symbol-prefix=gtk
+GtkGLExt_1_0_gir_CFLAGS = $(common_includes)
+GtkGLExt_1_0_gir_LIBS = $(gtkglext_targetlib)
+GtkGLExt_1_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += GtkGLExt-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif # HAVE_INTROSPECTION
diff --git a/m4macros/introspection.m4 b/m4macros/introspection.m4
new file mode 100644
index 0000000..589721c
--- /dev/null
+++ b/m4macros/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])
+])


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