Files
darkforge/toolchain/scripts/119-gmp.sh
2026-03-20 15:09:30 +01:00

41 lines
1.2 KiB
Bash

#!/bin/bash
# ============================================================================
# DarkForge Linux — Phase 3, Chapter 8.22: GMP (GNU Multiple Precision)
# ============================================================================
# Purpose: Build GMP, a library for arbitrary-precision arithmetic.
# Required by GCC for floating-point operations in the compiler.
# Inputs: /sources/gmp-6.3.0.tar.xz
# Outputs: GMP library in /usr/lib, headers in /usr/include
# Ref: LFS 13.0 §8.22
# ============================================================================
set -euo pipefail
source /sources/toolchain-scripts/100-chroot-env.sh
PACKAGE="gmp"
VERSION="6.3.0"
echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ==="
pkg_extract "${PACKAGE}-${VERSION}.tar.xz"
cd "${PACKAGE}-${VERSION}"
# Build GMP with optimization for x86_64 (znver5 will inherit from CFLAGS)
# --enable-cxx: build C++ bindings for GCC
./configure \
--prefix=/usr \
--enable-cxx \
--disable-static
make
make html
make install
make install-html
# Verify installation
echo "GMP version: $(/usr/bin/gmp-config --version 2>/dev/null || echo 'GMP installed')"
cd "${SRCDIR}"
pkg_cleanup "${PACKAGE}-${VERSION}"
echo "=== ${PACKAGE}-${VERSION} complete ==="