#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 3, Chapter 8: patch # ============================================================================ # Purpose: Build GNU patch (applies patches to files). # Essential for applying LFS and DarkForge patches to source code. # Inputs: /sources/patch-2.7.6.tar.xz # Outputs: patch binary in /usr/bin/ # Assumes: Running inside chroot # Ref: LFS 13.0 §8.72 # ============================================================================ set -euo pipefail source /sources/toolchain-scripts/100-chroot-env.sh PACKAGE="patch" VERSION="2.7.6" echo "=== Building ${PACKAGE}-${VERSION} ===" cd /sources tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" ./configure --prefix=/usr make # Optional: run tests # make check || true make install cd /sources rm -rf "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete ==="