8.4. pigz stage 2 2.8
Rebuild pigz in the final target environment and provide gzip and bzip2 command-name compatibility links.
Input assumption: pigz-2.8.tar.gz is already present in /sources from the chapter 4 source staging step.
Source URL: https://github.com/madler/pigz/archive/refs/tags/v2.8.tar.gz
Licenses:
- zlib License
Dependencies:
- musl (libc)
- make
pigz is a parallel gzip-compatible compressor and decompressor. we need it to provide final stage compression tools in chapter 8 and compatibility command names for existing workflows.
Extract and Enter the Source Tree
cd /sources
tar -xf pigz-2.8.tar.gz
cd pigz-2.8
Build pigz
make $LWI_MAKE_FLAGS CC=cc
Install pigz
install -Dm755 pigz /system/binaries/pigz
install -Dm755 unpigz /system/binaries/unpigz
install -Dm644 pigz.1 /system/documentation/man-pages/man1/pigz.1
Install compatibility symlinks
ln -sf pigz /system/binaries/gzip
ln -sf unpigz /system/binaries/gunzip
ln -sf unpigz /system/binaries/zcat
ln -sf pigz /system/binaries/bzip2
ln -sf unpigz /system/binaries/bunzip2
ln -sf unpigz /system/binaries/bzcat
The
bzip2-family links above provide command-name compatibility to pigz/unpigz in this layout.
After this step is complete, you can remove the extracted source directory and source tarball from
/sources if you do not plan to rebuild pigz again.
Command Explanations
cd /sources,tar -xf, andcd pigz-...: Enter the staged pigz source tree.make $LWI_MAKE_FLAGS CC=cc: Builds pigz with the target C compiler and shared make parallelism.install -Dm755 pigzandinstall -Dm755 unpigz: Install compressor and decompressor commands, creating directories as needed.install -Dm644 pigz.1: Installs the manual page.ln -sf pigz ... gzipandln -sf unpigz ...: Provide gzip and bzip2 family compatibility command names.