summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorggranga2017-10-11 17:34:37 +0200
committerggranga2017-10-11 17:34:37 +0200
commit55f462a3832a6251d1fc0181df13038c76217513 (patch)
treec2b828c0264cbae39c2dae97f35906d69df0463a
parenta996b5e4139922967bb3176d614721ca529ee13a (diff)
downloadaur-55f462a3832a6251d1fc0181df13038c76217513.tar.gz
Update GDAL version
-rwxr-xr-x.SRCINFO10
-rw-r--r--PKGBUILD45
-rw-r--r--gdal-2.2-poppler-0.58.patch625
-rw-r--r--gdal-perl-vendor.patch28
4 files changed, 690 insertions, 18 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0ddea14b1ec3..b9636a99f5bd 100755
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = gdal-hdf4
pkgdesc = A translator library for raster geospatial data formats, with support to HDF4 format (required to use MODIStsp tool: http://github.com/lbusett/MODIStsp)
pkgver = 2.2.1
- pkgrel = 1
+ pkgrel = 7
url = http://www.gdal.org/
changelog = gdal.changelog
arch = i686
@@ -36,8 +36,12 @@ pkgbase = gdal-hdf4
provides = gdal
conflicts = gdal
options = !emptydirs
- source = http://download.osgeo.org/gdal/2.1.1/gdal-2.1.1.tar.xz
- sha256sums = 87ce516ce757ad1edf1e21f007fbe232ed2e932af422e9893f40199711c41f92
+ source = http://download.osgeo.org/gdal/2.2.1/gdal-2.2.1.tar.xz
+ source = gdal-perl-vendor.patch
+ source = gdal-2.2-poppler-0.58.patch
+ sha256sums = 927098d54083ac919a497f787b835b099e9a194f2e5444dbff901f7426b86066
+ sha256sums = 20989e5fa499206b42c92280ce084fdf7b2f661a4233fc349611cc57102fe114
+ sha256sums = 17bbcfed72cdc346f1b5bb83247eb51e93ddcf0b00c8bf5e246338a2fb8a567d
pkgname = gdal-hdf4
diff --git a/PKGBUILD b/PKGBUILD
index 82f9bb9a9ab6..6af9a43dbbc8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,26 +3,32 @@
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
# Contributor: William Rea <sillywilly@gmail.com>
+# Contributor: Luigi Ranghetti <ggranga@gmail.com>
+
pkgname=gdal-hdf4
_pkgname=gdal
+provides=('gdal')
+conflicts=('gdal')
pkgver=2.2.1
-pkgrel=1
+pkgrel=7
pkgdesc="A translator library for raster geospatial data formats, with support to HDF4 format (required to use MODIStsp tool: http://github.com/lbusett/MODIStsp)"
arch=('i686' 'x86_64')
url="http://www.gdal.org/"
license=('custom')
depends=('curl' 'geos' 'giflib' 'hdf5' 'libgeotiff' 'libjpeg-turbo' 'libpng' 'libspatialite' 'libtiff' 'netcdf' 'hdf4-nonetcdf'
'openjpeg2' 'poppler' 'python2' 'python2-numpy' 'cfitsio' 'sqlite' 'libmariadbclient' 'postgresql-libs')
-provides=('gdal')
-conflicts=('gdal')
makedepends=('perl' 'swig' 'chrpath' 'doxygen')
optdepends=('postgresql: postgresql database support'
'mariadb: mariadb database support'
'perl: perl binding support')
options=('!emptydirs')
changelog=$_pkgname.changelog
-source=(http://download.osgeo.org/${_pkgname}/${pkgver}/${_pkgname}-${pkgver}.tar.xz)
-sha256sums=('927098d54083ac919a497f787b835b099e9a194f2e5444dbff901f7426b86066')
+source=(http://download.osgeo.org/${_pkgname}/${pkgver}/${_pkgname}-${pkgver}.tar.xz
+ gdal-perl-vendor.patch
+ gdal-2.2-poppler-0.58.patch)
+sha256sums=('927098d54083ac919a497f787b835b099e9a194f2e5444dbff901f7426b86066'
+ '20989e5fa499206b42c92280ce084fdf7b2f661a4233fc349611cc57102fe114'
+ '17bbcfed72cdc346f1b5bb83247eb51e93ddcf0b00c8bf5e246338a2fb8a567d')
prepare() {
cd "${srcdir}"/$_pkgname-$pkgver
@@ -35,6 +41,13 @@ prepare() {
# Fix mandir
sed -i "s|^mandir=.*|mandir='\${prefix}/share/man'|" configure
+
+# Fix Perl bindings installation path
+ patch -Np1 -i ../gdal-perl-vendor.patch
+
+# poppler 0.58.x API change
+# https://trac.osgeo.org/gdal/changeset/40036
+ patch -Np4 -i ../gdal-2.2-poppler-0.58.patch
}
build() {
@@ -42,25 +55,26 @@ build() {
export CFLAGS="$CFLAGS -fno-strict-aliasing"
# bug #23654
- export LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ export LDFLAGS="$LDFLAGS -Wl,--as-needed"
./configure --prefix=/usr --with-netcdf --with-libtiff --with-sqlite3 --with-geotiff \
- --with-mysql --with-python=/usr/bin/python2 --with-curl --with-hdf4 --with-hdf5 --with-perl --with-geos \
+ --with-mysql --with-python=/usr/bin/python2 --with-curl --with-hdf5 --with-hdf4 --with-perl --with-geos \
--with-png --with-poppler --with-spatialite --with-openjpeg
-# bug: http://osgeo-org.1560.x6.nabble.com/gdal-dev-jpeg2000-jasper-error-compiling-gdal-2-1-from-git-release-branch-td5299100.html
- sed -i -e 's@uchar@unsigned char@' frmts/jpeg2000/jpeg2000_vsil_io.cpp
-
# workaround for bug #13646
sed -i 's/PY_HAVE_SETUPTOOLS=1/PY_HAVE_SETUPTOOLS=/g' ./GDALmake.opt
sed -i 's/EXE_DEP_LIBS/KILL_EXE_DEP_LIBS/' apps/GNUmakefile
+# bug: http://osgeo-org.1560.x6.nabble.com/gdal-dev-jpeg2000-jasper-error-compiling-gdal-2-1-from-git-release-branch-td5299100.html
+ sed -i -e 's@uchar@unsigned char@' frmts/jpeg2000/jpeg2000_vsil_io.cpp
+
make
make man
}
package () {
cd "${srcdir}"/$_pkgname-$pkgver
+
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" install-man
@@ -71,9 +85,10 @@ package () {
rm -f "${pkgdir}"/usr/share/man/man1/_build_gdal_src_gdal-${pkgver}_apps_.1
# Remove RPATH
- chrpath --delete "${pkgdir}"/usr/lib/perl5/${CARCH}-linux-thread-multi/auto/Geo/OSR/OSR.so
- chrpath --delete "${pkgdir}"/usr/lib/perl5/${CARCH}-linux-thread-multi/auto/Geo/OGR/OGR.so
- chrpath --delete "${pkgdir}"/usr/lib/perl5/${CARCH}-linux-thread-multi/auto/Geo/GDAL/GDAL.so
- chrpath --delete "${pkgdir}"/usr/lib/perl5/${CARCH}-linux-thread-multi/auto/Geo/GDAL/Const/Const.so
- chrpath --delete "${pkgdir}"/usr/lib/perl5/${CARCH}-linux-thread-multi/auto/Geo/GNM/GNM.so
+ eval local $(perl -V:vendorarch)
+ chrpath --delete "${pkgdir}"${vendorarch}/auto/Geo/OSR/OSR.so
+ chrpath --delete "${pkgdir}"${vendorarch}/auto/Geo/OGR/OGR.so
+ chrpath --delete "${pkgdir}"${vendorarch}/auto/Geo/GDAL/GDAL.so
+ chrpath --delete "${pkgdir}"${vendorarch}/auto/Geo/GDAL/Const/Const.so
+ chrpath --delete "${pkgdir}"${vendorarch}/auto/Geo/GNM/GNM.so
}
diff --git a/gdal-2.2-poppler-0.58.patch b/gdal-2.2-poppler-0.58.patch
new file mode 100644
index 000000000000..e11cd3f78a39
--- /dev/null
+++ b/gdal-2.2-poppler-0.58.patch
@@ -0,0 +1,625 @@
+Index: /branches/2.2/gdal/GDALmake.opt.in
+===================================================================
+--- /branches/2.2/gdal/GDALmake.opt.in (revision 40035)
++++ /branches/2.2/gdal/GDALmake.opt.in (revision 40036)
+@@ -473,4 +473,5 @@
+ POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@
+ POPPLER_0_23_OR_LATER = @POPPLER_0_23_OR_LATER@
++POPPLER_0_58_OR_LATER = @POPPLER_0_58_OR_LATER@
+ POPPLER_INC = @POPPLER_INC@
+ POPPLER_PLUGIN_LIB = @POPPLER_PLUGIN_LIB@
+Index: /branches/2.2/gdal/configure
+===================================================================
+--- /branches/2.2/gdal/configure (revision 40035)
++++ /branches/2.2/gdal/configure (revision 40036)
+@@ -663,4 +663,5 @@
+ POPPLER_PLUGIN_LIB
+ POPPLER_INC
++POPPLER_0_58_OR_LATER
+ POPPLER_0_23_OR_LATER
+ POPPLER_0_20_OR_LATER
+@@ -32272,4 +32273,6 @@
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
+ POPPLER_0_20_OR_LATER=no
++POPPLER_0_23_OR_LATER=no
++POPPLER_0_58_OR_LATER=no
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poppler" >&5
+@@ -32312,15 +32315,19 @@
+ POPPLER_PLUGIN_LIB="${TEST_POPPLER_LIB}"
+
+- # And now try another dirty thing, but this one is
+- # optional.
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Catalog::optContent exists" >&5
+-$as_echo_n "checking if Catalog::optContent exists... " >&6; }
++ CHECK_OTHER_POPPLER_VERSION=yes
++
++ # And now we check if we have Poppler >= 0.58.0
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Object does have new API (>= 0.58.0)" >&5
++$as_echo_n "checking if Object does have new API (>= 0.58.0)... " >&6; }
+ rm -f testpoppler.*
+- echo '#define private public' > testpoppler.cpp
+- echo '#include <poppler/Object.h>' >> testpoppler.cpp
+- echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_0_58_OR_LATER=yes
++ POPPLER_0_23_OR_LATER=yes
++ POPPLER_0_20_OR_LATER=yes
++ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
+ POPPLER_HAS_OPTCONTENT=yes
++ CHECK_OTHER_POPPLER_VERSION=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
+@@ -32330,48 +32337,73 @@
+ fi
+
+- # And now we check if we have Poppler >= 0.16.0
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if BaseStream constructor needs 2 arguments" >&5
+-$as_echo_n "checking if BaseStream constructor needs 2 arguments... " >&6; }
+- rm -f testpoppler.*
+- echo '#include <poppler/Object.h>' > testpoppler.cpp
+- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
+- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
+- echo 'public:' >> testpoppler.cpp
+- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
+- echo '};' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
+- if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-$as_echo "yes" >&6; }
+-
+- # And now we check if we have Poppler >= 0.20.0
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
+-$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
++ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
++
++ # And now try another dirty thing, but this one is
++ # optional.
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Catalog::optContent exists" >&5
++$as_echo_n "checking if Catalog::optContent exists... " >&6; }
+ rm -f testpoppler.*
+- echo '#include <poppler/Error.h>' > testpoppler.cpp
+- echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
++ echo '#define private public' > testpoppler.cpp
++ echo '#include <poppler/Object.h>' >> testpoppler.cpp
++ echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_0_20_OR_LATER=yes
++ POPPLER_HAS_OPTCONTENT=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
+-
+- # And now we check if we have Poppler >= 0.23.0
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.23.0" >&5
+-$as_echo_n "checking if we have Poppler >= 0.23.0... " >&6; }
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ fi
++
++ # And now we check if we have Poppler >= 0.16.0
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if BaseStream constructor needs 2 arguments" >&5
++$as_echo_n "checking if BaseStream constructor needs 2 arguments... " >&6; }
++ rm -f testpoppler.*
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
++ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
++ echo 'public:' >> testpoppler.cpp
++ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
++ echo '};' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++ # And now we check if we have Poppler >= 0.20.0
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
++$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
+ rm -f testpoppler.*
+- echo '#include <poppler/Object.h>' > testpoppler.cpp
+- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
+- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
+- echo 'public:' >> testpoppler.cpp
+- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
+- echo ' ~TestStream() {}' >> testpoppler.cpp
+- echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
+- echo '};' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ echo '#include <poppler/Error.h>' > testpoppler.cpp
++ echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_0_23_OR_LATER=yes
++ POPPLER_0_20_OR_LATER=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }
++
++ # And now we check if we have Poppler >= 0.23.0
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.23.0" >&5
++$as_echo_n "checking if we have Poppler >= 0.23.0... " >&6; }
++ rm -f testpoppler.*
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
++ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
++ echo 'public:' >> testpoppler.cpp
++ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
++ echo ' ~TestStream() {}' >> testpoppler.cpp
++ echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
++ echo '};' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_0_23_OR_LATER=yes
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++ else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++ fi
++
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+@@ -32383,8 +32415,4 @@
+ $as_echo "no" >&6; }
+ fi
+-
+- else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+ fi
+ else
+@@ -32408,4 +32436,6 @@
+
+ POPPLER_0_23_OR_LATER=$POPPLER_0_23_OR_LATER
++
++POPPLER_0_58_OR_LATER=$POPPLER_0_58_OR_LATER
+
+ POPPLER_INC=$POPPLER_INC
+Index: /branches/2.2/gdal/configure.ac
+===================================================================
+--- /branches/2.2/gdal/configure.ac (revision 40035)
++++ /branches/2.2/gdal/configure.ac (revision 40036)
+@@ -4284,4 +4284,6 @@
+ POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
+ POPPLER_0_20_OR_LATER=no
++POPPLER_0_23_OR_LATER=no
++POPPLER_0_58_OR_LATER=no
+
+ AC_MSG_CHECKING([for poppler])
+@@ -4322,14 +4324,18 @@
+ POPPLER_PLUGIN_LIB="${TEST_POPPLER_LIB}"
+
+- # And now try another dirty thing, but this one is
+- # optional.
+- AC_MSG_CHECKING([if Catalog::optContent exists])
++ CHECK_OTHER_POPPLER_VERSION=yes
++
++ # And now we check if we have Poppler >= 0.58.0
++ AC_MSG_CHECKING([if Object does have new API (>= 0.58.0)])
+ rm -f testpoppler.*
+- echo '#define private public' > testpoppler.cpp
+- echo '#include <poppler/Object.h>' >> testpoppler.cpp
+- echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo 'int main(int argc, char** argv) { Object o(objNull); return 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_0_58_OR_LATER=yes
++ POPPLER_0_23_OR_LATER=yes
++ POPPLER_0_20_OR_LATER=yes
++ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
+ POPPLER_HAS_OPTCONTENT=yes
++ CHECK_OTHER_POPPLER_VERSION=no
+ AC_MSG_RESULT([yes])
+ else
+@@ -4337,42 +4343,63 @@
+ fi
+
+- # And now we check if we have Poppler >= 0.16.0
+- AC_MSG_CHECKING([if BaseStream constructor needs 2 arguments])
+- rm -f testpoppler.*
+- echo '#include <poppler/Object.h>' > testpoppler.cpp
+- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
+- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
+- echo 'public:' >> testpoppler.cpp
+- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
+- echo '};' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
+- if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
+- AC_MSG_RESULT([yes])
+-
+- # And now we check if we have Poppler >= 0.20.0
+- AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
++ if test "$CHECK_OTHER_POPPLER_VERSION" = "yes"; then
++
++ # And now try another dirty thing, but this one is
++ # optional.
++ AC_MSG_CHECKING([if Catalog::optContent exists])
+ rm -f testpoppler.*
+- echo '#include <poppler/Error.h>' > testpoppler.cpp
+- echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
++ echo '#define private public' > testpoppler.cpp
++ echo '#include <poppler/Object.h>' >> testpoppler.cpp
++ echo '#include <poppler/Catalog.h>' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return &(((Catalog*)0x8000)->optContent) == 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_0_20_OR_LATER=yes
++ POPPLER_HAS_OPTCONTENT=yes
+ AC_MSG_RESULT([yes])
+-
+- # And now we check if we have Poppler >= 0.23.0
+- AC_MSG_CHECKING([if we have Poppler >= 0.23.0])
++ else
++ AC_MSG_RESULT([no])
++ fi
++
++ # And now we check if we have Poppler >= 0.16.0
++ AC_MSG_CHECKING([if BaseStream constructor needs 2 arguments])
++ rm -f testpoppler.*
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
++ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
++ echo 'public:' >> testpoppler.cpp
++ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
++ echo '};' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
++ AC_MSG_RESULT([yes])
++
++ # And now we check if we have Poppler >= 0.20.0
++ AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
+ rm -f testpoppler.*
+- echo '#include <poppler/Object.h>' > testpoppler.cpp
+- echo '#include <poppler/Stream.h>' >> testpoppler.cpp
+- echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
+- echo 'public:' >> testpoppler.cpp
+- echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
+- echo ' ~TestStream() {}' >> testpoppler.cpp
+- echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
+- echo '};' >> testpoppler.cpp
+- echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ echo '#include <poppler/Error.h>' > testpoppler.cpp
++ echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
+ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+- POPPLER_0_23_OR_LATER=yes
++ POPPLER_0_20_OR_LATER=yes
+ AC_MSG_RESULT([yes])
++
++ # And now we check if we have Poppler >= 0.23.0
++ AC_MSG_CHECKING([if we have Poppler >= 0.23.0])
++ rm -f testpoppler.*
++ echo '#include <poppler/Object.h>' > testpoppler.cpp
++ echo '#include <poppler/Stream.h>' >> testpoppler.cpp
++ echo 'class TestStream: public BaseStream {' >> testpoppler.cpp
++ echo 'public:' >> testpoppler.cpp
++ echo ' TestStream() : BaseStream(0,0) {}' >> testpoppler.cpp
++ echo ' ~TestStream() {}' >> testpoppler.cpp
++ echo ' virtual BaseStream *copy() { return BaseStream::copy(); }' >> testpoppler.cpp
++ echo '};' >> testpoppler.cpp
++ echo 'int main(int argc, char** argv) { return 0; }' >> testpoppler.cpp
++ if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
++ POPPLER_0_23_OR_LATER=yes
++ AC_MSG_RESULT([yes])
++ else
++ AC_MSG_RESULT([no])
++ fi
++
+ else
+ AC_MSG_RESULT([no])
+@@ -4382,7 +4409,4 @@
+ AC_MSG_RESULT([no])
+ fi
+-
+- else
+- AC_MSG_RESULT([no])
+ fi
+ else
+@@ -4400,4 +4424,5 @@
+ AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
+ AC_SUBST(POPPLER_0_23_OR_LATER, $POPPLER_0_23_OR_LATER)
++AC_SUBST(POPPLER_0_58_OR_LATER, $POPPLER_0_58_OR_LATER)
+ AC_SUBST(POPPLER_INC, $POPPLER_INC)
+ AC_SUBST(POPPLER_PLUGIN_LIB, $POPPLER_PLUGIN_LIB)
+Index: /branches/2.2/gdal/frmts/pdf/GNUmakefile
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/GNUmakefile (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/GNUmakefile (revision 40036)
+@@ -32,4 +32,8 @@
+ endif
+
++ifeq ($(POPPLER_0_58_OR_LATER),yes)
++CPPFLAGS += -DPOPPLER_0_58_OR_LATER
++endif
++
+ ifeq ($(HAVE_PODOFO),yes)
+ CPPFLAGS += -DHAVE_PODOFO
+Index: /branches/2.2/gdal/frmts/pdf/makefile.vc
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/makefile.vc (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/makefile.vc (revision 40036)
+@@ -15,5 +15,5 @@
+
+ !IFDEF POPPLER_ENABLED
+-POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) -DHAVE_POPPLER
++POPPLER_EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) $(POPPLER_0_23_OR_LATER_FLAGS) $(POPPLER_0_58_OR_LATER_FLAGS) -DHAVE_POPPLER
+
+ !IFDEF POPPLER_HAS_OPTCONTENT
+@@ -31,4 +31,8 @@
+ !IFDEF POPPLER_0_23_OR_LATER
+ POPPLER_0_23_OR_LATER_FLAGS = -DPOPPLER_0_23_OR_LATER
++!ENDIF
++
++!IFDEF POPPLER_0_58_OR_LATER
++POPPLER_0_58_OR_LATER_FLAGS = -DPOPPLER_0_58_OR_LATER
+ !ENDIF
+
+Index: /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/pdfdataset.cpp (revision 40036)
+@@ -130,5 +130,9 @@
+ public:
+ ObjectAutoFree() {}
+- ~ObjectAutoFree() { obj.free(); }
++ ~ObjectAutoFree() {
++#ifndef POPPLER_0_58_OR_LATER
++ obj.free();
++#endif
++ }
+
+ Object* getObj() { return &obj; }
+@@ -2286,5 +2290,9 @@
+ {
+ poCatalogObjectPoppler = new ObjectAutoFree;
++#ifdef POPPLER_0_58_OR_LATER
++ *poCatalogObjectPoppler->getObj() = poDocPoppler->getXRef()->getCatalog();
++#else
+ poDocPoppler->getXRef()->getCatalog(poCatalogObjectPoppler->getObj());
++#endif
+ if (!poCatalogObjectPoppler->getObj()->isNull())
+ poCatalogObject = new GDALPDFObjectPoppler(poCatalogObjectPoppler->getObj(), FALSE);
+@@ -4027,5 +4035,9 @@
+ #ifdef HAVE_POPPLER
+ PDFDoc* poDocPoppler = NULL;
++#ifdef POPPLER_0_58_OR_LATER
++ Object oObj;
++#else
+ ObjectAutoFree oObj;
++#endif
+ Page* poPagePoppler = NULL;
+ Catalog* poCatalogPoppler = NULL;
+@@ -4074,6 +4086,10 @@
+ poUserPwd = new GooString(pszUserPwd);
+
++#ifdef POPPLER_0_58_OR_LATER
++ poDocPoppler = new PDFDoc(new VSIPDFFileStream(fp, pszFilename, std::move(oObj)), NULL, poUserPwd);
++#else
+ oObj.getObj()->initNull();
+ poDocPoppler = new PDFDoc(new VSIPDFFileStream(fp, pszFilename, oObj.getObj()), NULL, poUserPwd);
++#endif
+ delete poUserPwd;
+
+@@ -4766,8 +4782,14 @@
+ {
+ Object oInfo;
++#ifdef POPPLER_0_58_OR_LATER
++ oInfo = poDocPoppler->getDocInfo();
++#else
+ poDocPoppler->getDocInfo(&oInfo);
++#endif
+ GDALPDFObjectPoppler oInfoObjPoppler(&oInfo, FALSE);
+ poDS->ParseInfo(&oInfoObjPoppler);
++#ifndef POPPLER_0_58_OR_LATER
+ oInfo.free();
++#endif
+ }
+
+Index: /branches/2.2/gdal/frmts/pdf/pdfio.cpp
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/pdfio.cpp (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/pdfio.cpp (revision 40036)
+@@ -53,6 +53,10 @@
+
+ VSIPDFFileStream::VSIPDFFileStream(
+- VSILFILE* fIn, const char* pszFilename, Object *dictA) :
+-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
++ VSILFILE* fIn, const char* pszFilename,
++ makeSubStream_object_type dictA
++) :
++#ifdef POPPLER_0_58_OR_LATER
++ BaseStream(std::move(dictA), (Goffset)VSIPDFFileStreamGetSize(fIn)),
++#elif defined(POPPLER_BASE_STREAM_HAS_TWO_ARGS)
+ BaseStream(dictA, (setPos_offset_type)VSIPDFFileStreamGetSize(fIn)),
+ #else
+@@ -78,6 +82,9 @@
+ VSIPDFFileStream::VSIPDFFileStream( VSIPDFFileStream* poParentIn,
+ vsi_l_offset startA, GBool limitedA,
+- vsi_l_offset lengthA, Object *dictA ) :
+-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
++ vsi_l_offset lengthA,
++ makeSubStream_object_type dictA) :
++#ifdef POPPLER_0_58_OR_LATER
++ BaseStream(std::move(dictA), (Goffset)lengthA),
++#elif defined(POPPLER_BASE_STREAM_HAS_TWO_ARGS)
+ BaseStream(dictA, (makeSubStream_offset_type)lengthA),
+ #else
+@@ -116,5 +123,11 @@
+ /************************************************************************/
+
+-#ifdef POPPLER_0_23_OR_LATER
++#ifdef POPPLER_0_58_OR_LATER
++BaseStream* VSIPDFFileStream::copy()
++{
++ return new VSIPDFFileStream(poParent, nStart, bLimited,
++ nLength, dict.copy());
++}
++#elif defined(POPPLER_0_23_OR_LATER)
+ BaseStream* VSIPDFFileStream::copy()
+ {
+@@ -127,11 +140,16 @@
+ /* makeSubStream() */
+ /************************************************************************/
+-
+ Stream *VSIPDFFileStream::makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
+- makeSubStream_offset_type lengthA, Object *dictA)
+-{
++ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA)
++{
++#ifdef POPPLER_0_58_OR_LATER
++ return new VSIPDFFileStream(this,
++ startA, limitedA,
++ lengthA, std::move(dictA));
++#else
+ return new VSIPDFFileStream(this,
+ startA, limitedA,
+ lengthA, dictA);
++#endif
+ }
+
+Index: /branches/2.2/gdal/frmts/pdf/pdfio.h
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/pdfio.h (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/pdfio.h (revision 40036)
+@@ -53,11 +53,19 @@
+ #endif
+
++#ifdef POPPLER_0_58_OR_LATER
++#define makeSubStream_object_type Object&&
++#else
++#define makeSubStream_object_type Object*
++#endif
++
+ class VSIPDFFileStream: public BaseStream
+ {
+ public:
+- VSIPDFFileStream(VSILFILE* f, const char* pszFilename, Object *dictA);
++ VSIPDFFileStream(VSILFILE* f, const char* pszFilename,
++ makeSubStream_object_type dictA);
+ VSIPDFFileStream(VSIPDFFileStream* poParent,
+ vsi_l_offset startA, GBool limitedA,
+- vsi_l_offset lengthA, Object *dictA);
++ vsi_l_offset lengthA,
++ makeSubStream_object_type dictA);
+ virtual ~VSIPDFFileStream();
+
+@@ -67,5 +75,5 @@
+
+ virtual Stream * makeSubStream(makeSubStream_offset_type startA, GBool limitedA,
+- makeSubStream_offset_type lengthA, Object *dictA) override;
++ makeSubStream_offset_type lengthA, makeSubStream_object_type dictA) override;
+ virtual getPos_ret_type getPos() override;
+ virtual getStart_ret_type getStart() override;
+Index: /branches/2.2/gdal/frmts/pdf/pdfobject.cpp
+===================================================================
+--- /branches/2.2/gdal/frmts/pdf/pdfobject.cpp (revision 40035)
++++ /branches/2.2/gdal/frmts/pdf/pdfobject.cpp (revision 40036)
+@@ -972,5 +972,7 @@
+ GDALPDFObjectPoppler::~GDALPDFObjectPoppler()
+ {
++#ifndef POPPLER_0_58_OR_LATER
+ m_po->free();
++#endif
+ if (m_bDestroy)
+ delete m_po;
+@@ -1183,4 +1185,33 @@
+ return oIter->second;
+
++#ifdef POPPLER_0_58_OR_LATER
++ Object o = m_poDict->lookupNF(((char*)pszKey));
++ if (!o.isNull())
++ {
++ int nRefNum = 0;
++ int nRefGen = 0;
++ if( o.isRef())
++ {
++ nRefNum = o.getRefNum();
++ nRefGen = o.getRefGen();
++ Object o2 = m_poDict->lookup((char*)pszKey);
++ if( !o2.isNull() )
++ {
++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
++ poObj->SetRefNumAndGen(nRefNum, nRefGen);
++ m_map[pszKey] = poObj;
++ return poObj;
++ }
++ }
++ else
++ {
++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
++ poObj->SetRefNumAndGen(nRefNum, nRefGen);
++ m_map[pszKey] = poObj;
++ return poObj;
++ }
++ }
++ return NULL;
++#else
+ Object* po = new Object;
+ if (m_poDict->lookupNF((char*)pszKey, po) && !po->isNull())
+@@ -1211,4 +1242,5 @@
+ return NULL;
+ }
++#endif
+ }
+
+@@ -1287,4 +1319,33 @@
+ return m_v[nIndex];
+
++#ifdef POPPLER_0_58_OR_LATER
++ Object o = m_poArray->getNF(nIndex);
++ if( !o.isNull() )
++ {
++ int nRefNum = 0;
++ int nRefGen = 0;
++ if( o.isRef())
++ {
++ nRefNum = o.getRefNum();
++ nRefGen = o.getRefGen();
++ Object o2 = m_poArray->get(nIndex);
++ if( !o2.isNull() )
++ {
++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o2)), TRUE);
++ poObj->SetRefNumAndGen(nRefNum, nRefGen);
++ m_v[nIndex] = poObj;
++ return poObj;
++ }
++ }
++ else
++ {
++ GDALPDFObjectPoppler* poObj = new GDALPDFObjectPoppler(new Object(std::move(o)), TRUE);
++ poObj->SetRefNumAndGen(nRefNum, nRefGen);
++ m_v[nIndex] = poObj;
++ return poObj;
++ }
++ }
++ return NULL;
++#else
+ Object* po = new Object;
+ if (m_poArray->getNF(nIndex, po))
+@@ -1315,4 +1376,5 @@
+ return NULL;
+ }
++#endif
+ }
+
+Index: /branches/2.2/gdal/nmake.opt
+===================================================================
+--- /branches/2.2/gdal/nmake.opt (revision 40035)
++++ /branches/2.2/gdal/nmake.opt (revision 40036)
+@@ -622,4 +622,5 @@
+ # Uncomment POPPLER_0_20_OR_LATER = YES for Poppler >= 0.20.0
+ # Uncomment POPPLER_0_23_OR_LATER = YES for Poppler >= 0.23.0
++# Uncomment POPPLER_0_58_OR_LATER = YES for Poppler >= 0.58.0
+ #POPPLER_ENABLED = YES
+ #POPPLER_CFLAGS = -Ie:/kde/include -Ie:/kde/include/poppler
+@@ -628,4 +629,5 @@
+ #POPPLER_0_20_OR_LATER = YES
+ #POPPLER_0_23_OR_LATER = YES
++#POPPLER_0_58_OR_LATER = YES
+ #POPPLER_LIBS = e:/kde/lib/poppler.lib e:/kde/lib/freetype.lib e:/kde/lib/liblcms-1.lib advapi32.lib gdi32.lib
+
diff --git a/gdal-perl-vendor.patch b/gdal-perl-vendor.patch
new file mode 100644
index 000000000000..a0bc27d10ca8
--- /dev/null
+++ b/gdal-perl-vendor.patch
@@ -0,0 +1,28 @@
+Description: pass INSTALLDIRS=vendor to Makefile.PL to get stuff into the right place
+Origin: vendor
+Forwarded: not-needed
+Author: gregor herrmann <gregoa@debian.org>
+Last-Update: 2014-07-08
+
+--- a/swig/perl/Makefile
++++ b/swig/perl/Makefile
+@@ -7,7 +7,7 @@ build: Makefile_Geo__GDAL
+ $(MAKE) -f Makefile_Geo__OSR
+
+ Makefile_Geo__GDAL:
+- perl Makefile.PL INSTALL_BASE=$(INST_PREFIX)
++ perl Makefile.PL INSTALLDIRS=vendor
+
+ test: build
+ $(MAKE) -f Makefile_Geo__GDAL test
+--- a/swig/perl/GNUmakefile
++++ b/swig/perl/GNUmakefile
+@@ -30,7 +30,7 @@ build: gdal_wrap.cc Makefile_Geo__GDAL
+ gdal_wrap.cc: generate
+
+ Makefile_Geo__GDAL:
+- perl Makefile.PL INSTALL_BASE=$(INST_PREFIX)
++ perl Makefile.PL INSTALLDIRS=vendor
+
+ test: build
+ $(MAKE) -f Makefile_Geo__GDAL test