6.8 KiB
DarkForge Linux — Chapter 8 Build Scripts, Batch 3 (128-154)
Created: 2026-03-20 Phase: Phase 3 (Chroot Environment) Reference: LFS 13.0 §8.31 through §8.59 Status: All 27 scripts created, syntax-validated, executable
Overview
This batch completes the LFS Chapter 8 build sequence inside the chroot environment. These scripts build the full base system packages needed for a functional Linux distribution. All scripts are designed to run in the chroot environment where:
- The system compiler is the native compiler (targeting znver5)
- Environment sourced from
/sources/toolchain-scripts/100-chroot-env.shwhich sets:CFLAGS="-march=znver5 -O2 -pipe -fomit-frame-pointer"MAKEFLAGS="-j32"(32 threads on 16-core CPU)LDFLAGS="-Wl,-O1,--as-needed"
Script Index (27 scripts)
| Script | Package | Version | Purpose | LFS Ref |
|---|---|---|---|---|
| 128-ncurses.sh | ncurses | auto-detected | Terminal library with wide-char support | §8.31 |
| 129-sed.sh | sed | 4.9 | Stream editor | §8.32 |
| 130-psmisc.sh | psmisc | 23.7 | Process utilities (killall, pstree, fuser) | §8.33 |
| 131-gettext.sh | gettext | 1.0 | Internationalization + msgfmt | §8.34 |
| 132-bison.sh | bison | 3.8.2 | Parser generator | §8.35 |
| 133-grep.sh | grep | 3.12 | Text search utility | §8.36 |
| 134-bash.sh | bash | 5.3 | Final shell + /bin/sh symlink | §8.37 |
| 135-libtool.sh | libtool | 2.5.4 | Generic library support script | §8.38 |
| 136-gdbm.sh | gdbm | 1.24 | GNU database manager | §8.39 |
| 137-gperf.sh | gperf | 3.1 | Perfect hash generator | §8.40 |
| 138-expat.sh | expat | 2.7.1 | XML parsing library | §8.41 |
| 139-inetutils.sh | inetutils | 2.6 | Network utilities (no systemd) | §8.42 |
| 140-less.sh | less | 668 | Text pager | §8.43 |
| 141-perl.sh | perl | 5.40.2 | Final Perl + full modules | §8.44 |
| 142-xml-parser.sh | XML-Parser | 2.47 | Perl XML::Parser module | §8.45 |
| 143-intltool.sh | intltool | 0.51.0 | Internationalization tools | §8.46 |
| 144-autoconf.sh | autoconf | 2.72 | Source configuration automation | §8.47 |
| 145-automake.sh | automake | 1.17 | Makefile generator | §8.48 |
| 146-openssl.sh | openssl | 3.5.0 | Crypto + TLS (shared + PIC) | §8.49 |
| 147-libelf.sh | elfutils | 0.192 | ELF binary library | §8.50 |
| 148-libffi.sh | libffi | 3.4.7 | Foreign function interface | §8.51 |
| 149-python.sh | Python | 3.13.3 | Final Python 3 + SQLite | §8.52-53 |
| 150-flit-core.sh | flit-core | 3.11.0 | Python PEP 517 backend | §8.54 |
| 151-wheel.sh | wheel | 0.45.1 | Python wheel format | §8.55-56 |
| 152-setuptools.sh | setuptools | 78.1.0 | Python package build | §8.57 |
| 153-ninja.sh | ninja | 1.12.1 | Fast build system | §8.58 |
| 154-meson.sh | meson | 1.7.0 | Modern build system | §8.59 |
Key Design Decisions
Error Handling
All scripts use set -euo pipefail for strict error handling:
set -e— Exit on any command failureset -u— Exit on undefined variable referenceset -o pipefail— Propagate pipe failures
Environment Management
All scripts source /sources/toolchain-scripts/100-chroot-env.sh which provides:
- Hardware-specific compiler flags for AMD Zen 5 (znver5)
- Build parallelization (
MAKEFLAGS=-j32) - Helper functions:
pkg_extract(),pkg_cleanup()
Configuration Pattern
Standard configuration approach:
./configure \
--prefix=/usr \
--disable-static \ # Use shared libraries where possible
[package-specific-flags]
make
make install
Library Symlinks
Some scripts create compatibility symlinks (e.g., libcrypto.so → libcrypto.so.3) to support packages expecting older library naming.
Special Cases
149-python.sh
- Builds SQLite as a dependency (sqlite-autoconf-3490100) before Python
- Enables optimizations and sqlite3 extensions
- Creates
/usr/bin/pythonsymlink topython3
141-perl.sh
- Uses Perl's Configure script (not standard autotools)
- Sets
BUILD_ZLIB=FalseandBUILD_BZIP2=0to use system libs - Installs full module set for system-wide Perl
150-152 (Python packages: flit-core, wheel, setuptools)
- Use
python3 -m pip installinstead of traditional./configure; make - These are Python packages being installed into Python
146-openssl.sh
- Uses
./configinstead of./configure - Enables both
/lib64and/libsymlinks for compatibility - Sets
zlib-dynamicflag for compression support
139-inetutils.sh
- Explicitly disabled: logger, syslogd, ifdconfig, servers (systemd alternatives)
- Moves some utilities to
/usr/sbinper FHS
Execution Order
These scripts must run in numerical order (128-154) because of dependencies:
- 128-148: Core libraries and utilities needed by subsequent packages
- 141: Perl (dependency for intltool, XML-Parser)
- 142: XML-Parser (dependency for intltool)
- 143: intltool (needs Perl and XML-Parser)
- 149: Python (dependency for ninja, meson, and Python packages)
- 150-152: Python packages (build tools for Python ecosystem)
- 153: ninja (build system for meson)
- 154: meson (final build system)
Testing Notes
These scripts have been syntax-validated but not yet tested in a chroot environment. Before first use:
- Verify source tarballs are present in
/sources/ - Test in a VM or container first
- Monitor build logs for unexpected warnings or errors
- Some packages may have platform-specific quirks not covered by the basic scripts
Integration with Other Phases
These scripts are part of Phase 3 (Chroot) and follow Phase 0 (Toolchain) and Phase 1 (First Entry into Chroot).
After successful execution of scripts 128-154, the system should have:
- Complete base system utilities
- Compilers and build tools (gcc, autotools, meson, ninja)
- Programming language support (Perl, Python)
- Cryptography libraries (OpenSSL)
- XML and internationalization support
- All prerequisites for Phase 4 (Kernel Configuration)
File Locations
All 27 scripts are located in:
/sessions/awesome-gallant-bell/mnt/lfs_auto_install/toolchain/scripts/
Filename pattern: NNN-package-name.sh where NNN is 128-154.
References
- LFS Book: /sessions/awesome-gallant-bell/mnt/lfs_auto_install/reference/LFS-BOOK-r13.0-4-NOCHUNKS.html
- Download script: 100-download-phase3.sh (contains version manifest)
- Environment setup: 100-chroot-env.sh (sourced by all scripts)
- Project directive: /sessions/awesome-gallant-bell/mnt/lfs_auto_install/CLAUDE.md
- Changelog: /sessions/awesome-gallant-bell/mnt/lfs_auto_install/docs/CHANGELOG.md
Next Steps:
- Verify all source tarballs are downloaded via
100-download-phase3.sh - Enter chroot environment
- Execute scripts 128-154 in order
- Monitor logs for failures
- After all 27 complete, proceed to Phase 4 (Kernel Configuration)