archlinux-s390x/patches/pkgbuild/lz4.sh
Mathieu Benoit ddbf91108f [FIX] libdir: the Debian host hid the libraries from Arch
meson and cmake both ask the HOST where libraries go. On Ubuntu the
answer is lib/s390x-linux-gnu, so five packages already in the repository
ship theirs where Arch's ld.so and pkgconf never look. Measured:

  expat 12  lz4 6  pacman 6  pkgconf 6  zstd 12   entries

Nothing failed. util-linux is where it finally shouted, and even there
the rm was the first victim, not the cause.

pacman is the one that matters: libalpm.so.16 landed where pacman's own
binary cannot load it, and a target installed from that package has no
working package manager left to repair itself with.

arch-meson now states the libdir devtools has no need to state, and is
reinstalled on every run -- editing the copy here changed nothing while
/usr/local/bin held a stale one. Four packages call bare meson or cmake
and get their own hook. util-linux's old hook chased lib64, which never
existed here; it is deleted.

--- FR ---

meson et cmake demandent tous deux à l'HÔTE où vont les bibliothèques.
Sous Ubuntu la réponse est lib/s390x-linux-gnu : cinq paquets déjà dans
le dépôt livrent donc les leurs là où ld.so et pkgconf d'Arch ne
regarderont jamais. Mesuré :

  expat 12  lz4 6  pacman 6  pkgconf 6  zstd 12   entrées

Rien n'a échoué. util-linux est l'endroit où cela a fini par crier, et
même là le rm était la première victime, pas la cause.

pacman est celui qui compte : libalpm.so.16 atterrissait là où le binaire
de pacman ne peut pas la charger, et une cible installée depuis ce paquet
n'a plus de gestionnaire de paquets pour se réparer.

arch-meson énonce désormais le libdir que devtools n'a pas besoin
d'énoncer, et se réinstalle à chaque exécution : éditer la copie du dépôt
ne changeait rien tant que /usr/local/bin en gardait une périmée. Quatre
paquets appellent meson ou cmake nu et reçoivent leur crochet. L'ancien
crochet util-linux poursuivait un lib64 qui n'a jamais existé ici : il
est supprimé.

Assisted-by: Claude Opus 5
2026-08-17 01:33:41 -04:00

41 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# lz4: bare `meson setup`, so libdir lands on the Debian multiarch path.
#
# This PKGBUILD calls meson directly -- not arch-meson -- so nothing supplies
# --libdir and meson falls back to default_libdir(), which asks the HOST
# where libraries go. On this Debian-flavoured builder the answer comes from
# dpkg-architecture -qDEB_HOST_MULTIARCH, i.e. lib/s390x-linux-gnu. The
# package built, exited 0, and shipped:
#
# usr/lib/s390x-linux-gnu/liblz4.so.1.10.0
# usr/lib/s390x-linux-gnu/pkgconfig/liblz4.pc
#
# Arch's ld.so and pkgconf only read /usr/lib, so on the target every consumer
# fails to link and `pkg-config liblz4` finds nothing -- while the PKGBUILD
# still declares provides=('liblz4.so'), a promise the artefact does not keep.
# The binaries in usr/bin work, which is exactly what makes it look fine.
#
# The damage is twofold: liblz4.pc is not merely in the wrong directory, its
# body also reads libdir=${prefix}/lib/s390x-linux-gnu, so relocating the file
# would not have been enough. Setting libdir fixes both at once.
#
# Anchor on "meson setup", NOT on "meson": build() also runs meson configure
# and meson compile, package() runs meson install, and check() runs
# build/meson/programs/lz4 -- a PATH containing the word. There is exactly one
# setup, asserted below.
#
# --libdir survives the later `meson configure`, which only rewrites the
# options it is handed (-Dcontrib -Dexamples -Dprograms).
set -euo pipefail
python3 - <<'PY'
import io
s = io.open("PKGBUILD", encoding="utf-8").read()
old = "meson setup --prefix=/usr --buildtype=plain"
n = s.count(old)
assert n == 1, "lz4: expected exactly 1 meson setup, found %d" % n
s = s.replace(old, "meson setup --prefix=/usr --libdir=lib --buildtype=plain", 1)
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
PY
[ "$(grep -c -- '--libdir=lib' PKGBUILD)" = 1 ] || {
echo "lz4: --libdir=lib not applied exactly once" >&2; exit 1; }
echo "lz4: meson libdir pinned to lib (host default is lib/s390x-linux-gnu)"