archlinux-s390x/patches/pkgbuild/fakeroot.sh
Mathieu Benoit ef143aac67 [FIX] s390x: say which machine this port targets
zlib stopped on '__builtin_s390_vec_unpackl' requires '-mvx', after its own
configure had detected vector support and defined -DHAVE_S390X_VX. Both halves
were right, so it was worth measuring rather than patching:

  host gcc (Ubuntu)  --with-arch=z13 --with-tune=z16   default -march=arch11
  our  gcc           nothing                           default -march=arch5

arch5 is z900, from 2000. Arch's PKGBUILD names no s390x baseline because Arch
has no s390x, so ours fell back to the oldest machine imaginable while zlib went
on detecting a CPU the compiler had been told to forget. Every distribution
picks one of these; this port had never said which, and silence chose 2000.

z13 is what Ubuntu s390x already requires, so nothing that runs today stops.
Set in two places: makepkg.conf, how this distribution is compiled, and gcc's
--with-arch, what the compiler we ship assumes with no flags at all.

--- FR ---

zlib s'est arrêté sur '__builtin_s390_vec_unpackl' requires '-mvx', après que
son propre configure avait détecté le support vectoriel et défini
-DHAVE_S390X_VX. Les deux moitiés avaient raison : il fallait mesurer, pas
rustiner.

  gcc de l'hôte  --with-arch=z13 --with-tune=z16   défaut -march=arch11
  notre gcc      rien                              défaut -march=arch5

arch5, c'est z900, de l'an 2000. Le PKGBUILD d'Arch ne nomme aucune base s390x
puisque Arch n'a pas de s390x : le nôtre retombait sur la machine la plus
ancienne imaginable pendant que zlib détectait un processeur qu'on avait dit au
compilateur d'oublier. Toute distribution en choisit une ; ce portage ne l'avait
jamais dit, et le silence a choisi 2000.

z13 est ce qu'Ubuntu s390x exige déjà : rien qui tourne aujourd'hui ne cesse de
tourner. Posé aux deux endroits : makepkg.conf, comment cette distribution est
compilée, et le --with-arch de gcc, ce que suppose le compilateur qu'on livre.

Assisted-by: Claude Opus 5
2026-08-21 00:23:26 -04:00

29 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# fakeroot: no translated man pages.
#
# po4a: command not found
#
# build() ends on a po4a call that renders the man page into every language it
# has a catalogue for. po4a is Perl, and packaging it means packaging its module
# stack -- perl-yaml-tiny, perl-syntax-keyword-try, perl-term-readkey,
# perl-locale-gettext and more -- so that fakeroot's man page exists in Polish.
#
# fakeroot is not optional the way its man pages are: makepkg cannot build a
# package without it. Same arbitration as --auto-features auto in
# build-stage2.sh, and the same note for stage 3.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
hit = [i for i, l in enumerate(lines) if re.match(r"^[ \t]*po4a\b", l)]
assert len(hit) == 1, "fakeroot: expected one po4a call, got %d" % len(hit)
lines[hit[0]] = " # po4a call removed: no Perl module stack at either stage."
out = []
for l in lines:
# makedepends too, or --nodeps is the only thing hiding the gap.
out.append(l.replace(" 'po4a'", "") if "makedepends" in l else l)
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(out))
ZZPY
grep -qE "^[ \t]*po4a " PKGBUILD && { echo "fakeroot: a po4a call survived" >&2; exit 1; }
grep -q "po4a call removed" PKGBUILD || { echo "fakeroot: nothing was removed" >&2; exit 1; }
echo "fakeroot: translated man pages dropped"