5.13. Installing Gzip-1.2.4a

Estimated build time:           1 minute
Estimated required disk space:  2 MB

5.13.1. Installation of Gzip

Before Gzip is installed, the patch file may need to be applied. This patch file is necessary to avoid a conflict of variable names with Glibc-2.0 systems when compiling and linking statically and so is only required if your base system runs Glibc-2.0. It is however safe to apply the patch even if you are running a different glibc version, so if you aren't sure, it's best to apply it.

Apply the patch by running the following command:

patch -Np1 -i ../gzip-1.2.4a.patch

Install Gzip by running the following commands:

./configure --prefix=$LFS/usr &&
make LDFLAGS=-static &&
make install &&
cp $LFS/usr/bin/gunzip $LFS/usr/bin/gzip $LFS/bin &&
rm $LFS/usr/bin/gunzip $LFS/usr/bin/gzip

5.13.2. Command explanations

cp $LFS/usr/bin/gunzip $LFS/usr/bin/gzip $LFS/bin && rm $LFS/usr/bin/gunzip $LFS/usr/bin/gzip: The reason we don't simply use "mv" to move the files to the new location is because gunzip is a hardlink to gzip. On older distributions you can't move a hardlink to another partition (and it's very possible that $LFS and $LFS/usr are separate partitions). With more recent distributions this isn't a problem. If you run mv to move hardlinks across partitions it'll just do a regular "cp" and discard the hardlink. But, we can't assume that every host distribution has a new enough kernel and fileutils that works this way.

5.13.3. Contents of gzip-1.2.4a

5.13.4. Dependencies

Gzip-1.2.4a needs the following to be installed:


bash: sh
binutils: as, ld, nm
fileutils: chmod, cp, install, ln, mv, rm
gcc: cc1, collect2, cpp, cpp0, gcc
grep: egrep, grep
make: make
sed: sed
sh-utils: hostname
textutils: cat, tr