# Get the source
cd
test -f installed/shapelib-1.5.0.tar.gz &&
mv -f installed/shapelib-1.5.0.tar.gz .
test ! -f shapelib-1.5.0.tar.gz &&
wget -O shapelib-1.5.0.tar.gz \
https://github.com/OSGeo/shapelib/archive/refs/tags/v1.5.0.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "shapelib-*" -exec rm -r {} \;
tar xzvf ~/shapelib-1.5.0.tar.gz
cd shapelib-1.5.0
test $UID = 0 && chown -R root:root .
# Read README and ChangeLog (if upgrading)
# Configure the build for 64-bit
./configure --prefix=/usr/local --libdir=/usr/local/lib64
# Configure the build for anything else
./configure
# Build it
make
# Check the build
make check
# Become root to install it
su
# Install it
make install
ldconfig
# Become your non-root user again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/shapelib-*.tar.*
mv shapelib-1.5.0.tar.gz installed/
# If you ever want to uninstall Shapelib, this should do it:
cd
su
test -d src/shapelib-* && ( cd src/shapelib-* ; make uninstall )
( cd /usr/local/bin
rm -f Shape_PointInPoly dbfadd dbfcat dbfcreate dbfdump dbfinfo shpadd \
shpcat shpcentrd shpcreate shpdata shpdump shpdxf shpfix shpinfo \
shprewind shpsort shptreedump shputils shpwkb )
rm /usr/local/include/shapefil.h \
/usr/local/lib64/libshp.* /usr/local/lib64/pkgconfig/libshp.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "shapelib-*" -exec rm -r {} \;
rm -f ~/installed/shapelib-*.tar.*