-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
190 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
270 changes: 189 additions & 81 deletions
270
scripts/install_geospatial_unstable.sh
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,191 @@ | ||
#!/bin/bash | ||
|
||
GDAL_VERSION=3.1.2 | ||
GEOS_VERSION=3.8.0 | ||
PROJ_VERSION=7.1.0 | ||
#LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
|
||
## | ||
# ADAPTED FROM: osgeo/gdal:ubuntu-full | ||
# https://github.com/OSGeo/gdal/blob/master/gdal/docker/ubuntu-full/Dockerfile | ||
# This file is available at the option of the licensee under: | ||
# Public domain | ||
# or licensed under X/MIT (LICENSE.TXT) Copyright 2019 Even Rouault <[email protected]> | ||
|
||
|
||
# Derived from osgeo/proj by Howard Butler <[email protected]> | ||
# Derived from osgeo/gdal by Even Rouault <[email protected]> | ||
|
||
# Setup build env for PROJ | ||
apt-get update -y \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \ | ||
software-properties-common build-essential ca-certificates \ | ||
git make cmake wget unzip libtool automake \ | ||
zlib1g-dev libsqlite3-dev pkg-config sqlite3 libcurl4-gnutls-dev \ | ||
libtiff5-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Setup build env for GDAL | ||
apt-get update -y \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \ | ||
libcharls-dev libopenjp2-7-dev libcairo2-dev \ | ||
python3-dev python3-numpy \ | ||
libpng-dev libjpeg-dev libgif-dev liblzma-dev libgeos-dev \ | ||
curl libxml2-dev libexpat-dev libxerces-c-dev \ | ||
libnetcdf-dev libpoppler-dev libpoppler-private-dev \ | ||
libspatialite-dev swig libhdf4-alt-dev libhdf5-serial-dev \ | ||
libfreexl-dev unixodbc-dev libwebp-dev libepsilon-dev \ | ||
liblcms2-2 libpcre3-dev libcrypto++-dev libdap-dev libfyba-dev \ | ||
libkml-dev libmysqlclient-dev libogdi-dev \ | ||
libcfitsio-dev openjdk-8-jdk libzstd-dev \ | ||
libpq-dev libssl-dev libboost-dev \ | ||
autoconf automake bash-completion libarmadillo-dev \ | ||
libopenexr-dev libheif-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Build likbkea | ||
KEA_VERSION=1.4.13 | ||
wget -q https://github.com/ubarsc/kealib/archive/kealib-${KEA_VERSION}.zip \ | ||
&& unzip -q kealib-${KEA_VERSION}.zip \ | ||
&& rm -f kealib-${KEA_VERSION}.zip \ | ||
&& cd kealib-kealib-${KEA_VERSION} \ | ||
&& cmake . -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=/usr -DHDF5_INCLUDE_DIR=/usr/include/hdf5/serial \ | ||
-DHDF5_LIB_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial -DLIBKEA_WITH_GDAL=OFF \ | ||
&& make -j$(nproc) \ | ||
&& make install DESTDIR="/build_thirdparty" \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& rm -rf kealib-kealib-${KEA_VERSION} \ | ||
&& for i in /build_thirdparty/usr/lib/*; do strip -s $i 2>/dev/null || /bin/true; done \ | ||
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done | ||
|
||
# Build mongo-c-driver | ||
MONGO_C_DRIVER_VERSION=1.16.2 | ||
mkdir mongo-c-driver \ | ||
&& wget -q https://github.com/mongodb/mongo-c-driver/releases/download/${MONGO_C_DRIVER_VERSION}/mongo-c-driver-${MONGO_C_DRIVER_VERSION}.tar.gz -O - \ | ||
| tar xz -C mongo-c-driver --strip-components=1 \ | ||
&& cd mongo-c-driver \ | ||
&& mkdir build_cmake \ | ||
&& cd build_cmake \ | ||
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_TESTS=NO -DCMAKE_BUILD_TYPE=Release \ | ||
&& make -j$(nproc) \ | ||
&& make install DESTDIR="/build_thirdparty" \ | ||
&& make install \ | ||
&& cd ../.. \ | ||
&& rm -rf mongo-c-driver \ | ||
&& rm /build_thirdparty/usr/lib/x86_64-linux-gnu/*.a \ | ||
&& for i in /build_thirdparty/usr/lib/x86_64-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \ | ||
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done | ||
|
||
# Build mongocxx | ||
MONGOCXX_VERSION=3.5.0 | ||
mkdir mongocxx \ | ||
&& wget -q https://github.com/mongodb/mongo-cxx-driver/archive/r${MONGOCXX_VERSION}.tar.gz -O - \ | ||
| tar xz -C mongocxx --strip-components=1 \ | ||
&& cd mongocxx \ | ||
&& mkdir build_cmake \ | ||
&& cd build_cmake \ | ||
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBSONCXX_POLY_USE_BOOST=ON -DMONGOCXX_ENABLE_SLOW_TESTS=NO -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION=${MONGOCXX_VERSION} \ | ||
&& make -j$(nproc) \ | ||
&& make install DESTDIR="/build_thirdparty" \ | ||
&& make install \ | ||
&& cd ../.. \ | ||
&& rm -rf mongocxx \ | ||
&& for i in /build_thirdparty/usr/lib/x86_64-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \ | ||
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done | ||
|
||
# Build tiledb | ||
TILEDB_VERSION=2.0.8 | ||
mkdir tiledb \ | ||
&& wget -q https://github.com/TileDB-Inc/TileDB/archive/${TILEDB_VERSION}.tar.gz -O - \ | ||
| tar xz -C tiledb --strip-components=1 \ | ||
&& cd tiledb \ | ||
&& mkdir build_cmake \ | ||
&& cd build_cmake \ | ||
&& ../bootstrap --prefix=/usr \ | ||
&& make -j$(nproc) \ | ||
&& make install-tiledb DESTDIR="/build_thirdparty" \ | ||
&& make install-tiledb \ | ||
&& cd ../.. \ | ||
&& rm -rf tiledb \ | ||
&& for i in /build_thirdparty/usr/lib/x86_64-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \ | ||
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done | ||
|
||
# Build openjpeg | ||
OPENJPEG_VERSION= | ||
if test "${OPENJPEG_VERSION}" != ""; then ( \ | ||
wget -q https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz \ | ||
&& tar xzf v${OPENJPEG_VERSION}.tar.gz \ | ||
&& rm -f v${OPENJPEG_VERSION}.tar.gz \ | ||
&& cd openjpeg-${OPENJPEG_VERSION} \ | ||
&& cmake . -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=/usr \ | ||
&& make -j$(nproc) \ | ||
&& make install \ | ||
&& mkdir -p /build_thirdparty/usr/lib/x86_64-linux-gnu \ | ||
&& rm -f /usr/lib/x86_64-linux-gnu/libopenjp2.so* \ | ||
&& mv /usr/lib/libopenjp2.so* /usr/lib/x86_64-linux-gnu \ | ||
&& cp -P /usr/lib/x86_64-linux-gnu/libopenjp2.so* /build_thirdparty/usr/lib/x86_64-linux-gnu \ | ||
&& for i in /build_thirdparty/usr/lib/x86_64-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \ | ||
&& cd .. \ | ||
&& rm -rf openjpeg-${OPENJPEG_VERSION} \ | ||
); fi | ||
|
||
apt-get update -y \ | ||
&& apt-get install -y --fix-missing --no-install-recommends rsync ccache \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RSYNC_REMOTE | ||
|
||
WITH_DEBUG_SYMBOLS=no | ||
|
||
# Build PROJ | ||
PROJ_VERSION=master | ||
PROJ_INSTALL_PREFIX=/usr/local | ||
/rocker_scripts/bh-proj.sh | ||
|
||
GDAL_VERSION=master | ||
GDAL_RELEASE_DATE | ||
GDAL_BUILD_IS_RELEASE | ||
|
||
# Build GDAL | ||
/rocker_scripts/bh-gdal.sh | ||
|
||
|
||
date | ||
|
||
apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
lbzip2 \ | ||
libdap-dev \ | ||
libexpat1-dev \ | ||
libfftw3-dev \ | ||
libfreexl-dev \ | ||
libgsl0-dev \ | ||
libglu1-mesa-dev \ | ||
libhdf4-alt-dev \ | ||
libhdf5-dev \ | ||
libkml-dev \ | ||
libnetcdf-dev \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
libtcl8.6 \ | ||
libtk8.6 \ | ||
libtiff5-dev \ | ||
libudunits2-dev \ | ||
libxerces-c-dev \ | ||
unixodbc-dev | ||
|
||
wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz | ||
tar -xf gdal-${GDAL_VERSION}.tar.gz | ||
rm gdal-${GDAL_VERSION}.tar.gz | ||
|
||
wget http://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2 | ||
tar -xf geos-${GEOS_VERSION}.tar.bz2 | ||
rm geos-${GEOS_VERSION}.tar.bz2 | ||
|
||
wget http://download.osgeo.org/proj/proj-${PROJ_VERSION}.tar.gz | ||
tar -xf proj-${PROJ_VERSION}.tar.gz | ||
rm proj-${PROJ_VERSION}.tar.gz | ||
|
||
|
||
## Install proj | ||
cd /proj* | ||
./configure | ||
make | ||
make install | ||
|
||
|
||
|
||
## Install libgeos | ||
cd /geos* | ||
./configure | ||
make | ||
make install | ||
|
||
## Configure options loosely based on homebrew gdal2 https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/gdal2.rb | ||
cd /gdal* | ||
./configure \ | ||
--with-curl \ | ||
--with-dods-root=/usr \ | ||
--with-freexl \ | ||
--with-geos \ | ||
--with-geotiff \ | ||
--with-hdf4 \ | ||
--with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial \ | ||
--with-libjson-c \ | ||
--with-netcdf \ | ||
--with-odbc \ | ||
--without-grass \ | ||
--without-libgrass | ||
make | ||
make install | ||
|
||
cd .. | ||
## Cleanup gdal & geos installation | ||
rm -rf gdal-* geos-* | ||
|
||
CRAN_SOURCE=`echo ${CRAN} | sed s/__linux__\/focal/` | ||
install2.r -e -r $CRAN_SOURCE lwgeom rgdal rgeos proj4 sf stars | ||
|
||
|
||
# PROJ dependencies | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
libsqlite3-0 libtiff5 libcurl4 \ | ||
wget curl unzip ca-certificates \ | ||
# GDAL dependencies | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
libcharls2 libopenjp2-7 libcairo2 python3-numpy \ | ||
libpng16-16 libjpeg-turbo8 libgif7 liblzma5 libgeos-3.8.0 libgeos-c1v5 \ | ||
libxml2 libexpat1 \ | ||
libxerces-c3.2 libnetcdf-c++4 netcdf-bin libpoppler97 libspatialite7 gpsbabel \ | ||
libhdf4-0-alt libhdf5-103 libhdf5-cpp-103 poppler-utils libfreexl1 unixodbc libwebp6 \ | ||
libepsilon1 liblcms2-2 libpcre3 libcrypto++6 libdap25 libdapclient6v5 libfyba0 \ | ||
libkmlbase1 libkmlconvenience1 libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1 \ | ||
libmysqlclient21 libogdi4.1 libcfitsio8 openjdk-8-jre \ | ||
libzstd1 bash bash-completion libpq5 libssl1.1 \ | ||
libarmadillo9 libpython3.8 libopenexr24 libheif1 \ | ||
python-is-python3 \ | ||
# Workaround bug in ogdi packaging | ||
&& ln -s /usr/lib/ogdi/libvrf.so /usr/lib \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## Attempt to order layers starting with less frequently varying ones | ||
# | ||
#COPY --from=builder /build_thirdparty/usr/ /usr/ | ||
# | ||
#PROJ_DATUMGRID_LATEST_LAST_MODIFIED | ||
#PROJ_INSTALL_PREFIX=/usr/local | ||
#COPY --from=builder /build${PROJ_INSTALL_PREFIX}/share/proj/ ${PROJ_INSTALL_PREFIX}/share/proj/ | ||
#COPY --from=builder /build${PROJ_INSTALL_PREFIX}/include/ ${PROJ_INSTALL_PREFIX}/include/ | ||
#COPY --from=builder /build${PROJ_INSTALL_PREFIX}/bin/ ${PROJ_INSTALL_PREFIX}/bin/ | ||
#COPY --from=builder /build${PROJ_INSTALL_PREFIX}/lib/ ${PROJ_INSTALL_PREFIX}/lib/ | ||
#ldconfig \ | ||
# && projsync --system-directory --all | ||
# | ||
#COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/ | ||
#COPY --from=builder /build/usr/include/ /usr/include/ | ||
#COPY --from=builder /build_gdal_python/usr/ /usr/ | ||
#COPY --from=builder /build_gdal_version_changing/usr/ /usr/ | ||
# | ||
#ldconfig | ||
# |