#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 3, Chapter 8.12: Readline # ============================================================================ # Purpose: Build and install the readline library. # Readline provides command-line editing and history to programs like # bash, gdb, and many other interactive tools. # Inputs: /sources/readline-8.3.tar.gz # Outputs: /usr/lib/libreadline.so, /usr/include/readline/readline.h # Ref: LFS 13.0 §8.12 # ============================================================================ set -euo pipefail source /sources/toolchain-scripts/100-chroot-env.sh PACKAGE="readline" VERSION="8.3" echo "=== Building ${PACKAGE}-${VERSION} (Phase 3) ===" pkg_extract "${PACKAGE}-${VERSION}.tar.gz" cd "${PACKAGE}-${VERSION}" # Configure readline for the target system # --with-curses: Use ncurses for terminal handling # --disable-static: Build only shared libraries (smaller install) ./configure --prefix=/usr \ --disable-static \ --with-curses # Build readline make SHLIB_LIBS="-lncurses" # Install readline make SHLIB_LIBS="-lncurses" install # Install documentation install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-${VERSION} # Verify installation if [ -f /usr/lib/libreadline.so ]; then echo "PASS: libreadline.so installed" else echo "FAIL: libreadline.so not found" exit 1 fi pkg_cleanup "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete ==="