[tracker/introspection: 9/19] libtracker-sparql: Dirty 'sed' only when really needed
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/introspection: 9/19] libtracker-sparql: Dirty 'sed' only when really needed
- Date: Tue, 5 Apr 2011 11:31:08 +0000 (UTC)
commit d6600a459887e901d24a2724c9693471b2705932
Author: Ivan Frade <ivan frade nokia com>
Date: Fri Mar 25 10:55:35 2011 +0200
libtracker-sparql: Dirty 'sed' only when really needed
If vala is recent enough, the "sed" operation is not needed.
Also, run the sed trick only once on the file.
Vala version is checked via new m4 function.
Removed the .gir from the CLEANFILES. It must be cleaned only when
the library it comes from is cleaned.
configure.ac | 3 +++
m4/vala-extra.m4 | 26 ++++++++++++++++++++++++++
src/libtracker-sparql/Makefile.am | 15 +++++++++++----
3 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 910dc1c..164ac14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -472,6 +472,9 @@ fi
AC_SUBST(VALAC)
+AX_VALA_CHECK_VERSION([0.11.8], vala_good_gir=true, vala_good_gir=false)
+AM_CONDITIONAL(VALA_GOOD_GIR, test "x$vala_good_gir" == "xtrue")
+
####################################################################
# Check gettext/intltool support
####################################################################
diff --git a/m4/vala-extra.m4 b/m4/vala-extra.m4
new file mode 100644
index 0000000..0851ebc
--- /dev/null
+++ b/m4/vala-extra.m4
@@ -0,0 +1,26 @@
+dnl Copyright (C) 2011 Nokia <ivan frade nokia com>
+dnl This file is free software; unlimited permission to copy and/or distribute
+dnl it is given, with or without modifications, as long as this notice is
+dnl preserved.
+
+dnl AX_VALA_CHECK_VERSION([MIN_VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl ---------------------------------------------------------------------------
+dnl Run ACTION-IF-TRUE if the vala compiler is installed AND has version >= VERSION.
+dnl Run ACTION-IF-FALSE otherwise.
+
+dnl This macro doesn't check if valac is installed (use AM_PROG_VALAC or your
+dnl own AC_PATH_PROG to check that)
+
+AC_DEFUN([AX_VALA_CHECK_VERSION],
+[
+ AC_MSG_CHECKING([valac generates proper GIR])
+ AS_IF([test "x$VALAC" != "x"], [], [AC_PATH_PROG([VALAC], [valac], [])])
+ am__vala_version=`$VALAC --version | sed 's/Vala *//'`
+ AS_VERSION_COMPARE([$1], ["$am__vala_version"],
+ [AC_MSG_RESULT([yes])
+ $2],
+ [AC_MSG_RESULT([yes])
+ $2],
+ [AC_MSG_RESULT([no])
+ $3])
+])
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 4b4c329..778363f 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -61,9 +61,16 @@ EXTRA_DIST = \
-include $(INTROSPECTION_MAKEFILE)
if HAVE_INTROSPECTION
-# set introspectable=0 to the function that uses va_list. This is not needed with a modern vala ( > 23/03/2011)
+
+# set introspectable=0 to the function that uses va_list. This is not needed with a modern vala ( >= 0.11.8)
+if VALA_GOOD_GIR
+Tracker- TRACKER_API_VERSION@.gir: $(lib_LTLIBRARIES) Makefile
+else
Tracker- TRACKER_API_VERSION@.gir: $(lib_LTLIBRARIES) Makefile
- sed -i $@ -e "s/c\:identifier\=\"tracker_sparql_escape_uri_vprintf\"/c\:identifier\=\"tracker_sparql_escape_uri_vprintf\"\ introspectable=\"0\"/g"
+ if [[ -z `grep tracker_sparql_escape_uri_vprintf $@ |grep introspectable` ]] ; then \
+ sed -i $@ -e "s/c\:identifier\=\"tracker_sparql_escape_uri_vprintf\"/c\:identifier\=\"tracker_sparql_escape_uri_vprintf\"\ introspectable=\"0\"/g" ; \
+ fi
+endif
Tracker- TRACKER_API_VERSION@.typelib: Tracker-$(TRACKER_API_VERSION).gir
@INTROSPECTION_COMPILER@ --shared-library=libtracker-sparql- TRACKER_API_VERSION@.so -o $@ $^
@@ -74,5 +81,5 @@ dist_gir_DATA = Tracker-$(TRACKER_API_VERSION).gir
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = Tracker-$(TRACKER_API_VERSION).typelib
-CLEANFILES = $(dist_gir_DATA) $(typelib_DATA)
-endif
+CLEANFILES = $(typelib_DATA)
+endif
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]