1 # Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
2 # Maintainer: Bruno Pagani <archange@archlinux.org>
3 # Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
4 # Contributor: William Rea <sillywilly@gmail.com>
7 pkgname=(gdal python-gdal)
10 pkgdesc="A translator library for raster and vector geospatial data formats"
12 url="https://gdal.org/"
14 makedepends=(cmake opencl-headers python-setuptools python-numpy
15 proj arrow blosc cfitsio curl crypto++ libdeflate expat libfreexl
16 libgeotiff geos giflib libheif hdf5 libjpeg-turbo json-c libjxl xz
17 libxml2 lz4 mariadb-libs netcdf unixodbc ocl-icd openexr openjpeg2
18 openssl pcre2 libpng podofo poppler postgresql-libs qhull
19 libspatialite sqlite swig libtiff libwebp xerces-c zlib zstd)
20 # armadillo basisu brunsli lerc libkml qb3 rasterlite2 sfcgal tiledb
22 changelog=$pkgbase.changelog
23 source=(https://download.osgeo.org/${pkgbase}/${pkgver}/${pkgbase}-${pkgver}.tar.xz)
24 b2sums=('400cc17fc636c637f7c40e93aed8e2db7bfbbe73741da4135cfeec8dbcda24ce0c8035214edf038afc29a916012da86a78d789729540f870231dfa6aa27e424a')
27 cmake -B build -S $pkgbase-$pkgver \
28 -DCMAKE_INSTALL_PREFIX=/usr \
29 -DCMAKE_CXX_STANDARD=17 \
31 -DBUILD_PYTHON_BINDINGS=ON \
32 -DGDAL_ENABLE_PLUGINS=ON \
35 -DGDAL_USE_CFITSIO=ON \
37 -DGDAL_USE_CRYPTOPP=ON \
38 -DGDAL_USE_DEFLATE=ON \
40 -DGDAL_USE_FREEXL=ON \
41 -DGDAL_USE_GEOTIFF=ON \
50 -DGDAL_USE_LIBLZMA=ON \
51 -DGDAL_USE_LIBXML2=ON \
54 -DGDAL_USE_NETCDF=ON \
56 -DGDAL_USE_OPENCL=ON \
57 -DGDAL_USE_OPENEXR=ON \
58 -DGDAL_USE_OPENJPEG=ON \
59 -DGDAL_USE_OPENSSL=ON \
60 -DGDAL_USE_PARQUET=ON \
63 -DGDAL_USE_POPPLER=ON \
64 -DGDAL_USE_POSTGRESQL=ON \
66 -DGDAL_USE_SPATIALITE=ON \
67 -DGDAL_USE_SQLITE3=ON \
70 -DGDAL_USE_XERCESC=ON \
77 depends=(proj blosc crypto++ curl libdeflate expat libfreexl geos libgeotiff
78 giflib libjpeg-turbo json-c xz libxml2 lz4 unixodbc ocl-icd openssl
79 pcre2 libpng qhull libspatialite sqlite libtiff xerces-c zlib zstd)
80 optdepends=('arrow: Arrow/Parquet support'
81 'cfitsio: FITS support'
83 'libheif: HEIF support'
84 'libjxl: JPEG XL support'
85 'mariadb-libs: MySQL support'
86 'netcdf: netCDF support'
87 'openexr: EXR support'
88 'openjpeg2: JP2 support'
90 'poppler: PDF support'
91 'postgresql-libs: PostgreSQL support'
92 'libwebp: WebP support')
94 make -C build DESTDIR="${pkgdir}" install
95 install -Dm644 ${pkgname}-${pkgver}/LICENSE.TXT -t "${pkgdir}"/usr/share/licenses/$pkgbase/
98 mv "${pkgdir}"/usr/bin/*py bin
99 mv "${pkgdir}"/usr/lib/python* lib
102 package_python-gdal () {
103 pkgdesc="Python bindings for GDAL"
104 depends=("gdal=$pkgver" 'python-numpy')
106 install -d "${pkgdir}"/usr/{bin,lib}
107 mv bin/* "${pkgdir}"/usr/bin
108 mv lib/* "${pkgdir}"/usr/lib
109 install -dm755 "${pkgdir}"/usr/share/licenses
110 ln -s $pkgbase "${pkgdir}"/usr/share/licenses/$pkgname
111 # byte-compile python modules since the CMake build does not do it.
112 local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
113 python -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -s "${pkgdir}" "${pkgdir}"${site_packages}