# Template file for 'grass'
pkgname=grass
version=8.3.0
revision=2
build_style=gnu-configure
configure_args="--prefix=/usr/lib --enable-shared --without-pdal
 --with-bzlib --with-nls --with-pthread --with-readline --with-geos
 --with-blas --with-lapack --with-netcdf --with-odbc --with-openmp
 --with-freetype-includes=${XBPS_CROSS_BASE}/usr/include/freetype2"
hostmakedepends="flex gettext libgdal-tools pkg-config python3-numpy python3-six
 tar"
makedepends="proj-devel tiff-devel libgdal-devel sqlite-devel fftw-devel
 cairo-devel glu-devel libzstd-devel bzip2-devel geos-devel gettext-devel
 readline-devel lapack-devel blas-devel netcdf-devel unixodbc-devel libgomp-devel
 wxPython"
depends="python3-numpy python3-dateutil python3-Pillow python3-matplotlib
 python3-six python3-ply wxPython"
short_desc="Geographic Resources Analysis Support System - GIS"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://grass.osgeo.org/"
distfiles="https://github.com/OSGeo/grass/archive/refs/tags/${version}.tar.gz"
checksum=8a38d297a41316ec0af1e4b4f8d00738f1fd98be768b8c6001b00e88817a2764
nocross="tries to execute target binaries"
# 98-shlib-provides hook doesn't detect shlibs versioned before .so
shlib_provides="
 libgrass_datetime.8.3.so
 libgrass_dbmibase.8.3.so
 libgrass_dbmiclient.8.3.so
 libgrass_gis.8.3.so
 libgrass_gmath.8.3.so
 libgrass_gproj.8.3.so
 libgrass_imagery.8.3.so
 libgrass_raster.8.3.so
 libgrass_vector.8.3.so"

post_install() {
	vinstall grass.pc 644 usr/lib/pkgconfig
}

grass-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/lib/grass/include"
		vmove usr/lib/pkgconfig
		while read -r file; do
			vmove "${file/$DESTDIR/}"
		done < <(find "${DESTDIR}/usr/lib/grass/lib" -type l)
	}
}
