# Template file for 'libgdal'
pkgname=libgdal
version=3.0.4
revision=10
wrksrc="gdal-${version}"
build_style=gnu-configure
configure_args="--with-liblzma --with-webp --with-zstd --with-podofo --with-opencl=yes"
hostmakedepends="gettext-devel pkg-config python-numpy json-c-devel"
makedepends="freexl-devel geos-devel jasper-devel json-c-devel
 libcurl-devel libopenexr-devel libopenjpeg2-devel libpodofo-devel libqhull-devel
 libwebp-devel libxml2-devel libzstd-devel netcdf-devel opencl2-headers pcre2-devel
 proj-devel sqlite-devel ocl-icd-devel"
short_desc="Geospatial Data Abstraction Library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="http://www.gdal.org/"
distfiles="http://download.osgeo.org/gdal/${version}/gdal-${version}.tar.xz"
checksum=5569a4daa1abcbba47a9d535172fc335194d9214fdb96cd0f139bb57329ae277
subpackages="libgdal-devel libgdal-tools"

if [ -z "$CROSS_BUILD" ]; then
	makedepends+=" hdf5-devel"
fi

post_install() {
	vinstall gdal.pc 644 usr/lib/pkgconfig
	vlicense LICENSE.TXT
}

libgdal-tools_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - tools"
	pkg_install() {
		vmove usr/bin
	}
}

libgdal-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/bin/gdal-config
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/*.a
		vmove usr/lib/*.so
	}
}
