50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================================
|
|
# DarkForge Linux — Phase 3, Chapter 8.14: M4
|
|
# ============================================================================
|
|
# Purpose: Build and install m4, the macro processing language.
|
|
# M4 is a dependency for autoconf/automake and other build tools.
|
|
# Required for building other packages in Phase 3+.
|
|
# Inputs: /sources/m4-1.4.21.tar.xz
|
|
# Outputs: /usr/bin/m4
|
|
# Ref: LFS 13.0 §8.14
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
source /sources/toolchain-scripts/100-chroot-env.sh
|
|
|
|
PACKAGE="m4"
|
|
VERSION="1.4.21"
|
|
|
|
echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ==="
|
|
|
|
pkg_extract "${PACKAGE}-${VERSION}.tar.xz"
|
|
cd "${PACKAGE}-${VERSION}"
|
|
|
|
# Configure m4 for the target system
|
|
./configure --prefix=/usr
|
|
|
|
# Build m4
|
|
make
|
|
|
|
# Run tests to ensure build is correct
|
|
make check
|
|
|
|
# Install m4
|
|
make install
|
|
|
|
# Verify installation
|
|
if [ -x /usr/bin/m4 ]; then
|
|
echo "PASS: m4 binary installed"
|
|
else
|
|
echo "FAIL: m4 binary not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Test m4
|
|
echo "define(HELLO, Hello World)" | /usr/bin/m4 | grep -q "Hello World" && \
|
|
echo "PASS: m4 works correctly"
|
|
|
|
pkg_cleanup "${PACKAGE}-${VERSION}"
|
|
echo "=== ${PACKAGE}-${VERSION} complete ==="
|