#!/bin/bash # ============================================================================ # DarkForge Linux — Phase 0, Chapter 7: Zlib (Chroot) # ============================================================================ # Purpose: Build zlib inside the chroot. The binutils linker (ld) from pass 2 # was built with zlib support and dynamically links against libz.so.1. # Without zlib installed, ld fails with: # "error while loading shared libraries: libz.so.1" # This must be the FIRST thing built in the chroot, before any # package that needs to link (i.e., everything). # Inputs: /sources/zlib-1.3.2.tar.xz # Outputs: /usr/lib/libz.so.1 # Assumes: Running inside chroot # ============================================================================ set -euo pipefail PACKAGE="zlib" VERSION="1.3.2" echo "=== Building ${PACKAGE}-${VERSION} (Chroot — ld dependency) ===" cd /sources tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" ./configure --prefix=/usr make make install # Verify libz.so.1 exists if [ -f /usr/lib/libz.so.1 ]; then echo " PASS: /usr/lib/libz.so.1 exists" else echo " FAIL: /usr/lib/libz.so.1 NOT FOUND after install!" exit 1 fi cd /sources rm -rf "${PACKAGE}-${VERSION}" echo "=== ${PACKAGE}-${VERSION} complete ==="