From 026945dc4b97aaf2a4b641b4a693c9b07f9d13c3 Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sat, 25 Mar 2017 11:58:24 +0300 Subject: [PATCH] Add support for GOBJECT-INTROSPECTION GOjbect Introspection allows various other languages to automatically generate bindings they can use. For details see: https://wiki.gnome.org/action/show/Projects/GObjectIntrospection To support this, we need to add a gobject and introspection dependency. The introspection one is optional and it is what determines if the libxfce4ui-2 gir is created. Only libxfce4ui-2 is created (the Gtk3 version) as it makes little sense to support new applications in Gtk2. --- .gitignore | 3 ++ Makefile.am | 6 ++-- configure.ac.in | 5 +++ libxfce4ui/Makefile.am | 38 ++++++++++++++++++++ m4/introspection.m4 | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 m4/introspection.m4 diff --git a/.gitignore b/.gitignore index 6c46ac5..7474569 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ docs/xml/ *.la *.lo *.stamp +tests/*.o libxfce4kbd-private/xfce-shortcuts-marshal.c libxfce4kbd-private/xfce-shortcuts-marshal.h libxfce4ui/libxfce4ui-alias.h @@ -64,6 +65,8 @@ libxfce4ui/libxfce4ui-marshal.c libxfce4ui/libxfce4ui-marshal.h libxfce4ui/stamp-libxfce4ui-enum-types.h libxfce4ui/stamp-libxfce4ui-marshal.h +libxfce4ui/libxfce4ui-2.gir +libxfce4ui/libxfce4ui-2.typelib xfce4-about/about-dialog-ui.h xfce4-about/xfce4-about xfce4-about/xfce4-about.desktop diff --git a/Makefile.am b/Makefile.am index ea8a250..556ec20 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + SUBDIRS = \ libxfce4ui \ libxfce4kbd-private \ @@ -10,7 +11,7 @@ SUBDIRS = \ po \ tests -distuninstallcheck_listfiles = \ +distuninstallcheck_listfiles = \ find . -type f -print | grep -v ./share/icons/hicolor/icon-theme.cache distclean-local: @@ -37,6 +38,7 @@ DISTCLEANFILES = \ DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ - --disable-gladeui + --disable-gladeui \ + --enable-introspection # vi:set ts=8 sw=8 noet ai nocindent syntax=automake: diff --git a/configure.ac.in b/configure.ac.in index c119ec8..1da63c3 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -137,6 +137,11 @@ XDT_CHECK_OPTIONAL_PACKAGE([GTK3], [GTK+ 3 support]) AM_CONDITIONAL([ENABLE_GTK3_LIBRARY], [test "x$GTK3_FOUND" = "xyes"]) +dnl *************************************** +dnl *** Check for gobject-introspection *** +dnl *************************************** +GOBJECT_INTROSPECTION_CHECK([1.30.0]) + dnl ************************************************* dnl *** Optional support for startup notification *** dnl ************************************************* diff --git a/libxfce4ui/Makefile.am b/libxfce4ui/Makefile.am index 82bfca6..15a122e 100644 --- a/libxfce4ui/Makefile.am +++ b/libxfce4ui/Makefile.am @@ -190,9 +190,47 @@ libxfce4ui-enum-types.c: $(libxfce4ui_enum_headers) Makefile if ENABLE_GTK3_LIBRARY libxfce4ui-dialog-ui.h: libxfce4ui-dialog-ui.ui $(AM_V_GEN) exo-csource --static --strip-comments --strip-content --name=xfce4ui_dialog_ui $< >$@ + +include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ENV = CC="$(CC)" +INTROSPECTION_SCANNER_ARGS = \ + --add-include-path=$(srcdir) \ + --warn-all \ + --identifier-prefix=xfce \ + --identifier-prefix=Xfce \ + --identifier-prefix=libxfce +INTROSPECTION_COMPILER_ARGS = \ + --includedir=$(srcdir) \ + --includedir=. + +if HAVE_INTROSPECTION +introspection_sources = $(filter-out %private.h %.c, $(libxfce4ui_2_la_SOURCES)) + +libxfce4ui-2.gir: libxfce4ui-2.la Makefile +libxfce4ui_2_gir_INCLUDES = GObject-2.0 GLib-2.0 Gtk-3.0 libxfce4util-1.0 +libxfce4ui_2_gir_CFLAGS = $(AM_CPPFLAGS) +libxfce4ui_2_gir_LIBS = libxfce4ui-2.la +libxfce4ui_2_gir_FILES = $(introspection_sources) +libxfce4ui_2_gir_EXPORT_PACKAGES = libxfce4ui-2 +INTROSPECTION_GIRS += libxfce4ui-2.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 +# endif HAVE_INTROSPECTION + endif +# endif ENABLE_GTK3_LIBRARY endif +# endif MAINTAINER_MODE + # required for gtk-doc dist-hook: all diff --git a/m4/introspection.m4 b/m4/introspection.m4 new file mode 100644 index 0000000..aa7b3b4 --- /dev/null +++ b/m4/introspection.m4 @@ -0,0 +1,96 @@ +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 Canonicalize enable_introspection + enable_introspection=$found_introspection + ],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]) +]) -- 2.11.0