rasterio/scripts/travis_gdal_install.sh
Sean Gillies 36786d5886
GDAL 3.0.x support in code but not wheels (#1729)
* Added support for Proj6 and GDAL 3

* install proj6

* build proj with local installation dir

* conditional proj dependency

* added proj4 flags for all gdal versions

* Restore debian data tests

* Version specific proj configuration

* Fix string comp expression

* Explicit matrix

* Restructure build matrix

* Remove wait from proj build script

* Call script with bash

* Fix version text

* Bash syntax

* Correct PROJOPTs

* Use xvfb service

* Back to proj 4.8 for older GDAL

* Fix syntax error

* Add verbosity to tests

* Take proj off library path, remove gdal-bin package

* Install PROJ and GDAL to same prefix

* Set up runtime env

* Try 4.9.3

* Source build scripts

* Switch to case for versions

* set trace

* Test existence of share/gdal directory

The proj install script created the gdal install directory so a
test for just that is not sufficient.

* Test for share/proj

* Run tests under gdb

* Forgot the run command

* Wait 20 for GDAL

* travis_wait

* Restructure build script, less boilerplate

* Back to trusty

* dist: trusty

* Remove gdb

* Allow 3.0.1/6.1.1 to fail, some changes since 3.0.0/6.1.0
2019-07-26 13:46:55 -06:00

115 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
#
# originally contributed by @rbuffat to Toblerity/Fiona
set -e
GDALOPTS=" --with-geos \
--with-expat \
--without-libtool \
--with-libz=internal \
--with-libtiff=internal \
--with-geotiff=internal \
--without-gif \
--without-pg \
--without-grass \
--without-libgrass \
--without-cfitsio \
--without-pcraster \
--with-netcdf \
--with-png=internal \
--with-jpeg=internal \
--without-gif \
--without-ogdi \
--without-fme \
--without-hdf4 \
--with-hdf5 \
--without-jasper \
--without-ecw \
--without-kakadu \
--without-mrsid \
--without-jp2mrsid \
--without-bsb \
--without-grib \
--without-mysql \
--without-ingres \
--without-xerces \
--without-odbc \
--with-curl \
--without-sqlite3 \
--without-idb \
--without-sde \
--without-perl \
--without-python"
# Create build dir if not exists
if [ ! -d "$GDALBUILD" ]; then
mkdir $GDALBUILD;
fi
if [ ! -d "$GDALINST" ]; then
mkdir $GDALINST;
fi
ls -l $GDALINST
if [ "$GDALVERSION" = "master" ]; then
PROJOPT="--with-proj=$GDALINST/gdal-$GDALVERSION"
cd $GDALBUILD
git clone --depth 1 https://github.com/OSGeo/gdal gdal-$GDALVERSION
cd gdal-$GDALVERSION/gdal
git rev-parse HEAD > newrev.txt
BUILD=no
# Only build if nothing cached or if the GDAL revision changed
if test ! -f $GDALINST/gdal-$GDALVERSION/rev.txt; then
BUILD=yes
elif ! diff newrev.txt $GDALINST/gdal-$GDALVERSION/rev.txt >/dev/null; then
BUILD=yes
fi
if test "$BUILD" = "yes"; then
mkdir -p $GDALINST/gdal-$GDALVERSION
cp newrev.txt $GDALINST/gdal-$GDALVERSION/rev.txt
./configure --prefix=$GDALINST/gdal-$GDALVERSION $GDALOPTS $PROJOPT
make -s -j 2
make install
fi
else
case "$GDALVERSION" in
3*)
PROJOPT="--with-proj=$GDALINST/gdal-$GDALVERSION"
;;
2.4*)
PROJOPT="--with-proj=$GDALINST/gdal-$GDALVERSION"
;;
2.3*)
PROJOPT="--with-proj=$GDALINST/gdal-$GDALVERSION"
;;
2.2*)
PROJOPT="--with-static-proj4=$GDALINST/gdal-$GDALVERSION"
;;
2.1*)
PROJOPT="--with-static-proj4=$GDALINST/gdal-$GDALVERSION"
;;
2.0*)
PROJOPT="--with-static-proj4=$GDALINST/gdal-$GDALVERSION"
;;
1*)
PROJOPT="--with-static-proj4=$GDALINST/gdal-$GDALVERSION"
;;
esac
if [ ! -d "$GDALINST/gdal-$GDALVERSION/share/gdal" ]; then
cd $GDALBUILD
gdalver=$(expr "$GDALVERSION" : '\([0-9]*.[0-9]*.[0-9]*\)')
wget -q http://download.osgeo.org/gdal/$gdalver/gdal-$GDALVERSION.tar.gz
tar -xzf gdal-$GDALVERSION.tar.gz
cd gdal-$gdalver
./configure --prefix=$GDALINST/gdal-$GDALVERSION $GDALOPTS $PROJOPT
make -s -j 2
make install
fi
fi
# change back to travis build dir
cd $TRAVIS_BUILD_DIR