CLAWRIM Wiki

The Computational Lab for Advanced Water Resources Informatics and Modeling

User Tools

Site Tools


howtos:how_to_compile_grass_gis_on_slackware

How to compile GRASS GIS on Slackware

This HOWTO explains how to compile GRASS GIS on Slackware.

# switch to root
su -
 
# create postgres group and user for postgresql, one of pdal dependencies
groupadd -g 209 postgres
useradd -u 209 -g 209 -d /var/lib/pgsql postgres
 
# install dependency libraries;
# build queuefiles, not packages, to automatically build any other dependencies
sbopkg -k -i "proj gdal pdal blas lapack"
 
# switch to non-root
exit
 
# clone github repositories
mkdir -p ~/usr/local/src
cd ~/usr/local/src
git clone https://github.com/HuidaeCho/grass-build-scripts.git
git clone https://github.com/OSGeo/grass.git
git clone https://github.com/OSGeo/grass-addons.git
git clone https://github.com/OSGeo/gdal-grass.git
 
# create ~/.grassbuildrc
cd grass-build-scripts
cp .grassbuildrc-example ~/.grassbuildrc
 
# build grass
./build.sh -m -a -g >& ~/usr/local/src/grass/build.log
 
# install pkgconfig config
mkdir -p ~/usr/local/share/pkgconfig
cd ../grass
sed 's#/usr/local/grass[^/ ]*#'$HOME'/usr/local/src/grass/dist.x86_64-pc-linux-gnu#g' grass.pc > ~/usr/local/share/pkgconfig/grass.pc
if ! echo $PKG_CONFIG_PATH | grep -q $HOME/usr/local/share/pkgconfig; then
  echo 'export PKG_CONFIG_PATH="$HOME/usr/local/share/pkgconfig:$PKG_CONFIG_PATH"' > ~/.bash_profile
  . ~/.bash_profile
fi
 
# create grass script
mkdir ~/usr/local/bin
cat << 'EOT' > ~/usr/local/bin/grass
#!/bin/sh
grass_master="$HOME/usr/local/src/grass/bin.x86_64-pc-linux-gnu/grass"
# workaround to avoid the annoying ~/grassdata/world_latlong_wgs84 feature
if [ $# -eq 0 ]; then
        last_used_mapset=$(awk '
                /^GISDBASE: /{gisdbase=$2}
                /^LOCATION_NAME: /{location_name=$2}
                /^MAPSET: /{mapset=$2}
                END{
                        printf "%s/%s/%s", gisdbase, location_name, mapset
                }' ~/.grass8/rc)
        $grass_master "$last_used_mapset"
else
        $grass_master "$@"
fi
EOT
chmod a+x ~/usr/local/bin/grass
if ! echo $PATH | grep -q $HOME/usr/local/bin; then
  echo 'export PATH="$HOME/usr/local/bin:$PATH"' > ~/.bash_profile
  . ~/.bash_profile
fi
howtos/how_to_compile_grass_gis_on_slackware.txt · Last modified: by hcho

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki