Installing Bzip2

Installation of Bzip2

Install Bzip2 by running the following commands:


sed \
���s/"\$(CC) \$(CFLAGS) -o"/"\$(CC) \$(CFLAGS) \$(LDFLAGS) -o"/ \
���Makefile | make -f - LDFLAGS=-static &&
make PREFIX=$LFS/usr install &&
cd $LFS/usr/bin &&
mv bzcat bunzip2 bzip2 bzip2recover $LFS/bin

Command explanations

sed: The sed command here searches for the string "$(CC) $(CFLAGS) -o" and replaces it by "$(CC) $(CFLAGS) $(LDFLAGS) -o" in the Makefile file. We make that modification so it will be easier to link bzip2 statically.

...Makefile | make -f -: Makefile is the last parameter of the sed command which indicates the file to search and replace in. Sed normally sends the modified file to stdout (standard output), which will be the console. With the construction we use, sed's output will be piped to the make program. Normally, when make is started, it tries to find a number of files like Makefile. But we have modified the Makefile file so we don't want make to use it. The "-f -" parameter tells make to read it's input from another file, or from stdin (standard input) which the dash (-) implies. This is one way to do it. Another way would be to have sed write the output to a different file and tell make with the -f parameter to read that alternate file.

LDFLAGS=-static: This is the second way we use to link a package statically. This is also the most common way. The -all-static value is only used with the binutils and the gettext packages and won't be used throughout the rest of this book.

Contents

The Bzip2 packages contains the bzip2, bunzip2, bzcat and bzip2recover programs.

Description

Bzip2

bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors.

Bunzip2

Bunzip2 decompresses files that are compressed with bzip2.

bzcat

bzcat (or bzip2 -dc) decompresses all specified files to the standard output.

bzip2recover

bzip2recover recovers data from damaged bzip2 files.