aports/community/grass-gis/APKBUILD
2025-06-10 09:49:36 +00:00

260 lines
8.3 KiB
Text

# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
maintainer="Holger Jaekel <holger.jaekel@gmx.de>"
pkgname=grass-gis
pkgver=8.4.1
_shortver=${pkgver%.*}; _shortver=${_shortver/./}
pkgrel=1
pkgdesc="Geographic Resources Analysis Support System"
url="https://grass.osgeo.org"
arch="all !s390x" # s390x: tests fail
license="GPL-2.0-or-later"
depends_dev="
freetype-dev
gdal-dev
libpq-dev
proj-dev
"
makedepends="
$depends_dev
bison
bzip2-dev
cairo-dev
doxygen
fftw-dev
flex
font-urw-base35
geos-dev
gettext-dev
glu-dev
gnutls-dev
graphviz
grep
libjpeg-turbo-dev
libpng-dev
mariadb-connector-c-dev
mesa-dev
netcdf-dev
openblas-dev
opencl-dev
openjpeg-dev
pdal-dev
py3-numpy-dev
py3-wxpython
readline-dev
sqlite-dev
tiff-dev
unixodbc-dev
zlib-dev
zstd-dev
"
checkdepends="bash py3-pytest"
depends="proj-util py3-six"
subpackages="$pkgname-dev-doc:devdoc:noarch $pkgname-dev $pkgname-doc $pkgname-gui::noarch $pkgname-lang"
langdir="/usr/lib/grass$_shortver/locale"
source="https://grass.osgeo.org/grass$_shortver/source/grass-$pkgver.tar.gz
https://raw.githubusercontent.com/OSGeo/grass/refs/tags/$pkgver/.github/workflows/print_versions.sh
https://raw.githubusercontent.com/OSGeo/grass/refs/tags/$pkgver/.github/workflows/test_simple.sh
10-libintl.patch
20-openblas.patch
30-pkgconfig.patch
40-int64.patch
"
builddir="$srcdir/grass-$pkgver"
_use_pngquant=false
case "$CARCH" in
s390x|riscv64) ;;
*)
makedepends="$makedepends pngquant"
_use_pngquant=true
;;
esac
build() {
# Ancient autoconf used upstream can't handle CPPFLAGS correctly, so set CPP to ignore warnings
CPP="gcc -E -w" \
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr/lib \
--enable-largefile \
--with-cxx \
--with-tiff \
--with-libpng \
--with-postgres \
--with-postgres-includes=/usr/include/postgresql \
--with-mysql \
--with-mysql-includes=/usr/include/mysql/ \
--with-sqlite \
--with-opengl \
--with-odbc \
--with-fftw \
--with-blas \
--with-lapack \
--with-cairo \
--with-cairo-ldflags=-lfontconfig \
--with-freetype \
--with-nls \
--with-readline \
--without-opendwg \
--with-regex \
--with-pthread \
--with-openmp \
--with-opencl \
--with-bzlib \
--with-zstd \
--with-gdal \
--with-pdal \
--with-netcdf \
--with-geos \
--with-x
LC_ALL=C make
# generate the Programmers' manual (in HTML)
make htmldocs-single
# save ~4mb of disk space by compressing PNG images (but takes a long time)
if [ "$_use_pngquant" = true ]; then
find lib/html -iname \*.png -print0 | xargs -0 -n 1 -P ${JOBS:-2} pngquant --speed 1 --force --ext .png
fi
}
check() {
export PYTHONPATH="$builddir/$(ls -d dist.*)/etc/python:$PYTHONPATH"
export LD_LIBRARY_PATH="$builddir/$(ls -d dist.*)/lib:$LD_LIBRARY_PATH"
export PATH="$builddir/$(ls -d bin.*):$PATH"
chmod a+x $srcdir/print_versions.sh $srcdir/test_simple.sh
$srcdir/print_versions.sh
$srcdir/test_simple.sh
local _skipped_tests='
not test_aggregate_methods
and not test_aggregate_two_columns
and not test_aggregate_column_result
and not test_aggregate_column_result[univar]
and not test_aggregate_column_result[sql]
and not test_sqlite_agg_accepted
and not test_sqlite_concat
and not test_sqlite_concat_with_two_parameters
and not test_duplicate_columns_and_methods_accepted
and not test_sql_expressions_accepted
and not test_layer_2
'
pytest -k "$(echo $_skipped_tests)" .
}
package() {
DESTDIR="$pkgdir" make install INST_DIR=/usr/lib/grass$_shortver UNIX_BIN=/usr/bin
# install pkg-config file
mkdir -p "$pkgdir"/usr/share/pkgconfig
install -m 644 grass.pc "$pkgdir"/usr/share/pkgconfig/grass.pc
# change section from 1 to .1grass
for m in "$pkgdir"/usr/lib/grass"$_shortver"/docs/man/man1/*.1; do \
n=$(basename $m .1); mv $m "$pkgdir"/usr/lib/grass$_shortver/docs/man/man1/$n.1grass;
sed -i -e 's/^.TH \(.*\) 1/.TH \1 1grass/' "$pkgdir/usr/lib/grass$_shortver/docs/man/man1/$n.1grass"; done
# escape minus signs which are command line options not hyphens
for m in "$pkgdir"/usr/lib/grass"$_shortver"/docs/man/man1/*.1grass; do \
sed -i -e 's/\([ ([]\)-\([a-z]\)/\1\\-\2/g' \
-e 's/\([ []\)--\([a-z]\)/\1\\-\\-\2/g' \
-e 's/\[-\\fB/[\\-\\fB/' \
-e 's/\[--\\fB/[\\-\\-\\fB/g' \
-e 's/"\\fB-\([a-zA-Z0-9]\)/"\\fB\\-\1/' \
-e 's/"\\fB--\([a-zA-Z0-9]\)/"\\fB\\-\\-\1/' \
-e 's/\\fI-\([a-zA-Z0-9]\)/\\fI\-\1/g' \
"$m"; done
# move manpages to /usr/share/man
mv "$pkgdir"/usr/lib/grass$_shortver/docs/man "$pkgdir"/usr/share
# move docs to /usr/share/doc
mkdir -p "$pkgdir/usr/share/doc"
mv "$pkgdir/usr/lib/grass$_shortver/docs" "$pkgdir/usr/share/doc/grass-doc"
# move programming-manual to /usr/share/doc
mkdir -p "$pkgdir/usr/share/doc/grass-dev-doc/programming-manual"
mv "$builddir/lib/html" "$pkgdir/usr/share/doc/grass-dev-doc/programming-manual"
# install icons and desktop file
mkdir -p "$pkgdir"/usr/share/icons
mv "$pkgdir"/usr/lib/grass$_shortver/share/icons/hicolor "$pkgdir"/usr/share/icons
mkdir -p "$pkgdir"/usr/share/applications
mv "$pkgdir"/usr/lib/grass$_shortver/share/applications/grass.desktop "$pkgdir"/usr/share/applications/grass$_shortver.desktop
# install AppStream metadata
mkdir -p "$pkgdir"/usr/share/metainfo
mv "$pkgdir"/usr/lib/grass$_shortver/share/metainfo/org.osgeo.grass.appdata.xml "$pkgdir"/usr/share/metainfo/org.osgeo.grass.appdata.xml
# Remove files not installed
rm -rf "$pkgdir"/usr/lib/grass$_shortver/INSTALL.md \
"$pkgdir"/usr/lib/grass$_shortver/REQUIREMENTS.md \
"$pkgdir"/usr/lib/grass$_shortver/demolocation/PERMANENT/.tmp/* \
"$pkgdir"/usr/lib/grass$_shortver/translation_status.json \
"$pkgdir"/usr/lib/grass$_shortver/translators.csv
# Move image files from /usr/lib/grass$_shortver to /usr/share/grass$_shortver
mkdir -p "$pkgdir"/usr/share/grass$_shortver/gui
mv "$pkgdir"/usr/lib/grass$_shortver/gui/icons/ "$pkgdir"/usr/share/grass$_shortver/gui/
mv "$pkgdir"/usr/lib/grass$_shortver/gui/images/ "$pkgdir"/usr/share/grass$_shortver/gui/
find "$pkgdir"/usr/lib/grass$_shortver/gui/wxpython/ -type f \( -name "*.jpg" -or -name "*.png" \) -print | sort > "$builddir"/grass-gui.image-file-in-usr-lib.list
while read -r file; do \
dir=$(dirname "$file" | sed 's/usr\/lib\//usr\/share\//') ; \
if [ ! -e "$dir" ]; then \
mkdir -p "$dir" ; \
fi ; \
mv "$file" "$dir" ; \
done < "$builddir"/grass-gui.image-file-in-usr-lib.list
# Remove empty files
find "$pkgdir" -type f -empty -name "class_graphical*" -print -delete
}
devdoc() {
pkgdesc="$pkgdesc (development documentation)"
amove usr/share/doc/grass-dev-doc
}
dev() {
default_dev
# move *.so links from usr/lib/grass$_shortver/lib
# needed when linking the apps to -dev packages
for i in usr/lib/grass"$_shortver"/lib/*.so; do
if [ -L "$i" ]; then
amove "$i"
fi
done
}
doc() {
default_doc
mkdir -p "$subpkgdir/usr/lib/grass$_shortver"
ln -s ../../share/doc/grass-doc "$subpkgdir/usr/lib/grass$_shortver/docs"
}
gui() {
pkgdesc="$pkgdesc (graphical user interface)"
depends="$pkgname=$pkgver-r$pkgrel ghostscript py3-matplotlib py3-opengl py3-pillow py3-wxpython"
amove usr/lib/grass$_shortver/gui
amove usr/share/grass$_shortver/gui
ln -s ../../../share/grass$_shortver/gui/icons "$subpkgdir/usr/lib/grass$_shortver/gui/icons"
ln -s ../../../share/grass$_shortver/gui/images "$subpkgdir/usr/lib/grass$_shortver/gui/images"
}
sha512sums="
b24c017910e83a26566af0f2dd6c6cac86d69027dd209923b049b5e15f5dae96820ac57b4332ebec7254662aa94a4a5a07d376941fb829b6327de0652de35d32 grass-8.4.1.tar.gz
b1233ffea9f77bfd5e070beaf393e97f52443eba8f5e47837fb9864287a8b3693fa95ea8a5359b64097dbfb0f40394086b22ac086aa219f9a64ab3d1c18ec914 print_versions.sh
0fc838b78e87252465c12bbe793b09ff12b6583ba8adc6a0f1b587f7764c4833aa580d6d2958719696d737256aca882f83c35c5142e4c9e79c9d92cfcbc3bdf3 test_simple.sh
505f3a5cf5e967cdeceb88daca9efd0f9c7f559c5b6372bf051cc35c20aef48f04635a7447e0341bf5675264b512eb6100e1fdfc0a02a08ef788a217650ea933 10-libintl.patch
7ce5e80c286554b994e0cf71068fbf8cf65a30e5406e044d148cf50912ab08b08faa96ca5094731ff096a4936f47b676fdf980a756328096626e9ae75c474ed2 20-openblas.patch
764f0169172ab6683f9a4b9ab2e4354a7aa19d722acc1663fe007a4eda593afb7dee53b23c21e2daf0d37c038796473a65faab89dd0a00f630f5c7cfbf3e67cc 30-pkgconfig.patch
14eb4b36f5b6e7bd4a8a308c15b50a57a1433d5f4ba8f84fa473ce851f2b636301eae878f6a75309cf83382aae2e6227f5e093243bc13b63413f77f9307c1d38 40-int64.patch
"