6.12. pigz 2.8
pigz is a parallel gzip-compatible compressor and decompressor.
Input assumption:
pigz-2.8.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Licenses:
- zlib License
Dependencies:
- musl (libc)
- make
- zlib-ng (libz)
- pthreads
pigz is a parallel gzip-compatible compressor and decompressor. we need it to replace gzip functionality in the target userspace with multi-core capable compression and decompression.
Replacement Symlinks
To replace gzip-family commands, this package should provide these command names in PATH:
gzip->pigzgunzip->unpigzzcat->unpigz
Optional additional compatibility names can be added later as needed.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
tar -xf pigz-2.8.tar.gz
cd pigz-2.8
Build pigz
make $LWI_MAKE_FLAGS \
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang" \
CFLAGS="-O3 -Wall -Wextra -Wno-unknown-pragmas -Wcast-qual --target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS" \
LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT -L$LBI_ROOT/system/libraries $LBI_CUSTOM_LDFLAGS"
Install pigz
install -Dm755 pigz "$LBI_ROOT/system/binaries/pigz"
install -Dm755 unpigz "$LBI_ROOT/system/binaries/unpigz"
install -Dm644 pigz.1 "$LBI_ROOT/system/documentation/man-pages/man1/pigz.1"
Install gzip Compatibility Symlinks
ln -sf pigz "$LBI_ROOT/system/binaries/gzip"
ln -sf unpigz "$LBI_ROOT/system/binaries/gunzip"
ln -sf unpigz "$LBI_ROOT/system/binaries/zcat"
Command Explanations
make $LWI_MAKE_FLAGS: Builds pigz with the shared make parallelism setting.CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang": Uses the target-prefixed Clang compiler.CFLAGS="-O3 ... --target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS": Keeps upstream's optimization and warning flags while targeting the selected sysroot and preserving local C flag tuning.LDFLAGS="--target=$LBI_TARGET --sysroot=$LBI_ROOT -L$LBI_ROOT/system/libraries $LBI_CUSTOM_LDFLAGS": Links against target libraries, including the zlib-compatible library installed under/system/libraries.install -Dm755 pigz ...: Installs the compressor binary and creates parent directories as needed.install -Dm755 unpigz ...: Installs the decompressor binary alongsidepigz.install -Dm644 pigz.1 ...: Installs the manual page into the book's man-page tree.ln -sf pigz "$LBI_ROOT/system/binaries/gzip": Provides the standardgzipcommand name through pigz.ln -sf unpigz ... gunzipandln -sf unpigz ... zcat: Provides gzip-family decompression command names throughunpigz.