Files
darkforge/toolchain/scripts/010-diffutils.sh
2026-03-20 12:03:59 +01:00

39 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# DarkForge Linux — Phase 0, Chapter 6: Diffutils
# ============================================================================
# Purpose: Cross-compile GNU diffutils (diff, cmp, sdiff, diff3).
# Inputs: ${LFS}/sources/diffutils-3.12.tar.xz
# Outputs: diff utilities in ${LFS}/usr/bin/
# Ref: LFS 13.0 §6.6
# ============================================================================
set -euo pipefail
source "${LFS}/sources/darkforge-env.sh"
PACKAGE="diffutils"
VERSION="3.12"
SRCDIR="${LFS}/sources"
echo "=== Building ${PACKAGE}-${VERSION} (Temporary Tool) ==="
cd "${SRCDIR}"
tar -xf "${PACKAGE}-${VERSION}.tar.xz"
cd "${PACKAGE}-${VERSION}"
# gl_cv_func_strcasecmp_works: diffutils 3.12 tries to run a test binary to
# check if strcasecmp works. This fails during cross-compilation. We know
# glibc's strcasecmp is correct, so we tell configure the answer directly.
./configure \
--prefix=/usr \
--host="${LFS_TGT}" \
--build="$(./build-aux/config.guess)" \
gl_cv_func_strcasecmp_works=yes
make
make DESTDIR="${LFS}" install
cd "${SRCDIR}"
rm -rf "${PACKAGE}-${VERSION}"
echo "=== ${PACKAGE}-${VERSION} complete ==="