# In Slackware 14.2 and 15.0, 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 shared 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.2.59 (2017-09-28)
# =============
# 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 tarball
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 "b4635f15b8adccc8ad0934eea485ef59cc4cae24d0f0300a9a941e51974ffc\
c7 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 tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.2.*
mv libpng-1.2.59.tar.xz installed/
# Get the tarball
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 "8d419a8b2a5edddda5cbcb897ded92205344a3249fa7a00d6384ea23ac3ccb\
d8 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 tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.4.*
mv libpng-1.4.22.tar.xz installed/
# Get the tarball
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 ]
# If you do-do this (you said doo-doo) be prepared to restart or rebuild
# things that use libpng, and there are A LOT of things that use libpng
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)
# If you are not _completely_sure_ that these files are no longer needed,
# SKIP THIS. 'lsof /usr/lib*/libpng*' can give you an idea of what is
# running now that uses libpng.
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 tarball 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.40 (2023-06-22)
# =============
# Release announcement in GitHub:
# GitHub v1.6.40 tag
# Get the tarball
cd
test -f installed/libpng-1.6.40.tar.xz &&
mv installed/libpng-1.6.40.tar.xz .
test ! -f libpng-1.6.40.tar.xz &&
wget https://downloads.sf.net/libpng/libpng-1.6.40.tar.xz
# Verify tarball w/ sha256sum:
# (from the web site, announcement e-mail)
echo "535b479b2467ff231a3ec6d92a525906fb8ef27978be4f66dbe05d3f3a01b3\
a1 libpng-1.6.40.tar.xz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "libpng-1.6.*" -exec rm -r {} \;
tar xJvf ~/libpng-1.6.40.tar.xz
cd libpng-1.6.40
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 this is the only libpng installed, check daemons with
# lsof, probably best to NOT do this if you run Apache + PHP
# or anything else that might be using it... ]
test -x /sbin/removepkg && /sbin/removepkg libpng
# Remove old files, probably not necessary, just to be tidy in case
# a new 1.6.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 tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/libpng-1.6.*
mv libpng-1.6.40.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.*