archlinux-s390x/scripts/devtools/arch-meson
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

59 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Minimal stand-in for devtools' arch-meson.
#
# A number of Arch PKGBUILDs call arch-meson rather than meson directly. It
# ships in the `devtools` package, which is itself an Arch package -- so
# during a bootstrap it does not exist yet, and every PKGBUILD that uses it
# stops on "arch-meson: command not found".
#
# This reproduces the options devtools passes, which are what the PKGBUILDs
# assume: /usr prefix, plain buildtype so makepkg's CFLAGS are honoured
# verbatim, and no network access for subprojects.
#
# TWO OPTIONS BELOW ARE NOT IN REAL devtools, AND COPYING devtools VERBATIM
# IS THE BUG THEY FIX. On Arch these defaults are already right, so devtools
# has nothing to say. We run on Ubuntu, where meson answers differently.
#
# --libdir. meson's default (utils/universal.py, default_libdir):
#
# if is_debianlike(): # /etc/debian_version exists
# dpkg-architecture -qDEB_HOST_MULTIARCH
# return 'lib/' + archpath # -> lib/s390x-linux-gnu
#
# So every arch-meson package installed into /usr/lib/s390x-linux-gnu while
# its PKGBUILD went on naming /usr/lib. Nothing complained: makepkg exited 0
# and the packages went into the repo with their libraries somewhere no Arch
# ld.so and no pkgconf will ever look. util-linux is where it finally shouted,
#
# rm: cannot remove '.../pkg/util-linux/usr/lib/lib*.a*': No such file
#
# and even there the rm was the first victim, not the cause -- the
# `mv usr/lib/lib*.so*` two lines below would have shipped an EMPTY
# util-linux-libs. Measured before the fix: expat, lz4, pacman, pkgconf and
# zstd were already in repo/s390x carrying multiarch paths, libalpm.so.16
# among them.
#
# --libdir sits BEFORE "$@" so a PKGBUILD passing its own still wins: meson's
# argparse takes the last occurrence.
#
# python.platlibdir / python.purelibdir. The same divergence one layer up:
# meson's python module uses Debian's `deb_system` scheme and installs to
# /usr/lib/python3/dist-packages, which Arch's python does not read. The
# value is derived from the interpreter rather than hardcoded, because that
# is exactly how the PKGBUILDs derive theirs -- util-linux's package() moves
# `$(python -c 'sysconfig.get_paths()["stdlib"]')/site-packages`, so deriving
# it the same way makes the two agree by construction instead of by luck.
_pystdlib="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["stdlib"])')"
exec meson setup \
--prefix /usr \
--libdir lib \
--libexecdir lib \
--sbindir bin \
--buildtype plain \
--auto-features enabled \
--wrap-mode nodownload \
-D b_pie=true \
-D python.bytecompile=1 \
-D python.platlibdir="$_pystdlib/site-packages" \
-D python.purelibdir="$_pystdlib/site-packages" \
"$@"