Linux HOWTOs

About | Home | Search


HOWTO: libjpeg
Description: JPEG library and utilities
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# libjpeg v9c
# ===========
# Slackware 13.0: libjpeg 6b
# Slackware 13.1, 13.37, 14.0: libjpeg v8a
# Slackware 14.1: libjpeg v8a
# Slackware 14.2: Not included - includes libjpeg-turbo and openjpeg

# If you have libjpeg-turbo installed, running "make uninstall"
# (as root) from it's soure directory before beginning here is probably a
# good idea

# Prerequisites:
# pkg-config

# Get it
cd
test -f installed/jpegsrc.v9c.tar.gz && mv installed/jpegsrc.v9c.tar.gz .
test ! -f jpegsrc.v9c.tar.gz &&
 wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz

# Verify tarball w/ sha256sum:
# (this is from mine, if mine is bad, yours is too)
echo "650250979303a649e21f87b5ccd02672af1ea6954b911342ea491f351ceb71\
22  jpegsrc.v9c.tar.gz" | sha256sum -c

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "jpeg-*" -exec rm -r {} \;
tar xzvf ~/jpegsrc.v9c.tar.gz
cd jpeg-9c
test $UID = 0 && chown -R root:root .

# Read through at least ./README and ./install.txt

# Configure the source for 64-bit
test $(uname -m) = 'x86_64' &&
 ./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
 ./configure --prefix=/usr --mandir=/usr/man

# Build it
make

# Test the new build
make test

# Become root to clean up old files and to install it
su

# Remove the Slackware package, if there is one
test -x /sbin/removepkg &&
 /sbin/removepkg jpeg6 libjpeg libjpeg-6b libjpeg-v8a

# Before installing the new version, you may want to check out what
# running programs (daemons, looping scripts, etc.) may be using the
# old version of libjpeg.  Sometimes you can just restart it (after 'make
# install ; ldconfig' below), sometimes you have to rebuild it to get it to
# use the new version.  It depends...  Hint, if you see 'httpd' in the list,
# it's probably PHP (/usr/local/apache2/modules/libphp5.so) that is linked
# with it.  This should list programs that are running now and are linked
# with the old libjpeg shared library:
lsof /usr/lib*/libjpeg.so.*

# Install it
make install
ldconfig

# You may have old shared library files left over because they were found
# in other Slackware packages like 'aaa_elflibs', or because you installed
# them before from source.  The safe choice is to leave them there, in case
# other programs are linked with the older versions.  Just make sure the
# libjpeg.so and libjpeg.so.8 symlinks point to the new version just
# installed and you should be fine.  If you do remove the old versions, and
# really want to clean up everything, you can even remove references to the
# old package files in /var/adm/packages/*

# 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/jpegsrc.*.tar.*
mv jpegsrc.v9c.tar.gz installed/


# If you ever want to uninstall libjpeg, this should do it:
# ('make uninstall' + just in case cleanup)
cd
su
test -d src/jpeg-* && ( cd src/libjpeg-* ; make uninstall )
( cd /usr/bin ; rm -f cjpeg djpeg jpegtran rdjpgcom wrjpgcom )
( cd /usr/include ; rm -f jconfig.h jerror.h jmorecfg.h jpeglib.h )
( cd /usr/man/man1
  rm -f cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 )
rm -f /usr/lib*/libjpeg.* /usr/lib*/pkgconfig/libjpeg.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "jpeg-*" -exec rm -r {} \;
rm -f ~/installed/jpegsrc.*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>