# If you have an old version installed under /usr/local, or want to
# uninstall Jasper, or want to clean up old files before installing this
# version covered here, skip down to the bottom
# Get it
cd
test -f installed/jasper-2.0.14.tar.gz &&
mv installed/jasper-2.0.14.tar.gz .
test ! -f jasper-2.0.14.tar.gz &&
wget http://www.ece.uvic.ca/~frodo/jasper/software/jasper-2.0.14.tar.gz
# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "jasper-*" -exec rm -r {} \;
tar xzvf ~/jasper-2.0.14.tar.gz
cd jasper-2.0.14
test $UID = 0 && chown -R root:root .
# Create a build directory
test -d ./buildme && rm -r ./buildme
mkdir -p buildme
cd buildme
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_DOCDIR=/usr/doc/JasPer \
-DCMAKE_INSTALL_LIBDIR=/usr/lib64 \
-DCMAKE_INSTALL_MANDIR=/usr/man ..
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_DOCDIR=/usr/doc/JasPer \
-DCMAKE_INSTALL_MANDIR=/usr/man ..
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg jasper
# Remove old shared libraries
rm -f /usr/lib*/libjasper.* /usr/local/lib*/libjasper.*
# Install it
make install
ldconfig
# If 'make install' fails with an error about a font, hit Ctrl-D at
# the error and re-run it as "make -i install"; that may indicate
# incomplete or broken documentation files
# 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/jasper-*.tar.* installed/jasper-*.zip
mv jasper-2.0.14.tar.gz installed/
# If you ever want to uninstall Jasper, this should do it:
cd
su
test -d src/jasper-* &&
( cd src/jasper-*
make uninstall
test -f buildme/install_manifest.txt &&
cat buildme/install_manifest.txt | xargs rm )
for pfx in /usr /usr/local;
do
( cd ${pfx}/bin ; rm -f imgcmp imginfo jasper jiv )
test -d ${pfx}/doc/JasPer && rm -r ${pfx}/doc/JasPer
test -d ${pfx}/include/jasper && rm -r ${pfx}/include/jasper
rm -f ${pfx}/lib*/libjasper.* ${pfx}/lib*/pkgconfig/jasper.pc
( cd ${pfx}/man/man1 ; rm -f imgcmp.1 imginfo.1 jasper.1 )
test -d ${pfx}/share/doc/JasPer && rm -r ${pfx}/share/doc/JasPer
( cd ${pfx}/share/man/man1 ; rm -f imgcmp.1 imginfo.1 jasper.1 )
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "jasper-*" -exec rm -r {} \;
rm -f ~/installed/jasper-*.tar.*