# Importada de nixpkgs por `hammer import-nix` (Etapa G). PUNTO DE PARTIDA, no final: # de-Alpinizada al lab de hammer (zig-cc / musl estático). Objetivo mínimo: # mount/umount/lsblk/blkid/fdisk/lscpu (utilería base del sistema). name = "util-linux" version = "2.42.2" license = "GPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-3-Clause" [source] tarball = "https://www.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.2.tar.xz" sha256 = "03a05d3adf9602ef128f2da05b84b3205ce60c351e5737c0370f74000679ce8a" [build] compiler = "zig-cc" target = "x86_64-linux-musl" link = "static" flags = [] [build.phases] # fase configure EXPLÍCITA: si la receta no la define, hammer autogenera su propio # `./configure --prefix=/usr` (sin nuestros --disable-*) e ignora estos flags. # # ESTÁTICO: libtool se COME el `-static` de LDFLAGS (lo lee como "static libtool # libs", no como link real) ⇒ el único camino a binarios musl 100% estáticos es # `--enable-static-programs`, que SÓLO soporta # blkid,fdisk,losetup,mount,nsenter,partx,sfdisk,umount,unshare. Produce # {mount,umount,blkid,fdisk}.static (verificados corriendo en el host). lsblk y # lscpu NO están en esa lista ⇒ quedan dinámicos-musl: construyen y corren en la # distro musl, pero en un host glibc segfaultean por loader-skew (no verificables # acá). El resto de binarios (lsblk/lscpu/...) son musl-dinámicos. configure = ''' ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --localstatedir=/var \ --sysconfdir=/etc \ --disable-shared \ --enable-static \ --enable-static-programs=blkid,fdisk,mount,umount \ --disable-nls \ --disable-rpath \ --disable-liblastlog2 \ --disable-pylibmount \ --disable-makeinstall-setuid \ --disable-makeinstall-chown \ --without-python \ --without-systemd \ --without-systemdsystemunitdir \ --without-udev \ --without-cryptsetup \ --without-ncursesw \ --without-ncurses \ --without-tinfo \ --without-readline \ --without-libz \ --without-selinux \ --without-audit \ --without-econf ''' compile = ''' # zig cc traduce `-mcpu=baseline` a un `-mcpu=` VACÍO en modo preprocesador # (`-dM -E -`), que zig rechaza. Los generadores errnos.h/syscalls.h de # util-linux invocan `$(CC) -dM -E -` ⇒ filtramos ese flag (irrelevante para # extraer #defines) sólo en esos dos scripts; el resto del build lo conserva. for f in tools/all_errnos tools/all_syscalls; do sed -i 's#^"$@" -MD#a=(); for x in "$@"; do [ "$x" = "-mcpu=baseline" ] || a+=("$x"); done\n"${a[@]}" -MD#' "$f" done make LDFLAGS="-all-static -no-pie" ''' install = ''' make DESTDIR="/out" install LDFLAGS="-all-static -no-pie" ''' # deps de Alpine/nix remapeadas al catálogo canónico. AUSENTES quitadas: # autoconf/automake/po4a/libxcrypt/sqlite/linux-pam/libcap-ng/systemd-minimal-libs. [deps] build = ["linux-headers", "make"]