mirror of https://github.com/GNOME/gimp.git
configure, libgimpbase, m4macros: first steps into API introspection.
So far only libgimpbase is introspected. It just works though (I could test that I could just run a plug-in which could access libgimpbase API without any problem). The g-ir-scanner call outputs a lot of warning but I won't care for these right now. The `introspection.m4` is taken straight from GEGL tree.
This commit is contained in:
parent
fe75ef28ad
commit
0c75cd7fc4
15
configure.ac
15
configure.ac
|
@ -23,7 +23,10 @@ m4_define([gimp_binary_age],
|
|||
# m4_define([gimp_version], [2.99.1])
|
||||
|
||||
# This is the X.Y used in -lgimp-X.Y
|
||||
m4_define([gimp_api_version], [3.0])
|
||||
m4_define([gimp_api_major_version], [3])
|
||||
m4_define([gimp_api_minor_version], [0])
|
||||
m4_define([gimp_api_version],
|
||||
[gimp_api_major_version.gimp_api_minor_version])
|
||||
|
||||
# Versions used for apps, plugins, tools, pkg-config files, and data,
|
||||
# as well as global and user prefs
|
||||
|
@ -63,6 +66,7 @@ m4_define([gtk_required_version], [3.22.29])
|
|||
m4_define([gtkdoc_required_version], [1.0])
|
||||
m4_define([harfbuzz_required_version], [0.9.19])
|
||||
m4_define([intltool_required_version], [0.40.1])
|
||||
m4_define([introspection_required_version], [1.32.0])
|
||||
m4_define([lcms_required_version], [2.8])
|
||||
m4_define([libgudev_required_version], [167])
|
||||
m4_define([libheif_required_version], [1.3.2])
|
||||
|
@ -110,6 +114,8 @@ GIMP_INTERFACE_AGE=gimp_interface_age
|
|||
GIMP_BINARY_AGE=gimp_binary_age
|
||||
GIMP_VERSION=gimp_version
|
||||
GIMP_REAL_VERSION=gimp_real_version
|
||||
GIMP_API_MAJOR_VERSION=gimp_api_major_version
|
||||
GIMP_API_MINOR_VERSION=gimp_api_minor_version
|
||||
GIMP_API_VERSION=gimp_api_version
|
||||
GIMP_APP_VERSION=gimp_app_version
|
||||
GIMP_PLUGIN_VERSION=gimp_plugin_version
|
||||
|
@ -127,6 +133,8 @@ AC_SUBST(GIMP_INTERFACE_AGE)
|
|||
AC_SUBST(GIMP_BINARY_AGE)
|
||||
AC_SUBST(GIMP_VERSION)
|
||||
AC_SUBST(GIMP_REAL_VERSION)
|
||||
AC_SUBST(GIMP_API_MAJOR_VERSION)
|
||||
AC_SUBST(GIMP_API_MINOR_VERSION)
|
||||
AC_SUBST(GIMP_API_VERSION)
|
||||
AC_SUBST(GIMP_APP_VERSION)
|
||||
AC_SUBST(GIMP_PLUGIN_VERSION)
|
||||
|
@ -2225,6 +2233,11 @@ AC_ARG_WITH(pdbgen,
|
|||
|
||||
AM_CONDITIONAL(WITH_PDBGEN, test "x$with_pdbgen" = xyes)
|
||||
|
||||
#################################
|
||||
# Check for GObject Introspection
|
||||
#################################
|
||||
|
||||
GOBJECT_INTROSPECTION_CHECK(introspection_required_version)
|
||||
|
||||
##################
|
||||
# Check for python
|
||||
|
|
|
@ -91,7 +91,7 @@ lib_LTLIBRARIES = libgimpbase-@GIMP_API_VERSION@.la
|
|||
@:
|
||||
|
||||
|
||||
libgimpbase_sources = \
|
||||
libgimpbase_introspectable = \
|
||||
gimpbase.h \
|
||||
gimpbaseenums.h \
|
||||
gimpcompatenums.h \
|
||||
|
@ -131,10 +131,13 @@ libgimpbase_sources = \
|
|||
gimputils.h \
|
||||
gimpvaluearray.c \
|
||||
gimpvaluearray.h \
|
||||
gimpwin32-io.h \
|
||||
gimpwire.c \
|
||||
gimpwire.h
|
||||
|
||||
libgimpbase_sources = \
|
||||
gimpwin32-io.h \
|
||||
$(libgimpbase_introspectable)
|
||||
|
||||
libgimpbase_built_sources = \
|
||||
gimpbaseenums.c \
|
||||
gimpcompatenums.c
|
||||
|
@ -259,3 +262,26 @@ $(srcdir)/gimpcompatenums.c: xgen-cec
|
|||
fi
|
||||
|
||||
DISTCLEANFILES = gimpversion.h
|
||||
|
||||
### GObject introspection
|
||||
|
||||
-include $(INTROSPECTION_MAKEFILE)
|
||||
INTROSPECTION_GIRS =
|
||||
INTROSPECTION_SCANNER_ARGS = --warn-all --add-include-path="$(srcdir)" --add-include-path="$(shell $(PKG_CONFIG) --define-variable=datadir="$(datadir)" --variable=girdir gobject-introspection-1.0)"
|
||||
INTROSPECTION_COMPILER_ARGS = --includedir="$(srcdir)" --includedir="$(shell $(PKG_CONFIG) --define-variable=datadir="$(datadir)" --variable=girdir gobject-introspection-1.0)"
|
||||
INTROSPECTION_SCANNER_ENV = CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)"
|
||||
|
||||
Gimp-@GIMP_API_VERSION@.gir: libgimpbase-@GIMP_API_VERSION@.la Makefile
|
||||
Gimp_@GIMP_API_MAJOR_VERSION@_@GIMP_API_MINOR_VERSION@_gir_INCLUDES = GObject-2.0 GLib-2.0
|
||||
Gimp_@GIMP_API_MAJOR_VERSION@_@GIMP_API_MINOR_VERSION@_gir_CFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -I$(top_builddir) -I$(top_srcdir)
|
||||
Gimp_@GIMP_API_MAJOR_VERSION@_@GIMP_API_MINOR_VERSION@_gir_LIBS = libgimpbase-@GIMP_API_VERSION@.la
|
||||
Gimp_@GIMP_API_MAJOR_VERSION@_@GIMP_API_MINOR_VERSION@_gir_FILES = $(libgimpbase_introspectable)
|
||||
INTROSPECTION_GIRS += Gimp-@GIMP_API_VERSION@.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)
|
||||
|
|
|
@ -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])
|
||||
])
|
Loading…
Reference in New Issue