Linux HOWTOs

About | Home | Search


HOWTO: bzip2
Description: A block-sorting file compressor
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# bzip2 1.0.6
# ===========
# Slackware 11.0: bzip2 1.0.3
# Slackware 12.0: bzip2 1.0.4
# Slackware 12.1, 12.2, 13.0, 13.1: bzip2 1.0.5

cd
test -f installed/bzip2-1.0.6.tar.gz && mv installed/bzip2-1.0.6.tar.gz .
test ! -f bzip2-1.0.6.tar.gz &&
 wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz

# Verify tarball w/ md5sum:
echo "00b516f4704d4a7cb50a1d97e6e8e15b  bzip2-1.0.6.tar.gz" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "bzip2-*" -exec rm -r {} \;
tar xzvf ~/bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
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

# Remove old bzip2 files
test -x /sbin/removepkg && /sbin/removepkg bzip2
for pfx in /usr /usr/local;
do
  ( cd $pfx/bin && rm -f bzcmp bzegrep bzfgrep bzless )
  ( cd $pfx/man &&
    rm -f cat1/bzip2.1.gz man1/bzip2.1.gz man1/bzip2recover.1.gz )
  rm -f $pfx/include/bzlib.h $pfx/lib/libbz2.*
done
rm -f /bin/bzip2 /bin/bzip2recover /lib/libbz2.*

# Install everything
mv -f bzip2 bzip2-static
cp -a bzip2-shared bzip2
strip bzip2 bzip2recover
cp -a libbz2.so.1.0.6 /lib/
ln -s /lib/libbz2.so.1.0.6 /lib/libbz2.so.1.0
ln -s /lib/libbz2.so.1.0 /lib/libbz2.so.1
ln -s /lib/libbz2.so.1 /usr/lib/libbz2.so
make install PREFIX=/usr
ln -s /usr/bin/bzip2 /bin/bzip2
ln -s /usr/bin/bzip2recover /bin/bzip2recover
ldconfig

## 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 (the first is Slackware 8.1, the 2nd is 12.2):
# lib/incoming/libbz2.so.1.0.2
# lib/libbz2.so.1.0.4

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/bzip2-*.tar.*
mv bzip2-1.0.6.tar.gz installed/

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>