64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================================
|
|
# DarkForge Linux — Phase 3, Chapter 8.7: Bzip2
|
|
# ============================================================================
|
|
# Purpose: Build and install bzip2 compression utility and library.
|
|
# Needed for compressing/decompressing bzip2 archives.
|
|
# Inputs: /sources/bzip2-1.0.8.tar.gz, /sources/bzip2-1.0.8-install_docs-1.patch
|
|
# Outputs: /usr/bin/bzip2, /usr/lib/libbz2.so.1
|
|
# Ref: LFS 13.0 §8.7
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
source /sources/toolchain-scripts/100-chroot-env.sh
|
|
|
|
PACKAGE="bzip2"
|
|
VERSION="1.0.8"
|
|
|
|
echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ==="
|
|
|
|
pkg_extract "${PACKAGE}-${VERSION}.tar.gz"
|
|
cd "${PACKAGE}-${VERSION}"
|
|
|
|
# Apply LFS patch to install documentation
|
|
echo ">>> Applying bzip2-1.0.8-install_docs-1.patch..."
|
|
patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch
|
|
|
|
# Bzip2 uses a Makefile (not autoconf)
|
|
# Compile bzip2
|
|
make -f Makefile-libbz2_so
|
|
make clean
|
|
|
|
# Build bzip2 normally (static version for bzip2 binary)
|
|
make
|
|
|
|
# Install bzip2
|
|
make PREFIX=/usr install
|
|
|
|
# The Makefile builds dynamic libraries; we need to install them
|
|
# Install the dynamic library we built
|
|
cp bzip2-shared /bin/bzip2
|
|
cp libbz2.so.1.0.8 /lib/
|
|
ln -s libbz2.so.1.0.8 /lib/libbz2.so.1
|
|
|
|
# Create symlink in /usr/lib (some packages look there)
|
|
ln -s /lib/libbz2.so.1 /usr/lib/libbz2.so
|
|
|
|
# Verify installation
|
|
if [ -x /bin/bzip2 ]; then
|
|
echo "PASS: bzip2 binary installed"
|
|
else
|
|
echo "FAIL: bzip2 binary not found"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f /lib/libbz2.so.1.0.8 ]; then
|
|
echo "PASS: libbz2.so installed"
|
|
else
|
|
echo "FAIL: libbz2.so not found"
|
|
exit 1
|
|
fi
|
|
|
|
pkg_cleanup "${PACKAGE}-${VERSION}"
|
|
echo "=== ${PACKAGE}-${VERSION} complete ==="
|