Add patch to cleanly build against json-c v0.13

This commit is contained in:
Björn Esser 2017-12-11 18:18:26 +01:00
parent 414718a173
commit 44c89eba51
No known key found for this signature in database
GPG Key ID: F52E98007594C21D
8 changed files with 189 additions and 46 deletions

View File

@ -1,7 +1,8 @@
diff -Nur gdal-1.9.0-fedora/swig/java/java.opt gdal-1.9.0-fedora-java/swig/java/java.opt
--- gdal-1.9.0-fedora/swig/java/java.opt 2012-01-04 08:03:40.000000000 +0100
+++ gdal-1.9.0-fedora-java/swig/java/java.opt 2012-02-03 08:44:55.837978697 +0100
@@ -5,6 +5,6 @@
Index: gdal-2.2.3-fedora/swig/java/java.opt
===================================================================
--- gdal-2.2.3-fedora.orig/swig/java/java.opt
+++ gdal-2.2.3-fedora/swig/java/java.opt
@@ -7,6 +7,6 @@ JAVADOC=$(JAVA_HOME)/bin/javadoc
JAVAC=$(JAVA_HOME)/bin/javac
JAVA=$(JAVA_HOME)/bin/java
JAR=$(JAVA_HOME)/bin/jar

View File

@ -1,7 +1,7 @@
diff --git a/frmts/mrf/mrf_band.cpp b/frmts/mrf/mrf_band.cpp
index c904aa4..cf981da 100644
--- a/frmts/mrf/mrf_band.cpp
+++ b/frmts/mrf/mrf_band.cpp
Index: gdal-2.2.3-fedora/frmts/mrf/mrf_band.cpp
===================================================================
--- gdal-2.2.3-fedora.orig/frmts/mrf/mrf_band.cpp
+++ gdal-2.2.3-fedora/frmts/mrf/mrf_band.cpp
@@ -49,7 +49,7 @@
#include <vector>

View File

@ -1,7 +1,7 @@
diff --git a/swig/python/setup.py b/swig/python/setup.py
index 6fac6f9..b6aa52e 100644
--- a/swig/python/setup.py
+++ b/swig/python/setup.py
Index: gdal-2.2.3-fedora/swig/python/setup.py
===================================================================
--- gdal-2.2.3-fedora.orig/swig/python/setup.py
+++ gdal-2.2.3-fedora/swig/python/setup.py
@@ -7,7 +7,7 @@
# Howard Butler hobu.inc@gmail.com

131
gdal-2.2.3_json-c_013.patch Normal file
View File

@ -0,0 +1,131 @@
commit 7cab3c2049907fb0be76784c796143fb22dcafea
Author: Björn Esser <besser82@fedoraproject.org>
Date: Mon Dec 11 17:01:20 2017 +0100
geojson: Adaptions for json-c v0.13
Index: gdal-2.2.3-fedora/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp
===================================================================
--- gdal-2.2.3-fedora.orig/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp
+++ gdal-2.2.3-fedora/ogr/ogrsf_frmts/geojson/ogrgeojsonwriter.cpp
@@ -27,12 +27,18 @@
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
+#define JSON_C_VER_013 (13 << 8)
+
#include "ogrgeojsonwriter.h"
#include "ogrgeojsonutils.h"
#include "ogr_geojson.h"
#include "ogrgeojsonreader.h"
#include <json.h> // JSON-C
+
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
#include <json_object_private.h>
+#endif
+
#include <printbuf.h>
#include <ogr_api.h>
#include <ogr_p.h>
@@ -1381,13 +1387,26 @@ static int OGR_json_double_with_precisio
{
// TODO(schwehr): Explain this casting.
const int nPrecision =
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
static_cast<int>(reinterpret_cast<GUIntptr_t>(jso->_userdata));
+#else
+ static_cast<int>(reinterpret_cast<GUIntptr_t>(json_object_get_userdata(jso)));
+#endif
char szBuffer[75] = {};
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
OGRFormatDouble( szBuffer, sizeof(szBuffer), jso->o.c_double, '.',
(nPrecision < 0) ? 15 : nPrecision );
+#else
+ OGRFormatDouble( szBuffer, sizeof(szBuffer), json_object_get_double(jso), '.',
+ (nPrecision < 0) ? 15 : nPrecision );
+#endif
if( szBuffer[0] == 't' /*oobig */ )
{
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
CPLsnprintf(szBuffer, sizeof(szBuffer), "%.18g", jso->o.c_double);
+#else
+ CPLsnprintf(szBuffer, sizeof(szBuffer), "%.18g", json_object_get_double(jso));
+#endif
}
return printbuf_memappend(pb, szBuffer, static_cast<int>(strlen(szBuffer)));
}
@@ -1417,11 +1436,23 @@ OGR_json_double_with_significant_figures
{
char szBuffer[75] = {};
int nSize = 0;
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
if( CPLIsNan(jso->o.c_double))
+#else
+ if( CPLIsNan(json_object_get_double(jso)))
+#endif
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer), "NaN");
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
else if( CPLIsInf(jso->o.c_double) )
+#else
+ else if( CPLIsInf(json_object_get_double(jso)) )
+#endif
{
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
if( jso->o.c_double > 0 )
+#else
+ if( json_object_get_double(jso) > 0 )
+#endif
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer), "Infinity");
else
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer), "-Infinity");
@@ -1429,13 +1460,22 @@ OGR_json_double_with_significant_figures
else
{
char szFormatting[32] = {};
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
const int nSignificantFigures = (int) (GUIntptr_t) jso->_userdata;
+#else
+ const int nSignificantFigures = (int) (GUIntptr_t) json_object_get_userdata(jso);
+#endif
const int nInitialSignificantFigures =
nSignificantFigures >= 0 ? nSignificantFigures : 17;
CPLsnprintf(szFormatting, sizeof(szFormatting),
"%%.%dg", nInitialSignificantFigures);
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
szFormatting, jso->o.c_double);
+#else
+ nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
+ szFormatting, json_object_get_double(jso));
+#endif
const char* pszDot = NULL;
if( nSize+2 < static_cast<int>(sizeof(szBuffer)) &&
(pszDot = strchr(szBuffer, '.')) == NULL )
@@ -1456,8 +1496,13 @@ OGR_json_double_with_significant_figures
{
CPLsnprintf(szFormatting, sizeof(szFormatting),
"%%.%dg", nInitialSignificantFigures- i);
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
szFormatting, jso->o.c_double);
+#else
+ nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
+ szFormatting, json_object_get_double(jso));
+#endif
pszDot = strchr(szBuffer, '.');
if( pszDot != NULL &&
strstr(pszDot, "999999") == NULL &&
@@ -1471,8 +1516,13 @@ OGR_json_double_with_significant_figures
{
CPLsnprintf(szFormatting, sizeof(szFormatting),
"%%.%dg", nInitialSignificantFigures);
+#if (!defined(JSON_C_VERSION_NUM)) || (JSON_C_VERSION_NUM < JSON_C_VER_013)
nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
szFormatting, jso->o.c_double);
+#else
+ nSize = CPLsnprintf(szBuffer, sizeof(szBuffer),
+ szFormatting, json_object_get_double(jso));
+#endif
if( nSize+2 < static_cast<int>(sizeof(szBuffer)) &&
strchr(szBuffer, '.') == NULL )
{

View File

@ -1,6 +1,7 @@
diff -up gdal-2.1.1-fedora/scripts/GNUmakefile.completion gdal-2.1.1-fedora/scripts/GNUmakefile
--- gdal-2.1.1-fedora/scripts/GNUmakefile.completion 2016-07-07 04:35:26.000000000 -0600
+++ gdal-2.1.1-fedora/scripts/GNUmakefile 2016-08-12 10:21:01.442938729 -0600
Index: gdal-2.2.3-fedora/scripts/GNUmakefile
===================================================================
--- gdal-2.2.3-fedora.orig/scripts/GNUmakefile
+++ gdal-2.2.3-fedora/scripts/GNUmakefile
@@ -5,6 +5,6 @@ completion:
install:

View File

@ -1,7 +1,7 @@
diff --git a/frmts/grib/GNUmakefile b/frmts/grib/GNUmakefile
index cd0b260..47e5dde 100644
--- a/frmts/grib/GNUmakefile
+++ b/frmts/grib/GNUmakefile
Index: gdal-2.2.3-fedora/frmts/grib/GNUmakefile
===================================================================
--- gdal-2.2.3-fedora.orig/frmts/grib/GNUmakefile
+++ gdal-2.2.3-fedora/frmts/grib/GNUmakefile
@@ -7,8 +7,7 @@ include ../../GDALmake.opt
OBJ = gribdataset.o \
clock.o \
@ -21,11 +21,11 @@ index cd0b260..47e5dde 100644
endif
CPPFLAGS := $(CPPFLAGS) $(EXTRAFLAGS)
diff --git a/frmts/grib/degrib18/degrib/engribapi.c b/frmts/grib/degrib18/degrib/engribapi.c
index 9f64e8b..d9f2b96 100644
--- a/frmts/grib/degrib18/degrib/engribapi.c
+++ b/frmts/grib/degrib18/degrib/engribapi.c
@@ -419,7 +419,6 @@ int fillSect3 (enGribMeta *en, uShort2 tmplNum, double majEarth,
Index: gdal-2.2.3-fedora/frmts/grib/degrib18/degrib/engribapi.c
===================================================================
--- gdal-2.2.3-fedora.orig/frmts/grib/degrib18/degrib/engribapi.c
+++ gdal-2.2.3-fedora/frmts/grib/degrib18/degrib/engribapi.c
@@ -419,7 +419,6 @@ int fillSect3 (enGribMeta *en, uShort2 t
double meshLat, double orientLon, double scaleLat1,
double scaleLat2, double southLat, double southLon)
{
@ -33,7 +33,7 @@ index 9f64e8b..d9f2b96 100644
int i; /* loop counter over number of GDS templates. */
double unit; /* Used to convert from stored value to degrees
* lat/lon. See GRIB2 Regulation 92.1.6 */
@@ -641,7 +640,6 @@ int fillSect4_0 (enGribMeta *en, uShort2 tmplNum, uChar cat, uChar subCat,
@@ -641,7 +640,6 @@ int fillSect4_0 (enGribMeta *en, uShort2
double dSurfVal2)
{
int i; /* loop counter over number of PDS templates. */
@ -41,7 +41,7 @@ index 9f64e8b..d9f2b96 100644
/* analysis template (0) */
/* In addition templates (1, 2, 5, 8, 9, 12) begin with 4.0 info. */
@@ -1197,7 +1195,6 @@ int fillSect5 (enGribMeta *en, uShort2 tmplNum, sShort2 BSF, sShort2 DSF,
@@ -1197,7 +1195,6 @@ int fillSect5 (enGribMeta *en, uShort2 t
uChar orderOfDiff)
{
int i; /* loop counter over number of DRS templates. */
@ -49,11 +49,11 @@ index 9f64e8b..d9f2b96 100644
/* Find NCEP's template match */
for (i = 0; i < MAXDRSTEMP; i++) {
diff --git a/frmts/grib/degrib18/degrib/grib2api.c b/frmts/grib/degrib18/degrib/grib2api.c
index 78e8c50..1724805 100644
--- a/frmts/grib/degrib18/degrib/grib2api.c
+++ b/frmts/grib/degrib18/degrib/grib2api.c
@@ -961,7 +961,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfildo, float * ain, sInt4 * iain, sInt4 *
Index: gdal-2.2.3-fedora/frmts/grib/degrib18/degrib/grib2api.c
===================================================================
--- gdal-2.2.3-fedora.orig/frmts/grib/degrib18/degrib/grib2api.c
+++ gdal-2.2.3-fedora/frmts/grib/degrib18/degrib/grib2api.c
@@ -961,7 +961,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfi
}
curIndex = 14;
for (i = 0; i < gfld->igdtlen; i++) {
@ -61,7 +61,7 @@ index 78e8c50..1724805 100644
is3[curIndex] = gfld->igdtmpl[i];
curIndex += abs (templatesgrid[gridIndex].mapgrid[i]);
}
@@ -1029,7 +1028,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfildo, float * ain, sInt4 * iain, sInt4 *
@@ -1029,7 +1028,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfi
}
curIndex = 9;
for (i = 0; i < gfld->ipdtlen; i++) {
@ -69,7 +69,7 @@ index 78e8c50..1724805 100644
is4[curIndex] = gfld->ipdtmpl[i];
curIndex += abs (templatespds[pdsIndex].mappds[i]);
}
@@ -1047,7 +1045,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfildo, float * ain, sInt4 * iain, sInt4 *
@@ -1047,7 +1045,6 @@ void unpk_g2ncep (CPL_UNUSED sInt4 * kfi
}
curIndex = 11;
for (i = 0; i < gfld->idrtlen; i++) {

View File

@ -1,6 +1,7 @@
diff -up ./swig/include/java/gdalconst_java.i.jni~ ./swig/include/java/gdalconst_java.i
--- ./swig/include/java/gdalconst_java.i.jni~ 2016-04-25 19:35:57.000000000 +0200
+++ ./swig/include/java/gdalconst_java.i 2016-05-02 15:50:37.171990235 +0200
Index: gdal-2.2.3-fedora/swig/include/java/gdalconst_java.i
===================================================================
--- gdal-2.2.3-fedora.orig/swig/include/java/gdalconst_java.i
+++ gdal-2.2.3-fedora/swig/include/java/gdalconst_java.i
@@ -13,7 +13,7 @@
static {
@ -10,9 +11,10 @@ diff -up ./swig/include/java/gdalconst_java.i.jni~ ./swig/include/java/gdalconst
available = true;
} catch (UnsatisfiedLinkError e) {
available = false;
diff -up ./swig/include/java/gdal_java.i.jni~ ./swig/include/java/gdal_java.i
--- ./swig/include/java/gdal_java.i.jni~ 2016-04-25 19:35:57.000000000 +0200
+++ ./swig/include/java/gdal_java.i 2016-05-02 15:50:37.172990231 +0200
Index: gdal-2.2.3-fedora/swig/include/java/gdal_java.i
===================================================================
--- gdal-2.2.3-fedora.orig/swig/include/java/gdal_java.i
+++ gdal-2.2.3-fedora/swig/include/java/gdal_java.i
@@ -15,7 +15,7 @@
static {
@ -22,9 +24,10 @@ diff -up ./swig/include/java/gdal_java.i.jni~ ./swig/include/java/gdal_java.i
available = true;
if (gdal.HasThreadSupport() == 0)
diff -up ./swig/include/java/ogr_java.i.jni~ ./swig/include/java/ogr_java.i
--- ./swig/include/java/ogr_java.i.jni~ 2016-04-25 19:35:57.000000000 +0200
+++ ./swig/include/java/ogr_java.i 2016-05-02 15:50:37.172990231 +0200
Index: gdal-2.2.3-fedora/swig/include/java/ogr_java.i
===================================================================
--- gdal-2.2.3-fedora.orig/swig/include/java/ogr_java.i
+++ gdal-2.2.3-fedora/swig/include/java/ogr_java.i
@@ -17,7 +17,7 @@
static {
@ -34,9 +37,10 @@ diff -up ./swig/include/java/ogr_java.i.jni~ ./swig/include/java/ogr_java.i
available = true;
if (org.gdal.gdal.gdal.HasThreadSupport() == 0)
diff -up ./swig/include/java/osr_java.i.jni~ ./swig/include/java/osr_java.i
--- ./swig/include/java/osr_java.i.jni~ 2016-04-25 19:35:57.000000000 +0200
+++ ./swig/include/java/osr_java.i 2016-05-02 15:50:37.172990231 +0200
Index: gdal-2.2.3-fedora/swig/include/java/osr_java.i
===================================================================
--- gdal-2.2.3-fedora.orig/swig/include/java/osr_java.i
+++ gdal-2.2.3-fedora/swig/include/java/osr_java.i
@@ -20,7 +20,7 @@
static {

View File

@ -68,7 +68,7 @@
Name: gdal
Version: 2.2.3
Release: 2%{?dist}%{?bootstrap:.%{bootstrap}.bootstrap}
Release: 3%{?dist}%{?bootstrap:.%{bootstrap}.bootstrap}
Summary: GIS file format library
Group: System Environment/Libraries
License: MIT
@ -101,6 +101,8 @@ Patch8: %{name}-1.9.0-java.patch
Patch9: %{name}-2.2.2-zlib.patch
Patch10: %{name}-2.2.3_json-c_013.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ant
@ -338,6 +340,7 @@ rm -r frmts/grib/degrib18/g2clib-1.0.4
%patch5 -p1 -b .python~
%patch8 -p1 -b .java~
%patch9 -p1 -b .zlib~
%patch10 -p1 -b .json-c_013~
# Copy in PROVENANCE.TXT-fedora
cp -p %SOURCE4 .
@ -885,6 +888,9 @@ popd
#Or as before, using ldconfig
%changelog
* Mon Dec 11 2017 Björn Esser <besser82@fedoraproject.org> - 2.2.3-3.1.bootstrap
- Add patch to cleanly build against json-c v0.13
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 2.2.3-2.1.bootstrap
- Rebuilt for libjson-c.so.3