Commit a3ad67db authored by Philip Withnall's avatar Philip Withnall
Browse files

Add GObject introspection support

Add basic GObject introspection support for the library. None of the GIR file
has been checked, and no annotations have been added yet.
parent f696772d
......@@ -11,7 +11,8 @@ EXTRA_DIST = \
HACKING \
gtk-doc.make \
libgdata.pc.in \
libgdata.doap
libgdata.doap \
introspection.m4
CLEANFILES = gdata.pc
......
......@@ -78,6 +78,8 @@ GNOME_COMPILE_WARNINGS([maximum])
GNOME_CXX_WARNINGS
GNOME_MAINTAINER_MODE_DEFINES
GOBJECT_INTROSPECTION_CHECK([0.6.3])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
......
......@@ -120,4 +120,36 @@ EXTRA_DIST = \
gdata.symbols \
gdata-marshal.list
# Introspection
if HAVE_INTROSPECTION
GData-$(GDATA_VERSION_MAJOR).$(GDATA_VERSION_MINOR).gir: $(INTROSPECTION_SCANNER) libgdata.la
$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
--namespace GData --nsversion=$(GDATA_VERSION_MAJOR).$(GDATA_VERSION_MINOR) \
--strip-prefix=GData --add-include-path=$(srcdir) --add-include=path=. \
--c-include="gdata/gdata.h" --include=libxml2-2.0 --include=Soup-2.4 \
--library=gdata --output $@ --pkg gobject-2.0 \
-I$(top_srcdir) \
-I$(top_srcdir)/gdata \
`find -name "*.[ch]" | grep -vE ".*/gdata-(youtube-control|media-group|youtube-group|georss-where|exif-tags)\.[ch]"`
# The files listed above are excluded because they're currently private
BUILT_GIRSOURCES = GData-$(GDATA_VERSION_MAJOR).$(GDATA_VERSION_MINOR).gir
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
%.typelib: %.gir $(INTROSPECTION_COMPILER)
$(QUIET_GEN)$(DEBUG) $(INTROSPECTION_COMPILER) \
--includedir=$(srcdir) --includedir=. \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(builddir)/$(@F)
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif
-include $(top_srcdir)/git.mk
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)"
fi
AC_SUBST(INTROSPECTION_SCANNER)
AC_SUBST(INTROSPECTION_COMPILER)
AC_SUBST(INTROSPECTION_GENERATE)
AC_SUBST(INTROSPECTION_GIRDIR)
AC_SUBST(INTROSPECTION_TYPELIBDIR)
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])
])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment