#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 0, Chapter 6: Grep # ============================================================================ # Purpose: Cross-compile GNU grep (pattern matching). # Inputs: ${LFS}/sources/grep-3.12.tar.xz # Outputs: grep in ${LFS}/usr/bin/ # Ref: LFS 13.0 §6.10 # ============================================================================ set -euo pipefail source "${LFS}/sources/darkforge-env.sh" PACKAGE="grep" VERSION="3.12" SRCDIR="${LFS}/sources" echo "=== Building ${PACKAGE}-${VERSION} (Temporary Tool) ===" cd "${SRCDIR}" tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" # Cross-compile cache overrides: grep 3.12 tries to run test binaries for # strcasecmp and fnmatch. We know glibc provides correct implementations. ./configure \ --prefix=/usr \ --host="${LFS_TGT}" \ --build="$(./build-aux/config.guess)" \ gl_cv_func_strcasecmp_works=yes \ gl_cv_func_fnmatch_gnu=yes make make DESTDIR="${LFS}" install cd "${SRCDIR}" rm -rf "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete ==="