# Get it
cd
test -f installed/expat-2.4.1.tar.xz && mv installed/expat-2.4.1.tar.xz .
test ! -f expat-2.4.1.tar.xz &&
wget https://github.com/libexpat/libexpat/releases/download/R_2_4_1/expat-2.4.1.tar.xz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "cf032d0dba9b928636548e32b327a2d66b1aab63c4f4a13dd132c2d1d2f2fb6a expat-2.4.1.tar.xz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "expat-*" -exec rm -r {} \;
tar xJvf ~/expat-2.4.1.tar.xz
cd expat-2.4.1
test $UID = 0 && chown -R root:root .
# Configure the build - 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/expat --libdir=/usr/lib64 --mandir=/usr/man
# Configure the build - anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/expat --mandir=/usr/man
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg expat
# There is probably an older libexpat.so.* from the
# elflibs|aaa_elflibs|aaa_libraries package. If you are positive that you
# don't need it, remove that and any others from previous source-installed
# versions of Expat.
rm -f /usr/lib*/libexpat.*
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+rw .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/expat-*.tar.*
mv expat-2.4.1.tar.xz installed/
# If you ever want to uninstall Expat, this should do it:
cd
su
test -d src/expat-* && ( cd src/expat-* ; make uninstall )
test -d /usr/doc/expat && rm -r /usr/doc/expat
( cd /usr/include ; rm -f expat.h expat_config.h expat_external.h )
rm -f /usr/bin/xmlwf /usr/lib*/libexpat.* /usr/lib64/pkgconfig/expat.pc /usr/man/man1/xmlwf.1
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "expat-*" -exec rm -r {} \;
rm -f ~/installed/expat-*.tar.*