# Get the source tarball
cd
test -f installed/lerc-4.0.0.tar.gz &&
mv -f installed/lerc-4.0.0.tar.gz .
test ! -f lerc-4.0.0.tar.gz &&
wget -O lerc-4.0.0.tar.gz \
https://github.com/Esri/lerc/archive/refs/tags/v4.0.0.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "lerc-*" -exec rm -r {} \;
tar xzvf ~/lerc-4.0.0.tar.gz
cd lerc-4.0.0
test $UID = 0 && chown -R root:root .
# Configure for 64-bit
test $(uname -m) = 'x86_64' &&
cmake -DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_INSTALL_LIBDIR=/usr/local/lib64
# Configure for anything else
test $(uname -m) != 'x86_64' &&
cmake -DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_INSTALL_LIBDIR=/usr/local/lib64
# Build it
make
# 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/lerc-*.tar.*
mv lerc-4.0.0.tar.gz installed/
# If you ever want to uninstall Lerc, this should do it:
cd
su
rm -f /usr/local/lib64/libLerc.so.4 /usr/local/lib64/libLerc.so \
/usr/local/include/Lerc_types.h /usr/local/include/Lerc_c_api.h \
/usr/local/lib64/pkgconfig/Lerc.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "atk-*" -exec rm -r {} \;
rm -f ~/installed/atk-*.tar.*