archlinux-s390x/patches/pkgbuild/gettext.sh
Mathieu Benoit 09ef26798a [FIX] the build host answered questions the target should
Five packages, one shape: a default computed from this machine rather than
from Arch, and arch-meson's --auto-features enabled turning what was optional
into a requirement.

dbus taught the method. It stopped three times in a row on a different
documentation tool -- ducktype, then yelp-build, then qhelpgenerator. The
first two were installed. The third needs Qt, so the chain had no end. All
three are `auto` features promoted to mandatory; pinned off, they cost
nothing. A single missing library is a host dependency. A queue of them is a
feature that should be disabled.

pinentry wanted Qt6 for a passphrase prompt; tty and curses remain.
krb5 asked for a system ss library Ubuntu ships no headers for, and said
"cannot run test program" instead of saying so.
sqlite found tcl, then installed into share/tcltk because Ubuntu's
tclConfig.sh says so and Arch's says lib.
gettext linked the host's libselinux, silently -- the sixth package to do it,
and the first the audit caught rather than a build.

--- FR ---

Cinq paquets, une seule forme : une valeur par défaut calculée depuis cette
machine plutôt que depuis Arch, et le --auto-features enabled d'arch-meson qui
transforme l'optionnel en exigence.

dbus a enseigné la méthode. Il s'est arrêté trois fois de suite sur un outil
de documentation différent — ducktype, puis yelp-build, puis qhelpgenerator.
Les deux premiers ont été installés. Le troisième exige Qt : la chaîne ne
terminait nulle part. Les trois sont des features `auto` promues en
obligations ; épinglées à disabled, elles ne coûtent rien. Une bibliothèque
manquante est une dépendance hôte. Une file d'attente en est une
fonctionnalité à désactiver.

pinentry réclamait Qt6 pour une invite de mot de passe ; tty et curses
suffisent.
krb5 demandait une bibliothèque ss système dont Ubuntu ne livre aucun
en-tête, et annonçait « cannot run test program » plutôt que de le dire.
sqlite trouvait tcl, puis installait dans share/tcltk parce que le
tclConfig.sh d'Ubuntu le dit là où celui d'Arch dit lib.
gettext liait le libselinux de l'hôte, en silence — sixième paquet à le
faire, et le premier que l'audit a pris plutôt qu'une compilation.

Assisted-by: Claude Opus 5
2026-08-19 05:28:32 -04:00

36 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# gettext: --without-selinux. The sixth package to pick up the host's
# libselinux, and the first one nothing warned about.
#
# $ readelf -d usr/lib/libgettextlib-1.0.so | grep NEEDED
# (NEEDED) Shared library: [libselinux.so.1]
#
# Nothing failed. gettext built, passed, and went into the repository with a
# library linked against something Arch has no package for -- the artefact
# audit is the only thing that found it, exactly as it found coreutils,
# findutils, sed and tar before it.
#
# WHY IT CAME BACK. Those four were fixed with per-package hooks, and the
# reasoning at the time was that the same gnulib probe "catches findutils, sed
# and tar" -- a list of the packages then in the build. gettext was not in the
# port yet. It arrived with the dependency closure, uses gnulib too, probes
# selinux/selinux.h unconditionally, and found Ubuntu's libselinux1-dev
# sitting where it always was.
#
# So this is the fifth copy of one three-line fix, and that is the real
# finding: the per-package hook does not scale to a probe that any gnulib
# package can trip. The alternative -- exporting
# ac_cv_header_selinux_selinux_h=no once in build_package -- was considered
# and rejected when coreutils was fixed, on the grounds that a global cache
# override is invisible at the point where it acts. That trade has now been
# paid for five times. TODO.md records it as a decision to revisit rather than
# leaving the next person to rediscover the arithmetic.
#
# Arch's gettext links no libselinux, so this converges with Arch.
set -euo pipefail
grep -q '^ --without-included-libunistring$' PKGBUILD || {
echo "gettext: configure block not in the expected form" >&2; exit 1; }
sed -i 's|^\( --without-included-libunistring\)$|\1 \\\n --without-selinux|' PKGBUILD
[ "$(grep -c -- '--without-selinux' PKGBUILD)" = 1 ] || {
echo "gettext: --without-selinux not inserted exactly once" >&2; exit 1; }
echo "gettext: --without-selinux (gnulib found the host's libselinux)"