# Get it
cd
test -f installed/jbig2dec-0.15.tar.gz &&
mv installed/jbig2dec-0.15.tar.gz .
test ! -f jbig2dec-0.15.tar.gz &&
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/\
download/gs924/jbig2dec-0.15.tar.gz
# Extract it
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -name "jbig2dec-*" -exec rm -r {} \;
tar xzvf ~/jbig2dec-0.15.tar.gz
cd jbig2dec-0.15
test $UID = 0 && chown -R root:root .
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --disable-static --libdir=/usr/local/lib64 \
--mandir=/usr/local/man
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --disable-static --mandir=/usr/local/man
# Build it
make
# Become root to install it
su
# Remove old library files
rm -f /usr/local/lib*/libjbig2dec.*
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/jbig2dec-*.tar.*
mv jbig2dec-0.15.tar.gz installed/
# If you ever want to uninstall jbig2dec, this should do it:
cd
su
test -d src/jbig2dec-* && ( cd src/jbig2dec-* ; make uninstall )
rm -f /usr/local/bin/jbig2dec /usr/local/lib*/libjbig2dec.* \
/usr/local/include/jbig2.h /usr/local/man/man1/jbig2dec.1
exit
find ~/src -maxdepth 1 -type d -name "jbig2dec-*" -exec rm -r {} \;
rm -f ~/installed/jbig2dec-*.tar.*