# Get it
cd
test -f installed/libjpeg-turbo-3.0.1.tar.gz &&
mv installed/libjpeg-turbo-3.0.1.tar.gz .
test ! -f libjpeg-turbo-3.0.1.tar.gz &&
wget https://downloads.sf.net/libjpeg-turbo/libjpeg-turbo-3.0.1.tar.gz
# Extract the tarball
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libjpeg-turbo-*" -exec rm -r {} \;
tar xzvf ~/libjpeg-turbo-3.0.1.tar.gz
cd libjpeg-turbo-3.0.1
test $UID = 0 && chown -R root:root .
# Read at least ./README.md and ./BUILDING.md
# Create a build directory
mkdir -p build
cd build
# If you've run CMake before, clean up
test -f Makefile && make clean
test -f CMakeCache.txt && rm CMakeCache.txt
# List all CMake configuration options
cmake -LH .. | less
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
cmake -DENABLE_STATIC=0 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_DOCDIR=/usr/doc/libjpeg-turbo \
-DCMAKE_INSTALL_LIBDIR=/usr/lib64 \
-DCMAKE_INSTALL_MANDIR=/usr/man ..
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
cmake -DENABLE_STATIC=0 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_DOCDIR=/usr/share/doc/libjpeg-turbo \
-DCMAKE_INSTALL_MANDIR=/usr/man ..
# Build it
make
# Test the build
make test
# Become root to install it
su
# Before installing it, look at what you have in /usr/lib*/libjpeg.*
# Note different dates, that may indicate what came from what...
# (Slackware package or soure, libjpeg vs libjpeg-turbo)
# If you have libjpeg (non-turbo) installed now, these would be from it:
# /usr/lib64/libjpeg.a
# /usr/lib64/libjpeg.la
# /usr/lib64/libjpeg.so (symlink)
# /usr/lib64/libjpeg.so.9 (symlink)
# /usr/lib64/libjpeg.so.9.3.0
#
# libjpeg-turbo will install it's own libjpeg and also libturbojpeg and
# unlike .so.8 or .so.9, the libjpeg from -turbo will be .so.62
#
# Try 'lsof /usr/lib*/libjpeg.*' to see if it lists anything running now
# that is using an old version shared library
# Remove the Slackware libjpeg and libjpeg-turbo packages, if there any
# To be extra safe, copy /usr/lib*/libjpeg.* somewhere else firse in
# case you have to put them back
test -x /sbin/removepkg && /sbin/removepkg libjpeg libjpeg-turbo
# If you used -DENABLE_STATIC=0 this time and are upgrading
rm -f /usr/lib*/libjpeg.a /usr/lib*/libturbojpeg.a
# 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/libjpeg-turbo-*.tar.gz
mv -f libjpeg-turbo-3.0.1.tar.gz installed/
# If you ever want to uninstall libjpeg-turbo (and libjpeg), this should
# do it. 'make uninstall' as root in the source directory may be enough,
# the rest is to cover anything else that is missed.
cd
su
test -d src/libjpeg-turbo-* && ( cd src/libjpeg-turbo-* ; make uninstall )
( cd /usr/bin
rm -f cjpeg djpeg jpegtran rdjpgcom tjbench wrjpgcom )
test -d /usr/doc/libjpeg-turbo && rm -r /usr/doc/libjpeg-turbo
( cd /usr/include
rm -f jconfig.h jerror.h jmorecfg.h jpeglib.h turbojpeg.h )
( cd /usr/lib
rm -f libjpeg.* libturbojpeg.* pkgconfig/libjpeg.pc \
pkgconfig/libturbojpeg.pc )
test -d /usr/lib64 &&
( cd /usr/lib64
rm -f libjpeg.* libturbojpeg.* pkgconfig/libjpeg.pc \
pkgconfig/libturbojpeg.pc )
( cd /usr/man/man1
rm -f cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 )
test -d /usr/share/doc/libjpeg-turbo && rm -r /usr/share/doc/libjpeg-turbo
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libjpeg-turbo-*" -exec rm -r {} \;
rm -f ~/installed/libjpeg-turbo-*.tar.*