Update gdal; adds spatialite support

This commit is contained in:
Luke 2017-09-01 11:58:26 +02:00 committed by Tony Theodore
parent 7185fee588
commit 4f49515dec
2 changed files with 110 additions and 102 deletions

View File

@ -3,17 +3,117 @@ This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MXE
Date: Sat, 18 Oct 2014 18:25:34 -0400
Subject: [PATCH 1/2] Fix geos detection
From: Luke Potgieter <fried.roadkill+ght@gmail.com>
Date: Tue, 29 Aug 2017 16:31:09 +0200
Subject: [PATCH] Detect spatialite more effectively than just checking for
headers in the system paths. PostgreSQL detection requires -lpthread when
building statically. Added detection for openjpeg-2.2.
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1124,7 +1124,7 @@ else
AC_MSG_RESULT([yes])
- AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no,-L`$PG_CONFIG --libdir`)
+ AC_CHECK_LIB(pq,PQconnectdb,HAVE_PG=yes,HAVE_PG=no,-L`$PG_CONFIG --libdir` -lpthread)
if test "${HAVE_PG}" = "yes" ; then
LIBS=-L`$PG_CONFIG --libdir`" -lpq $LIBS"
@@ -2545,14 +2545,23 @@ elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then
if test "$HAVE_OPENJPEG" = "yes"; then
LIBS="-lopenjp2 $LIBS"
fi
- else
- AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
- if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
- AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
- if test "$HAVE_OPENJPEG" = "yes"; then
- OPENJPEG_VERSION=20100
- LIBS="-lopenjp2 $LIBS"
- fi
+ fi
+
+ AC_CHECK_HEADERS([openjpeg-2.1/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
+ AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
+ if test "$HAVE_OPENJPEG" = "yes"; then
+ OPENJPEG_VERSION=20100
+ LIBS="-lopenjp2 $LIBS"
+ fi
+ fi
+
+ AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h])
+ if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then
+ AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,)
+ if test "$HAVE_OPENJPEG" = "yes"; then
+ OPENJPEG_VERSION=20200
+ LIBS="-lopenjp2 $LIBS"
fi
fi
else
@@ -2563,8 +2572,11 @@ else
elif test -r $with_openjpeg/include/openjpeg-2.1/openjpeg.h ; then
OPENJPEG_VERSION=20100
EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+ elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then
+ OPENJPEG_VERSION=20200
+ EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
else
- AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1])
+ AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0, $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2])
fi
AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,-L$with_openjpeg/lib)
@@ -3532,16 +3544,21 @@ AC_ARG_WITH(spatialite-soname,
HAVE_SPATIALITE=no
SPATIALITE_AMALGAMATION=no
+HAVE_SPAT_PKG=no
if test -z "$with_spatialite" -o "$with_spatialite" = "no"; then
AC_MSG_RESULT(disabled)
elif test "$with_spatialite" = "yes"; then
AC_CHECK_HEADERS(sqlite3.h)
if test "$ac_cv_header_sqlite3_h" = "yes"; then
- AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include])
- if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
- AC_MSG_RESULT(found)
+ #AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include])
+ #if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then
+ PKG_CHECK_MODULES(SPATIALITE, spatialite, [HAVE_SPAT_PKG=yes], [HAVE_SPAT_PKG=no])
+ if test "$HAVE_SPAT_PKG" = "yes"; then
+ OLD_LIBS="$LIBS"
+ LIBS="$LIBS -lsqlite3 -lspatialite -lgeos_c -lgeos -lxml2 -liconv -llzma -lproj -lstdc++ -lws2_32 -lm -lz"
AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,)
+ LIBS="$OLD_LIBS"
if test "$SPATIALITE_INIT_FOUND" = "yes"; then
HAVE_SPATIALITE=yes
SPATIALITE_LIBS="-lspatialite -lsqlite3"
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index 1111111..2222222 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -34,7 +34,9 @@
#pragma clang diagnostic ignored "-Wdocumentation"
#endif
-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
+#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
+#include <openjpeg-2.2/openjpeg.h>
+#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
#include <openjpeg-2.1/openjpeg.h>
#else
#include <stdio.h> /* openjpeg.h needs FILE* */
diff --git a/m4/geos.m4 b/m4/geos.m4
index 1111111..2222222 100644
--- a/m4/geos.m4
+++ b/m4/geos.m4
@@ -121,14 +121,14 @@ AC_DEFUN([GEOS_INIT],[
HAVE_GEOS="no"
- GEOS_LIBS="`${GEOS_CONFIG} --ldflags` -lgeos_c"
@ -30,94 +130,3 @@ index 1111111..2222222 100644
AC_CHECK_LIB([geos_c],
[GEOSversion],
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 5 Jul 2016 22:23:16 +0300
Subject: [PATCH 2/2] Use AC_PATH_TOOL for config scripts
diff --git a/configure.in b/configure.in
index 1111111..2222222 100644
--- a/configure.in
+++ b/configure.in
@@ -866,7 +866,7 @@ AC_ARG_WITH(pg,
[Include PostgreSQL GDAL/OGR Support (ARG=path to pg_config)]),,)
if test "x$with_pg" = "xyes" -o "x$with_pg" = "x" ; then
- AC_PATH_PROG(PG_CONFIG, pg_config, no)
+ AC_PATH_TOOL(PG_CONFIG, pg_config, no)
else
PG_CONFIG=$with_pg
fi
@@ -2016,7 +2016,7 @@ KEA_CONFIG=no
AC_ARG_WITH(kea,[ --with-kea[=ARG] Include kealib (ARG=path to kea-config) [[default=yes]]],,)
if test "$with_kea" = "yes" -o "x$with_kea" = "x" ; then
- AC_PATH_PROG(KEA_CONFIG, kea-config, no)
+ AC_PATH_TOOL(KEA_CONFIG, kea-config, no)
else
KEA_CONFIG=$with_kea
fi
@@ -2079,10 +2079,10 @@ else
dnl find nc-config location
unset ac_cv_path_NETCDF_NCCONFIG
if test "$with_netcdf" = "yes" -o "$with_netcdf" = "" ; then
- AC_PATH_PROG(NETCDF_NCCONFIG, nc-config, no)
+ AC_PATH_TOOL(NETCDF_NCCONFIG, nc-config, no)
else
tmp_path="$with_netcdf/bin$PATH_SEPARATOR$with_netcdf"
- AC_PATH_PROG(NETCDF_NCCONFIG, nc-config, no, $tmp_path)
+ AC_PATH_TOOL(NETCDF_NCCONFIG, nc-config, no, $tmp_path)
fi
dnl test nc-config
@@ -2832,7 +2832,7 @@ MYSQL_CONFIG=no
AC_ARG_WITH(mysql,[ --with-mysql[=ARG] Include MySQL (ARG=path to mysql_config) [[default=no]]],,)
if test "$with_mysql" = "yes" ; then
- AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
+ AC_PATH_TOOL(MYSQL_CONFIG, mysql_config, no)
else
if test "x$with_mysql" != "x" ; then
MYSQL_CONFIG=$with_mysql
@@ -3162,7 +3162,7 @@ if test "`basename xx/$with_curl`" = "curl-config" ; then
elif test "$with_curl" = "no" ; then
LIBCURL_CONFIG=no
else
- AC_PATH_PROG(LIBCURL_CONFIG, curl-config, no)
+ AC_PATH_TOOL(LIBCURL_CONFIG, curl-config, no)
fi
if test "$LIBCURL_CONFIG" != "no" ; then
@@ -3204,7 +3204,7 @@ if test "`basename xx/$with_xml2`" = "xml2-config" ; then
elif test "$with_xml2" = "no" ; then
LIBXML2_CONFIG=no
else
- AC_PATH_PROG(LIBXML2_CONFIG, xml2-config, no)
+ AC_PATH_TOOL(LIBXML2_CONFIG, xml2-config, no)
fi
if test "$LIBXML2_CONFIG" != "no" ; then
diff --git a/m4/geos.m4 b/m4/geos.m4
index 1111111..2222222 100644
--- a/m4/geos.m4
+++ b/m4/geos.m4
@@ -58,7 +58,7 @@ AC_DEFUN([GEOS_INIT],[
elif test x"$with_geos" = x"yes" -o x"$with_geos" = x"" ; then
- AC_PATH_PROG(GEOS_CONFIG, geos-config, no)
+ AC_PATH_TOOL(GEOS_CONFIG, geos-config, no)
ac_geos_config_auto=yes
else
@@ -133,7 +133,7 @@ AC_DEFUN([GEOS_INIT],[
AC_CHECK_LIB([geos_c],
[GEOSversion],
[HAVE_GEOS="yes"],
- [HAVE_GEOS="no"],
+ [HAVE_GEOS="no" && echo "$GEOS_LIBS" && exit 1],
[]
)

View File

@ -4,15 +4,15 @@ PKG := gdal
$(PKG)_WEBSITE := http://www.gdal.org/
$(PKG)_DESCR := GDAL
$(PKG)_IGNORE :=
$(PKG)_VERSION := 2.1.3
$(PKG)_CHECKSUM := ae6a0a0dc6eb45a981a46db27e3dfe16c644fcf04732557e2cb315776974074a
$(PKG)_VERSION := 2.2.1
$(PKG)_CHECKSUM := 61837706abfa3e493f3550236efc2c14bd6b24650232f9107db50a944abf8b2f
$(PKG)_SUBDIR := gdal-$($(PKG)_VERSION)
$(PKG)_FILE := gdal-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := http://download.osgeo.org/gdal/$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://ftp.remotesensing.org/gdal/$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_DEPS := gcc armadillo curl expat geos giflib gta hdf4 hdf5 \
jpeg json-c libgeotiff libmysqlclient libpng libxml2 \
netcdf openjpeg postgresql proj sqlite tiff zlib
netcdf openjpeg postgresql proj sqlite tiff zlib spatialite
define $(PKG)_UPDATE
$(WGET) -q -O- 'https://trac.osgeo.org/gdal/wiki/DownloadSource' | \
@ -60,7 +60,6 @@ define $(PKG)_BUILD
--with-oci=no \
--with-odbc=no \
--with-ogdi=no \
--with-ogr \
--with-openjpeg='$(PREFIX)/$(TARGET)' \
--with-pam \
--with-pcidsk=no \
@ -69,15 +68,15 @@ define $(PKG)_BUILD
--with-php=no \
--with-png='$(PREFIX)/$(TARGET)' \
--with-python=no \
--with-ruby=no \
--with-sde=no \
--with-spatialite=no \
--with-spatialite=yes \
--with-sqlite3='$(PREFIX)/$(TARGET)' \
--with-threads=no \
--with-xerces=no \
--with-xml2='$(PREFIX)/$(TARGET)/bin/xml2-config' \
--with-pg='$(PREFIX)/$(TARGET)/bin/pg_config' \
CXXFLAGS='-D_WIN32_WINNT=0x0600' \
LIBS="-ljpeg -lsecur32 -lportablexdr `'$(TARGET)-pkg-config' --libs openssl libtiff-4`"
LIBS="-ljpeg -lsecur32 -lportablexdr `'$(TARGET)-pkg-config' --libs openssl libtiff-4 spatialite freexl armadillo`"
$(MAKE) -C '$(1)' -j '$(JOBS)' lib-target
# gdal doesn't have an install-strip target