PKGBUILDs/community/gdal/PKGBUILD
2022-05-21 09:38:57 +00:00

90 lines
3.1 KiB
Bash

# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
# Contributor: William Rea <sillywilly@gmail.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - set -std=c++17 for poppler
# - set -D_OFF_T for 32-bit since the macros aren't working right
pkgbase=gdal
pkgname=('gdal' 'python-gdal')
pkgver=3.4.3
pkgrel=1
pkgdesc="A translator library for raster geospatial data formats"
arch=('x86_64')
url="https://gdal.org/"
license=('custom')
depends=('curl' 'geos' 'giflib' 'hdf5' 'libgeotiff' 'libjpeg-turbo' 'libpng' 'libspatialite' 'libtiff' 'netcdf'
'openjpeg2' 'poppler' 'cfitsio' 'sqlite' 'mariadb-libs' 'postgresql-libs' 'xerces-c' 'json-c')
makedepends=('perl' 'swig' 'chrpath' 'doxygen' 'python-breathe' 'python-numpy' 'python-sphinx' 'boost')
optdepends=('postgresql: postgresql database support'
'mariadb: mariadb database support'
'perl: perl binding support')
options=('!emptydirs')
changelog=$pkgbase.changelog
source=(https://download.osgeo.org/${pkgbase}/${pkgver}/${pkgbase}-${pkgver}.tar.xz
gdal-perl-vendor.patch)
sha256sums=('02a27b35899e1c4c3bcb6007da900128ddd7e8ab7cd6ccfecf338a301eadad5a'
'2103b98f2f15954f042d5620658b30d703125927bde2e5eb671c5facb6c2f5ed')
prepare() {
cd "${srcdir}"/$pkgbase-$pkgver
# Fix mandir
sed -i "s|^mandir=.*|mandir='\${prefix}/share/man'|" configure
# Fix Perl bindings installation path
patch -Np0 -i "${srcdir}"/gdal-perl-vendor.patch
}
build() {
cd "${srcdir}"/$pkgbase-$pkgver
CXXFLAGS+=" -std=c++17"
[[ $CARCH != "aarch64" ]] && CPPFLAGS+=" -D_OFF_T"
./configure --prefix=/usr --with-netcdf --with-libtiff --with-sqlite3 --with-geotiff \
--with-mysql --with-curl --with-hdf5 --with-perl --with-geos \
--with-png --with-poppler --with-spatialite --with-openjpeg
# 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
make
make man
cd "${srcdir}"/$pkgbase-$pkgver/swig/python
python setup.py build
}
package_gdal () {
cd "${srcdir}"/$pkgbase-$pkgver
make DESTDIR="${pkgdir}" install
make DESTDIR="${pkgdir}" install-man
# install license
install -Dm644 LICENSE.TXT "${pkgdir}"/usr/share/licenses/$pkgbase/LICENSE
# Remove RPATH
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
}
package_python-gdal () {
pkgdesc="Python bindings for GDAL"
depends=("gdal=$pkgver" 'python-numpy')
optdepends=()
cd "${srcdir}"/$pkgbase-$pkgver/swig/python
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
# install -Dm755 -t "${pkgdir}"/usr/bin scripts/*.py
install -dm755 "${pkgdir}"/usr/share/licenses
ln -s $pkgbase "${pkgdir}"/usr/share/licenses/$pkgname
}