# libpng
# ======
# Slackware 14.0, 14.1: libpng 1.4.12
# Slackware 14.2: libpng 1.6.23
# Slackware current (as this is written): libpng 1.6.37
#
# Many versions of Slackware also include a patched or updated version in
# 'patches' too.
# In Slackware 14.2, libpng 1.4.x and 1.6.x are in the aaa_elflibs package and
# libpng 1.6.x is in the full libpng package.
# Some things still use an old major version of libpng, so I usually install
# more than one. If you have both installed and you upgrade just the old
# one, make sure you cd into the new one's source and 'make install' it
# again, then run 'ldconfig'. This way the libpng.so* symlinks will point
# to the new one (or just fix the symlinks yourself).
# Below I just blow away existing library files before running 'make
# install' to ensure that extra files aren't left behind that are no longer
# needed. If you run a production system with multiple local users that may
# be using something linked with libpng, or if you run a daemon that is
# linked with it, you'll want to skip that part below and clean up any old
# files manually when you're done with the rest. Check libraries with
# 'lsof'.
# If you run Slackware, *if you will be cleaning up old libpng* files*,
# you may want to open up the /var/adm/packages/*elflibs* file with a text
# editor and remove lines like this:
# usr/lib/libpng12.so.0.1.2.8
# usr/lib/libpng.so.3.1.2.8
# usr/lib64/libpng14.so.14.18.0
# usr/lib64/libpng16.so.16.23.0
# which refer to files that either don't exist or have been replaced.
# If you ever want to uninstall libpng, or clean up files from an old
# version before installing a new one, skip down to the bottom for
# instructions
# Prerequisites (for all versions):
# zlib
# pkgconfig
# libpng 1.0.69
# =============
# 1.0.x is really old, first released (.0) in 1998. This one is just here
# to cover all branches in case you're locked in to this one and need the
# latest released version.
# Get the source
cd
test -f installed/libpng-1.0.69.tar.bz2 &&
mv installed/libpng-1.0.69.tar.bz2 .
test ! -f libpng-1.0.69.tar.bz2 &&
wget https://downloads.sf.net/libpng/libpng-1.0.69.tar.xz
# Verify tarball w/ sha256sum:
# (this comes from my gpg-verified tarball)
echo "e9290960c3c9617ef1e2d2f6d0608ee5ac2cf1ebc47bc649c864ae788207ed03 libpng-1.0.69.tar.xz" | sha256sum -c
# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libpng-1.0.*" -exec rm -r {} \;
tar xJvf ~/libpng-1.0.69.tar.xz
cd libpng-1.0.69
test $UID = 0 && chown -R root:root .
# Use the sample Makefile for Linux
ln -s scripts/makefile.linux Makefile
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
make prefix=/usr LIBPATH=/usr/lib64
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
make prefix=/usr
# Build it
make
# Test the build
make test
# Become root to clean-up old files and install it
su
# Remove the Slackware package, if there is one
# [ if you have the 1.6.x package installed and in use, you may want to
# NOT do this ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.0.x version does not include files that a previous one did
# (hopefully that would be mentioned in the CHANGES file)
test -d /usr/include/libpng10 && rm -r /usr/include/libpng10
rm -f /usr/bin/libpng10-config /usr/lib*/libpng10.a /usr/lib*/libpng10.so.* /usr/lib*/libpng.so.2.* /usr/lib*/pkgconfig/libpng10.pc
( cd /usr/man
rm -f man3/libpng.3 man3/libpngpf.3 man5/png.5 )
# Installing it with 'make install' will remove the non-version-specific
# named files libpng-config, libpng.pc, etc. So if you will have
# multiple major versions of libpng installed and are not installing all
# of them right now, you may want to look at 'make -n install prefix=...'
# and only copy these 1.0.x version-specific-named files in place, without
# removing /usr/include/png.h, libpng-config, libpng.pc, and the rest.
# Install it for 64-bit
test $(uname -m) = 'x86_64' &&
make install prefix=/usr LIBPATH=/usr/lib64
# Install it for anything else
test $(uname -m) = 'x86_64' &&
make install prefix=/usr
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 source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.0.*
mv libpng-1.0.69.tar.xz installed/
# libpng 1.2.59
# =============
# 1.2.x is really old, first released (.0) in 2001. This one is just here
# to cover all branches in case you're locked in to this one and need the
# latest released version.
# Get the source
cd
test -f installed/libpng-1.2.59.tar.xz &&
mv installed/libpng-1.2.59.tar.xz .
test ! -f libpng-1.2.59.tar.xz &&
wget https://downloads.sf.net/libpng/libpng-1.2.59.tar.xz
# Verify tarball w/ sha256sum:
# (this comes from my gpg-verified tarball)
echo "b4635f15b8adccc8ad0934eea485ef59cc4cae24d0f0300a9a941e51974ffcc7 libpng-1.2.59.tar.xz" | sha256sum -c
# Configure the build 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
# Check the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
# [ if you have the 1.6.x package installed and in use, you may want to
# NOT do this ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.2.x version does not include files that a previous one did
# (hopefully that would be mentioned in the CHANGES file)
test -d /usr/include/libpng12 && rm -r /usr/include/libpng12
rm -f /usr/bin/libpng12-config /usr/lib*/libpng12.a /usr/lib*/libpng12.so.* /usr/lib*/pkgconfig/libpng12.pc
( cd /usr/man
rm -f man3/libpng.3 man3/libpngpf.3 man5/png.5 )
# Installing it with 'make install' will remove the non-version-specific
# named files libpng-config, libpng.pc, etc. and copy or symlink the
# real version-specific file to that generic name. So if you will have
# multiple major versions of libpng installed and are not installing all
# of them right now, you may want to look at 'make -n install'
# and only copy these 1.2.x version-specific-named files in place, without
# removing /usr/include/png.h, libpng-config, libpng.pc, and the rest.
# 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 source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.2.*
mv libpng-1.2.59.tar.xz installed/
# libpng 1.4.22
# =============
# Get the source
cd
test -f installed/libpng-1.4.22.tar.xz &&
mv installed/libpng-1.4.22.tar.xz .
test ! -f libpng-1.4.22.tar.xz &&
wget https://downloads.sf.net/libpng/libpng-1.4.22.tar.xz
# Verify tarball w/ sha256sum:
# (this comes from my gpg-verified tarball)
echo "8d419a8b2a5edddda5cbcb897ded92205344a3249fa7a00d6384ea23ac3ccbd8 libpng-1.4.22.tar.xz" | sha256sum -c
# Configure the build 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
# Check the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
# [ if you have the 1.6.x package installed and in use, you may want to
# NOT do this ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.4.x version does not include files that a previous one did
# (hopefully that would be mentioned in the CHANGES file)
test -d /usr/include/libpng14 && rm -r /usr/include/libpng14
rm -f /usr/bin/libpng14-config /usr/lib*/libpng14.a /usr/lib*/libpng14.so /usr/lib*/libpng14.so.* /usr/lib*/pkgconfig/libpng14.pc
( cd /usr/man
rm -f man3/libpng.3 man3/libpngpf.3 man5/png.5 )
# Installing it with 'make install' will remove the non-version-specific
# named files libpng-config, libpng.pc, etc. and copy or symlink the
# real version-specific file to that generic name. So if you will have
# multiple major versions of libpng installed and are not installing all
# of them right now, you may want to look at 'make -n install'
# and only copy these 1.4.x version-specific-named files in place, without
# removing /usr/include/png.h, libpng-config, libpng.pc, and the rest.
# 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 source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.4.*
mv libpng-1.4.22.tar.xz installed/
# libpng 1.5.30
# =============
# Get the source
cd
test -f installed/libpng-1.5.30.tar.xz &&
mv installed/libpng-1.5.30.tar.xz .
test ! -f libpng-1.5.30.tar.xz &&
wget https://downloads.sf.net/libpng/libpng-1.5.30.tar.xz
# Configure the build 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
# Check the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
# [ if you have the 1.6.x package installed and in use, you may want to
# NOT do this ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.5.x version does not include files that a previous one did
# (hopefully that would be mentioned in the CHANGES file)
test -d /usr/include/libpng15 && rm -r /usr/include/libpng15
rm -f /usr/bin/libpng15-config /usr/lib*/libpng15.a /usr/lib*/libpng15.so /usr/lib*/libpng15.so.* /usr/lib*/pkgconfig/libpng15.pc
( cd /usr/man
rm -f man3/libpng.3 man3/libpngpf.3 man5/png.5 )
# Installing it with 'make install' will remove the non-version-specific
# named files libpng-config, libpng.pc, etc. and copy or symlink the
# real version-specific file to that generic name. So if you will have
# multiple major versions of libpng installed and are not installing all
# of them right now, you may want to look at 'make -n install'
# and only copy these 1.5.x version-specific-named files in place, without
# removing /usr/include/png.h, libpng-config, libpng.pc, and the rest.
# 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 source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.5.*
mv libpng-1.5.30.tar.xz installed/
# libpng 1.6.37
# =============
# Get the source
cd
test -f installed/libpng-1.6.37.tar.xz &&
mv installed/libpng-1.6.37.tar.xz .
test ! -f libpng-1.6.37.tar.xz &&
wget https://downloads.sf.net/libpng/libpng-1.6.37.tar.xz
# Verify tarball w/ sha256sum:
# (from the web site, announcement e-mail)
echo "505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca libpng-1.6.37.tar.xz" | sha256sum -c
# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libpng-1.5.*" -exec rm -r {} \;
tar xJvf ~/libpng-1.6.37.tar.xz
cd libpng-1.6.37
test $UID = 0 && chown -R root:root .
## If you'd rather, you can also do this:
# ln -s scripts/makefile.linux Makefile
# make prefix=/usr
# make test
# Configure the build 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
# Check the build
make check
# Become root to install it
su
# Remove the Slackware package, if there is one
# [ if you have the 1.6.x package installed and in use, you may want to
# NOT do this ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.5.x version does not include files that a previous one did
# (hopefully that would be mentioned in the CHANGES file)
test -d /usr/include/libpng16 && rm -r /usr/include/libpng16
rm -f /usr/bin/libpng16-config /usr/lib*/libpng16.a /usr/lib*/libpng16.so /usr/lib*/libpng16.so.* /usr/lib*/pkgconfig/libpng16.pc
( cd /usr/man
rm -f man3/libpng.3 man3/libpngpf.3 man5/png.5 )
# Installing it with 'make install' will remove the non-version-specific
# named files libpng-config, libpng.pc, etc. and copy or symlink the
# real version-specific file to that generic name. So if you will have
# multiple major versions of libpng installed and are not installing all
# of them right now, you may want to look at 'make -n install'
# and only copy these 1.6.x version-specific-named files in place, without
# removing /usr/include/png.h, libpng-config, libpng.pc, and the rest.
# 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 source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.5.*
mv libpng-1.6.37.tar.xz installed/
# If you ever want to uninstall libpng, this should do it:
su
for pfx in /usr /usr/local; do
test -d ${pfx}/include/libpng10 && rm -r ${pfx}/include/libpng10
test -d ${pfx}/include/libpng12 && rm -r ${pfx}/include/libpng12
test -d ${pfx}/include/libpng14 && rm -r ${pfx}/include/libpng14
test -d ${pfx}/include/libpng15 && rm -r ${pfx}/include/libpng15
test -d ${pfx}/include/libpng16 && rm -r ${pfx}/include/libpng16
( cd ${pfx}/bin
rm -f libpng-config libpng-10-config libpng-12-config libpng-14-config libpng-15-config libpng-16-config )
( cd ${pfx}/include ; rm -f libpng png.h pngconf.h )
( cd ${pfx}/lib
rm -f libpng.* libpng10.* libpng12.* libpng14.* libpng15.* libpng16.* )
( cd ${pfx}/lib/pkgconfig
rm -f libpng.pc libpng10.pc libpng12.pc libpng14.pc libpng15.pc libpng16.pc )
( cd ${pfx}/man/man3 ; rm -f libpng.3 libpngpf.3 )
rm -f ${pfx}/man/man5/png.5
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libpng-*" -exec rm -r {} \;
rm -f ~/installed/libpng-*.tar.*