# GD 2.3.3
# ========
# As this is written, the GD home page URL www.libgd.org redirects to
# https://libgd.github.io/, which is the home page URL above
# If you want to uninstall GD or clean up files from an old version before
# installing a new one, skip down to the bottom for instructions. If
# your previous GD is installed under /usr/local, definitely do that.
# Get the tarball
cd
test -f installed/libgd-2.3.3.tar.xz && mv installed/libgd-2.3.3.tar.xz .
test ! -f libgd-2.3.3.tar.xz &&
wget https://github.com/libgd/libgd/releases/download/gd-2.3.3/\
libgd-2.3.3.tar.xz
# Extract the source
# (be careful here if you have anything named gd-somethingelse-*)
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "gd-?.*" -exec rm -r {} \;
find -maxdepth 1 -type d -name "libgd-*" -exec rm -r {} \;
tar xJvf ~/libgd-2.3.3.tar.xz
cd libgd-2.3.3
test $UID = 0 && chown -R root:root .
# You can use CMake instead of configure if you prefer
# If you have FreeType, Xpm, and others installed but don't want to include
# support for those, pass --without-freetype, --without-xpm, etc. to
# configure. See './configure --help' for more options.
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
test -d /usr/lib64 && ./configure --prefix=/usr --libdir=/usr/lib64
# Configure the build for anything else
test $(uname -m) != 'x86_64' && ./configure --prefix=/usr
# Build it
make
# Become root to clean up old files and to install it
su
# Remove old Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg gd
# Next I blow away shared library files just before running 'make install'
# to ensure that old, unused files aren't left lying around taking up space,
# causing problems. If you run a multi-user system where users may be
# running programs linked with libgd, or if you run a daemon that uses it
# (like Apache + PHP), you may want to skip that part and clean up any old
# files manually after you're done upgrading.
# lsof may be some help with that.
# (lsof /usr/lib*/libgd.so*)
#
# Remove old versions of library files
# ...or don't and check dates after 'make install'
test -d /usr/lib64 && ( cd /usr/lib64 ; rm -f libgd.a libgd.so* )
( cd /usr/lib ; rm -f libgd.a libgd.so* )
# Install it
make install
ldconfig
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/gd-*.tar.* installed/libgd-*.tar.* installed/gd.README
mv libgd-2.3.3.tar.xz installed/
# If you ever want to uninstall GD, this should do it:
cd
su
test -x /sbin/removepkg && /sbin/removepkg gd
test -d src/gd-* && ( cd src/gd-* ; make uninstall )
test -d src/gd-libgd && ( cd src/gd-libgd ; make uninstall )
for pfx in /usr/local /usr;
do
( cd ${pfx}/bin
rm -f annotate bdftogd copypal gd2 gd2copypal gd2togif gd2topng \
gdcmpgif gdlib-config gdparttopng gdtopng giftogd2 pngtogd \
pngtogd2 webpng )
( cd ${pfx}/include
rm -f entities.h gdcache.h gd_color_map.h gd_errors.h gdhelpers.h \
gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gdfx.h gd.h \
gd_io.h gdpp.h jisx0208.h wbmp.h )
rm -f ${pfx}/lib/libgd.* ${pfx}/lib64/libgd.* \
${pfx}/lib/pkgconfig/gdlib.pc ${pfx}/lib64/pkgconfig/gdlib.pc
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "gd-*" -exec rm -r {} \;
test -d ~/src/gd-libgd && rm -r ~/src/gd-libgd
rm -f ~/installed/gd-*.tar.* ~/installed/gd.README