Files
darkforge/toolchain/CHAPTER8-BATCH3-SUMMARY.md
2026-03-20 15:09:30 +01:00

163 lines
6.8 KiB
Markdown

# 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.sh` which 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 failure
- `set -u` — Exit on undefined variable reference
- `set -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:
```bash
./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/python` symlink to `python3`
#### 141-perl.sh
- Uses Perl's Configure script (not standard autotools)
- Sets `BUILD_ZLIB=False` and `BUILD_BZIP2=0` to use system libs
- Installs full module set for system-wide Perl
#### 150-152 (Python packages: flit-core, wheel, setuptools)
- Use `python3 -m pip install` instead of traditional `./configure; make`
- These are Python packages being installed into Python
#### 146-openssl.sh
- Uses `./config` instead of `./configure`
- Enables both `/lib64` and `/lib` symlinks for compatibility
- Sets `zlib-dynamic` flag for compression support
#### 139-inetutils.sh
- Explicitly disabled: logger, syslogd, ifdconfig, servers (systemd alternatives)
- Moves some utilities to `/usr/sbin` per FHS
## Execution Order
These scripts must run in numerical order (128-154) because of dependencies:
1. **128-148**: Core libraries and utilities needed by subsequent packages
2. **141**: Perl (dependency for intltool, XML-Parser)
3. **142**: XML-Parser (dependency for intltool)
4. **143**: intltool (needs Perl and XML-Parser)
5. **149**: Python (dependency for ninja, meson, and Python packages)
6. **150-152**: Python packages (build tools for Python ecosystem)
7. **153**: ninja (build system for meson)
8. **154**: meson (final build system)
## Testing Notes
These scripts have been syntax-validated but **not yet tested in a chroot environment**. Before first use:
1. Verify source tarballs are present in `/sources/`
2. Test in a VM or container first
3. Monitor build logs for unexpected warnings or errors
4. 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:**
1. Verify all source tarballs are downloaded via `100-download-phase3.sh`
2. Enter chroot environment
3. Execute scripts 128-154 in order
4. Monitor logs for failures
5. After all 27 complete, proceed to Phase 4 (Kernel Configuration)