# Get the tarball
cd
test -f installed/bzip2-1.0.8.tar.gz && mv installed/bzip2-1.0.8.tar.gz .
test ! -f bzip2-1.0.8.tar.gz &&
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "bzip2-*" -exec rm -r {} \;
tar xzvf ~/bzip2-1.0.8.tar.gz
cd bzip2-1.0.8
test $UID = 0 && chown -R root:root .
# Build the shared (.so.x.x) library and a bzip2 binary that uses it
make -f Makefile-libbz2_so
# Build the static (.a) library and the static bzip2 and bzip2recover
# programs
make
# Become root to remove old files and install it
su
# If you are not 64-bit, use /lib instead of /lib64 below
# You may want to save a copy of /lib64/libbz2.so.1.0.? before doing this
# (if it's from the aaa_elflibs or bzip2 package)
test -x /sbin/removepkg && /sbin/removepkg bzip2
# Remove old bzip2 files, and symlinks but not the .so.1.0.X file
for pfx in /usr /usr/local;
do
( cd ${pfx}/bin
rm -f bzcmp bzdiff bzegrep bzfgrep bzgrep bzip2recover bzless bzmore )
( cd ${pfx}/lib64
test -L libbz2.so.1.0 && rm libbz2.so.1.0
test -L libbz2.so.1 && rm libbz2.so.1
test -L libbz2.so && rm libbz2.so )
( cd ${pfx}/man/cat1 &&
rm -f bzip2.1 bzip2.1.gz )
( cd ${pfx}/man/man1
rm -f bzip2.1 bzip2.1.gz bzip2recover.1 bzip2recover.1.gz )
rm -f ${pfx}/include/bzlib.h
done
( cd /bin
rm -f bzcmp bzdiff bzegrep bzfgrep bzgrep bzip2 bzip2recover bzless bzmore )
( cd /lib64
test -L libbz2.so.1.0 && rm libbz2.so.1.0
test -L libbz2.so.1 && rm libbz2.so.1
test -L libbz2.so && rm libbz2.so )
# There is a 'make install' but it has /lib/ hard set, doesn't use a LIBDIR,
# etc... This part here is super-duper-overkill, but we know what's
# happening...
# Install the library files in /usr/lib64 and some symlinks
install -m 755 libbz2.a /usr/lib64/
install -m 755 libbz2.so.1.0.8 /lib64/
ln -s /lib64/libbz2.so.1.0.8 /lib64/libbz2.so.1.0
ln -s /lib64/libbz2.so.1.0 /lib64/libbz2.so.1
ln -s /lib64/libbz2.so.1 /usr/lib64/libbz2.so
ldconfig
# Install bzip2 and bzip2recover in /bin
test ! -f bzip2-static && mv -f bzip2 bzip2-static
cp -a bzip2-shared bzip2
install -m 755 -s bzip2 bzip2recover /bin/
ln -sf /bin/bzip2 /bin/bunzip2
ln -sf /bin/bzip2 /bin/bzcat
## If you care about such things, you may want to open up
## /var/adm/packages/*elflibs* in a text editor and remove the lines
## that refer to these [ Slackware 8.1, 12.2, 14.2 ]:
# lib/incoming/libbz2.so.1.0.2
# lib/libbz2.so.1.0.4
# lib64/libbz2.so.1.0.6
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/bzip2-*.tar.*
mv bzip2-1.0.8.tar.gz installed/