#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 3, Chapter 8.10: Zstd # ============================================================================ # Purpose: Build and install Zstandard compression library and tools. # Zstd offers better compression than gzip with reasonable speed. # Increasingly used by modern Linux systems and tools. # Inputs: /sources/zstd-1.5.7.tar.gz # Outputs: /usr/bin/zstd, /usr/lib/libzstd.so # Ref: LFS 13.0 §8.10 # ============================================================================ set -euo pipefail source /sources/toolchain-scripts/100-chroot-env.sh PACKAGE="zstd" VERSION="1.5.7" echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ===" pkg_extract "${PACKAGE}-${VERSION}.tar.gz" cd "${PACKAGE}-${VERSION}" # Zstd uses a Makefile (not autoconf) # Build zstd # Note: Zstd build can be slow due to its heavy optimization make # Run tests (optional) make test || true # Install zstd make PREFIX=/usr DESTDIR=/ install # Verify symlinks are correct if [ -L /usr/lib/libzstd.so ]; then echo "PASS: libzstd.so symlink exists" else echo "FAIL: libzstd.so symlink not found" exit 1 fi if [ -x /usr/bin/zstd ]; then echo "PASS: zstd binary installed" else echo "FAIL: zstd binary not found" exit 1 fi pkg_cleanup "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete ==="