desktop/grass/PKGBUILD
2018-02-05 00:33:38 +01:00

103 lines
3.5 KiB
Bash

# Contributions from AUR: https://aur.archlinux.org/packages/grass70-svn/
pkgname=grass
pkgver=7.2.2
pkgrel=1
_shortver=${pkgver%.*}; _shortver=${_shortver/./}
pkgdesc="GRASS GIS: geospatial data management and analysis, image processing, graphics/maps production, spatial modeling and visualization."
arch=('x86_64')
url='http://grass.osgeo.org/'
license=('GPL')
# More about GRASS build and runtime deps on http://grasswiki.osgeo.org/wiki/Compile_and_Install.
depends=('zlib' 'freetype2' 'cfitsio' 'fftw' 'gdal' 'geos' 'glu' 'libjpeg'
'openblas' 'libpng' 'libtiff' 'libxmu' 'mesa' 'postgresql' 'proj'
'xorg-server' 'cairo' 'unixodbc' 'python2'
'python2-numpy' 'python2-pillow' 'lapack')
makedepends=('subversion' 'doxygen')
optdepends=('r: R language interface; see http://grasswiki.osgeo.org/wiki/R_statistics'
'mariadb: mysql database interface'
'ffmpeg: ffmpeg support'
'lapack: required for GMATH library'
'lesstif: motif support')
source=("http://grass.osgeo.org/grass$_shortver/source/${pkgname}-${pkgver}.tar.gz")
sha1sums=('effdea8179708c7bea5ce46cc5de370f89db4576')
prepare() {
cd $pkgname-$pkgver
# Change everything to use python2
sed -i 's/\(env \|\/usr\/bin\/\)python$/&2/' $(find . -iname "*.py")
sed -i '/os\.environ.*GRASS_PYTHON/ s/"python"/"python2"/' lib/init/grass.py
sed -i '/^PYTHON/ s/python$/&2/' include/Make/Platform.make.in
# Fix path
sed -i '/^\s*INSTDIR/ s/".*"//' configure
}
build() {
cd "$pkgname-$pkgver"
# Ancient autoconf used upstream can't handle CPPFLAGS correctly
export CFLAGS="$CPPFLAGS $CFLAGS"
export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
unset CPPFLAGS
#No way to bypass wxpython failures, no need to have it since we don't use it
rm -r ${srcdir}/${pkgname}-${pkgver}/gui/wxpython
./configure \
--prefix=/opt/$pkgname \
--with-cxx \
--with-cairo \
--with-freetype \
--with-freetype-includes=/usr/include/freetype2 \
--with-geos \
--with-python \
--with-openblas \
--with-lapack \
--with-nls \
--with-netcdf \
--with-odbc \
--with-openmp \
--with-postgres \
--with-python=/usr/bin/python2-config \
--with-readline \
--with-proj-includes=/usr/include \
--with-proj-libs=/usr/lib \
--with-proj-share=/usr/share/proj \
--with-pthread \
--with-sqlite \
--with-mysql-includes=/usr/include/mysql \
--with-mysql \
--without-wxwidgets
#make sure wxpython is not attempted by make
sed -i "s/SUBDIRS = icons images scripts xml wxpython/SUBDIRS = icons images scripts xml/g" ${srcdir}/${pkgname}-${pkgver}/gui/Makefile
make
}
package() {
cd $pkgname-$pkgver
make exec_prefix="$pkgdir/usr" INST_DIR="$pkgdir/opt/$pkgname" install
# Install linker config file, needed for qgis to find grass
install -d "$pkgdir/etc/ld.so.conf.d/"
echo "/opt/$pkgname/lib" > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"
cd "$pkgdir/opt/$pkgname"
# Put freedesktop.org files in correct location
mv share "$pkgdir/usr"
install -Dm644 gui/icons/grass-48x48.png "$pkgdir/usr/share/icons/hicolor/48x48/apps/grass.png"
install -Dm644 gui/icons/grass-64x64.png "$pkgdir/usr/share/icons/hicolor/64x64/apps/grass.png"
# Fix some paths that get hard coded by make install
sed -i "s|$pkgdir||g" demolocation/.grassrc$_shortver \
include/Make/{Platform,Grass}.make \
etc/fontcap \
"$pkgdir/usr/bin/grass$_shortver"
sed -i "s|$srcdir||g" docs/html/t.connect.html
}