Big script
This commit is contained in:
60
toolchain/scripts/112-bc.sh
Executable file
60
toolchain/scripts/112-bc.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# ============================================================================
|
||||
# DarkForge Linux — Phase 3, Chapter 8.15: Bc
|
||||
# ============================================================================
|
||||
# Purpose: Build and install bc, an arbitrary-precision arithmetic language.
|
||||
# Bc is a small but useful calculator utility for scripts and users.
|
||||
# Inputs: /sources/bc-7.0.3.tar.xz
|
||||
# Outputs: /usr/bin/bc, /usr/bin/dc
|
||||
# Ref: LFS 13.0 §8.15
|
||||
# ============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
source /sources/toolchain-scripts/100-chroot-env.sh
|
||||
|
||||
PACKAGE="bc"
|
||||
VERSION="7.0.3"
|
||||
|
||||
echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ==="
|
||||
|
||||
pkg_extract "${PACKAGE}-${VERSION}.tar.xz"
|
||||
cd "${PACKAGE}-${VERSION}"
|
||||
|
||||
# Configure bc for the target system
|
||||
# Note: bc's configure script is unusual; it's a custom ./configure
|
||||
./configure --prefix=/usr \
|
||||
-G \
|
||||
-O2 \
|
||||
--mandir=/usr/share/man
|
||||
|
||||
# Build bc
|
||||
# The -j flag for make often doesn't work with bc's custom build system
|
||||
# So we don't use it here
|
||||
make
|
||||
|
||||
# Run tests
|
||||
make test
|
||||
|
||||
# Install bc
|
||||
make install
|
||||
|
||||
# Verify installation
|
||||
if [ -x /usr/bin/bc ]; then
|
||||
echo "PASS: bc binary installed"
|
||||
else
|
||||
echo "FAIL: bc binary not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/dc ]; then
|
||||
echo "PASS: dc binary installed"
|
||||
else
|
||||
echo "FAIL: dc binary not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test bc
|
||||
echo "2 + 2" | /usr/bin/bc | grep -q "4" && echo "PASS: bc works correctly"
|
||||
|
||||
pkg_cleanup "${PACKAGE}-${VERSION}"
|
||||
echo "=== ${PACKAGE}-${VERSION} complete ==="
|
||||
Reference in New Issue
Block a user