# util-linux 2.42.2 — VARIANTE SHARED para KDE (override de la canónica static-only en incoming-kde).
# Campaña KDE (ADR 0011), saldo de deuda Capa 0. kcoreaddons (y KF6) linkean libmount, que necesita
# libblkid; con la util-linux canónica (--disable-shared) el link dinámico deja `blkid_* undefined`
# (el .a no arrastra su transitiva). Aquí --enable-shared produce libmount.so/libblkid.so/libuuid.so
# con SONAME + NEEDED correctos (libmount.so → libblkid.so.1) ⇒ linkear -lmount resuelve blkid solo.
# El resolver de deps mira incoming-kde/ antes que recipes/ ⇒ los builds KDE toman ESTA; el base-system
# sigue con la canónica static. Conserva el hack del filtro -mcpu=baseline de los generadores.
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     = "dynamic"
flags    = []

[build.phases]
configure = '''
./configure \
	--build=$CBUILD \
	--host=$CHOST \
	--prefix=/usr \
	--localstatedir=/var \
	--sysconfdir=/etc \
	--enable-shared \
	--disable-static \
	--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 = '''
# ver receta canónica: filtrar -mcpu=baseline sólo en los generadores errnos/syscalls (zig rechaza
# el -mcpu vacío en modo -dM -E -). 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
'''
install = '''
make DESTDIR="/out" install
'''

[deps]
build = ["linux-headers"]
