From 036f9985d243bb309e80afd97affcb1dafd16db6 Mon Sep 17 00:00:00 2001 From: Evan Nemerson Date: Sun, 29 Jan 2012 23:26:20 -0800 Subject: [PATCH] glib: add Vala bindings Fixes bug 45204. --- configure.ac | 3 + glib/.gitignore | 1 + glib/Makefile.am | 17 ++++++++ glib/Poppler-0.18.metadata | 12 ++++++ glib/poppler-glib.deps | 1 + m4/vapigen.m4 | 88 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 122 insertions(+), 0 deletions(-) create mode 100644 glib/Poppler-0.18.metadata create mode 100644 glib/poppler-glib.deps create mode 100644 m4/vapigen.m4 diff --git a/configure.ac b/configure.ac index 5b1d04a..2e5d6cf 100644 --- a/configure.ac +++ b/configure.ac @@ -445,6 +445,8 @@ if test x$enable_cairo_output = xyes; then if test x$enable_poppler_glib = xyes; then # Check for introspection GOBJECT_INTROSPECTION_CHECK([0.6.7]) + # Check for vapigen + VAPIGEN_CHECK() AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums]) POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED" @@ -659,6 +661,7 @@ echo " cairo output: $use_cairo" echo " qt4 wrapper: $enable_poppler_qt4" echo " glib wrapper: $use_glib" echo " introspection: $found_introspection" +echo " vala: $enable_vala" echo " cpp wrapper: $enable_poppler_cpp" echo " use gtk-doc: $enable_gtk_doc" echo " use libjpeg: $enable_libjpeg" diff --git a/glib/.gitignore b/glib/.gitignore index a22390b..3390425 100644 --- a/glib/.gitignore +++ b/glib/.gitignore @@ -7,5 +7,6 @@ Makefile.in poppler-enums.c poppler-enums.h poppler-features.h +poppler-glib.vapi stamp-* test-poppler-glib diff --git a/glib/Makefile.am b/glib/Makefile.am index 54e4085..646822d 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -109,4 +109,21 @@ typelibsdir = $(libdir)/girepository-1.0 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA) + +if ENABLE_VAPIGEN +-include $(VAPIGEN_MAKEFILE) + +VAPIGEN_VAPIS = poppler-glib.vapi + +poppler-glib.vapi: Poppler-0.18.gir Poppler-0.18.metadata +poppler_glib_vapi_FILES = Poppler-0.18.gir +poppler_glib_vapi_DEPS = cairo +poppler_glib_vapi_METADATADIRS = $(srcdir) + +vapidir = $(VAPIGEN_VAPIDIR) +vapi_DATA = $(VAPIGEN_VAPIS) poppler-glib.deps + +EXTRA_DIST += Poppler-0.18.metadata poppler-glib.deps +CLEANFILES += $(VAPIGEN_VAPIS) +endif #ENABLE_VAPIGEN endif #HAVE_INTROSPECTION diff --git a/glib/Poppler-0.18.metadata b/glib/Poppler-0.18.metadata new file mode 100644 index 0000000..f7e8e0d --- /dev/null +++ b/glib/Poppler-0.18.metadata @@ -0,0 +1,12 @@ +Page + .get_image type="Cairo.Surface" + .get_selected_region type="Cairo.Region" + .get_thumbnail type="Cairo.Surface" + .render*.cairo type="Cairo.Context" + +Rectangle struct + +*.*#field unowned=false +ActionLayer.layers unowned + +ANNOT_TEXT_ICON_* parent="Poppler.AnnotTextIcon" name="ANNOT_TEXT_ICON_(.+)" diff --git a/glib/poppler-glib.deps b/glib/poppler-glib.deps new file mode 100644 index 0000000..129fe16 --- /dev/null +++ b/glib/poppler-glib.deps @@ -0,0 +1 @@ +cairo diff --git a/m4/vapigen.m4 b/m4/vapigen.m4 new file mode 100644 index 0000000..4805107 --- /dev/null +++ b/m4/vapigen.m4 @@ -0,0 +1,88 @@ +dnl vala.m4 +dnl +dnl Copyright 2012 Evan Nemerson +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION]) +# -------------------------------------- +# Check that vapigen existence and version +# +# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation +AC_DEFUN([VAPIGEN_CHECK], +[ + AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0]) + AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0]) + + AC_ARG_ENABLE([vala], + AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]], + [build Vala bindings [[default=auto]]]),, + [enable_vala=auto]) + + AS_CASE([$enable_vala], [no], [], + [yes], [ + AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ + AC_MSG_ERROR([Vala bindings require GObject Introspection]) + ]) + ], [auto], [ + AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ + enable_vala=no + ]) + ], [ + AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@]) + ]) + + AS_IF([test "x$2" = "x"], [ + vapigen_pkg_name=vapigen + ], [ + vapigen_pkg_name=vapigen-$2 + ]) + AS_IF([test "x$1" = "x"], [ + vapigen_pkg="$vapigen_pkg_name" + ], [ + vapigen_pkg="$vapigen_pkg_name >= $1" + ]) + + PKG_PROG_PKG_CONFIG + + PKG_CHECK_EXISTS([$vapigen_pkg], [ + AS_IF([test "$enable_vala" = "auto"], [ + enable_vala=yes + ]) + ], [ + AS_CASE([$enable_vala], [yes], [ + AC_MSG_ERROR([$vapigen_pkg not found]) + ], [auto], [ + enable_vala=no + ]) + ]) + + AS_CASE([$enable_vala], + [yes], [ + VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen` + VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen + AS_IF([test "x$2" = "x"], [ + VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen` + ], [ + VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen` + ]) + ]) + + AC_SUBST([VAPIGEN]) + AC_SUBST([VAPIGEN_VAPIDIR]) + AC_SUBST([VAPIGEN_MAKEFILE]) + + AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes") +]) -- 1.7.7.6