[postgis] 01/01: Correct json-c usage (still for 2.1.2+dfsg-3)

Markus Wanner markus_wanner-guest at moszumanska.debian.org
Tue May 13 08:07:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

markus_wanner-guest pushed a commit to branch master
in repository postgis.

commit fc81ff1a0ee2f9046b62cd6d5e3c7e8293dff4e0
Author: Markus Wanner <markus at bluegap.ch>
Date:   Tue May 13 10:05:34 2014 +0200

    Correct json-c usage (still for 2.1.2+dfsg-3)
    
    Add a patch to tweak configure to not only detect, but set flags
    depending on which json c library variant is available. Adjust all
    users to be able to use either of the two.
    
    Move invocation of dh-autoreconf and dh_autotools-dev above the
    copying step for other Pg major versions.
---
 debian/changelog          |   7 ++-
 debian/patches/series     |   1 +
 debian/patches/use-json-c | 138 ++++++++++++++++++++++++++++++++++++++++++++++
 debian/rules              |   6 +-
 4 files changed, 148 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 047da5f..dfd3476 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,10 @@
 postgis (2.1.2+dfsg-3) unstable; urgency=low
 
-  * Also use dh-autoreconf to update libtool.m4. Closes: #744648.
-  * Update B-D on libjson-c-dev. Closes: #745010.
+  * Also use dh-autoreconf to update libtool.m4. Closes: #744648. Move
+    that and dh_autotools-dev above the copying step.
+  * Update B-D on libjson-c-dev. Add patch use-josn-c to not only detect,
+    but actually use the new directory for its include files.
+    Closes: #745010.
   * Allow translations of the debconf notice for postgis-2.0 deprecation.
   * Add a German translation.
   * Add a Russian translation by Yuri Kozlov. Closes: #744268.
diff --git a/debian/patches/series b/debian/patches/series
index 6209d3d..1a918b6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ honor-build-flags
 fix-armel
 fix-manpage
 de-translation
+use-json-c
diff --git a/debian/patches/use-json-c b/debian/patches/use-json-c
new file mode 100644
index 0000000..9b0d213
--- /dev/null
+++ b/debian/patches/use-json-c
@@ -0,0 +1,138 @@
+Description: Adjust to the rename of json to json-c
+ Tweak configure to not only detect json-c, but set different
+ variables in case the new variant is found. Adjust other files to
+ conditionally use the new variant.
+Forwarded: yes
+Bug-Upstream: http://trac.osgeo.org/postgis/ticket/2723
+Author: Markus Wanner <markus at bluegap.ch>
+Last-Update: 2013-05-12
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -113,9 +113,9 @@
+ dnl Check for platform-specific functions
+ dnl
+ AC_CHECK_FUNC(vasprintf, [HAVE_VASPRINTF=1], [HAVE_VASPRINTF=0])
+-AC_DEFINE([HAVE_VASPRINTF])
++AC_DEFINE_UNQUOTED([HAVE_VASPRINTF], [$HAVE_VASPRINTF], [vasprintf function])
+ AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0])
+-AC_DEFINE([HAVE_ASPRINTF])
++AC_DEFINE_UNQUOTED([HAVE_ASPRINTF], [$HAVE_ASPRINTF], [asprintf function])
+ AC_FUNC_FSEEKO()
+ 
+ dnl 
+@@ -751,6 +751,7 @@
+ 
+ CHECK_JSON=yes
+ HAVE_JSON=no
++HAVE_JSON_C=no
+ 
+ AC_ARG_WITH([json],
+ 	[AS_HELP_STRING([--without-json], [build without json-c support])],
+@@ -788,14 +789,14 @@
+ dnl Check that we can find the json/json.h header file
+ CPPFLAGS_SAVE="$CPPFLAGS"
+ CPPFLAGS="$JSON_CPPFLAGS"
+-AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON=yes], [
++AC_CHECK_HEADER([json-c/json.h], [HAVE_JSON_C=yes], [
+   AC_CHECK_HEADER([json/json.h], [HAVE_JSON=yes], [])])	
+ CPPFLAGS="$CPPFLAGS_SAVE"
+ 
+ dnl Ensure we can link against libjson
+ LIBS_SAVE="$LIBS"
+ LIBS="$JSON_LDFLAGS"
+-AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"], [
++AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON_C=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"], [
+   AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson"], [], [])
+ ], [])
+ LIBS="$LIBS_SAVE"
+@@ -804,9 +805,14 @@
+ 	AC_DEFINE([HAVE_LIBJSON], 1, [Define to 1 if libjson is present])
+ fi
+ 
++if test "$HAVE_JSON_C" = "yes"; then
++	AC_DEFINE([HAVE_LIBJSON_C], 1, [Define to 1 if libjson-c is present])
++fi
++
+ AC_SUBST([JSON_CPPFLAGS])
+ AC_SUBST([JSON_LDFLAGS])
+ AC_SUBST([HAVE_JSON])
++AC_SUBST([HAVE_JSON_C])
+ 
+ fi dnl }
+ 
+--- a/liblwgeom/lwin_geojson.c
++++ b/liblwgeom/lwin_geojson.c
+@@ -15,10 +15,15 @@
+ #include "lwgeom_log.h"
+ #include "../postgis_config.h"
+ 
+-#ifdef HAVE_LIBJSON
++#if defined(HAVE_LIBJSON_C) || defined(HAVE_LIBJSON)
+ 
++#if defined(HAVE_LIBJSON_C)
++#include <json-c/json.h>
++#include <json-c/json_object_private.h>
++#else
+ #include <json/json.h>
+ #include <json/json_object_private.h>
++#endif
+ #include <string.h>
+ 
+ static void geojson_lwerror(char *msg, int error_code)
+@@ -491,11 +496,11 @@
+ LWGEOM*
+ lwgeom_from_geojson(const char *geojson, char **srs)
+ {
+-#ifndef HAVE_LIBJSON
++#if !defined(HAVE_LIBJSON_C) && !defined(HAVE_LIBJSON)
+   *srs = NULL;
+ 	lwerror("You need JSON-C for lwgeom_from_geojson");
+ 	return NULL;
+-#else /* HAVE_LIBJSON  */
++#else /* HAVE_LIBJSON_C || HAVE_LIBJSON  */
+ 
+ 	/* size_t geojson_size = strlen(geojson); */
+ 
+@@ -549,7 +554,7 @@
+ 	}
+ 
+   return lwgeom;
+-#endif /* HAVE_LIBJSON  */
++#endif /* HAVE_LIBJSON_C || HAVE_LIBJSON  */
+ }
+ 
+ 
+--- a/liblwgeom/cunit/cu_tester.c
++++ b/liblwgeom/cunit/cu_tester.c
+@@ -87,7 +87,7 @@
+ 		surface_suite,
+ 		homogenize_suite,
+ 		force_sfs_suite,
+-#if HAVE_JSON
++#if defined(HAVE_JSON_C) || defined(HAVE_JSON)
+ 		in_geojson_suite,
+ #endif
+ 		out_gml_suite,
+--- a/regress/Makefile.in
++++ b/regress/Makefile.in
+@@ -19,6 +19,7 @@
+ POSTGIS_GEOS_VERSION=@POSTGIS_GEOS_VERSION@
+ POSTGIS_PROJ_VERSION=@POSTGIS_PROJ_VERSION@
+ HAVE_JSON=@HAVE_JSON@
++HAVE_JSON_C=@HAVE_JSON_C@
+ HAVE_SFCGAL=@HAVE_SFCGAL@
+ MINGWBUILD=@MINGWBUILD@
+ 
+--- a/postgis_config.h.in
++++ b/postgis_config.h.in
+@@ -53,6 +53,9 @@
+ /* Define to 1 if libjson is present */
+ #undef HAVE_LIBJSON
+ 
++/* Define to 1 if libjson-c is present */
++#undef HAVE_LIBJSON_C
++
+ /* Define to 1 if you have the `pq' library (-lpq). */
+ #undef HAVE_LIBPQ
+ 
diff --git a/debian/rules b/debian/rules
index 8d51598..e002109 100755
--- a/debian/rules
+++ b/debian/rules
@@ -147,6 +147,10 @@ configuration-stamp:
 	dh_testdir
 	dh_prep -s
 
+#	Run autoreconf *before* coying sources around.
+	dh_autoreconf autoconf
+	dh_autotools-dev_updateconfig
+
 #	Copy sources required to build extensions for all but the most
 #	recent Postgres version. Unfortunately, Postgis doesn't support
 #	vpath builds.
@@ -159,8 +163,6 @@ configuration-stamp:
 	done)
 
 #	PostGIS for the most recent PostgreSQL version
-	dh_autoreconf autoreconf2.13 -- -f
-	dh_autotools-dev_updateconfig
 	./configure $(COMMON_CONFIGURE_ARGS) \
 		--datadir=\$${prefix}/share/postgresql-$(NEWEST_POSTGRES_VERSION)-postgis \
 		--with-pgconfig=/usr/lib/postgresql/$(NEWEST_POSTGRES_VERSION)/bin/pg_config

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/postgis.git



More information about the Pkg-grass-devel mailing list