# JBIG-KIT 2.1
# ============
# Get the source tarball
cd
test -f installed/jbigkit-2.1.tar.gz && mv installed/jbigkit-2.1.tar.gz .
test ! -f jbigkit-2.1.tar.gz &&
wget https://www.cl.cam.ac.uk/~mgk25/jbigkit/download/jbigkit-2.1.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "jbigkit-*" -exec rm -r {} \;
tar xzvf ~/jbigkit-2.1.tar.gz
cd jbigkit-2.1
test $UID = 0 && chown -R root:root .
# Build it - 64-bit
test $(uname -m) = 'x86_64' &&
make CFLAGS="-O2 -W -Wno-unused-result -fPIC"
# Build it - anything else
test $(uname -m) != 'x86_64' && make
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/jbigkit-*.tar.*
mv jbigkit-2.1.tar.gz installed/
# If you ever want to uninstall JBIG-KIT, this should do it:
cd
su
( cd /usr/local/bin ; rm -f jbgtopbm pbmtojbg )
( cd /usr/local/man/man1 ; rm -f jbgtopbm.1 pbmtojbg.1 )
rm -f /usr/local/include/jbig.h /usr/local/lib*/libjbig.a
exit
find ~/src -maxdepth 1 -type d -name "jbigkit-*" -exec rm -r {} \;
rm -f ~/installed/jbigkit-*.tar.*