archlinux-s390x/patches/pkgbuild/libxml2.sh
Mathieu Benoit f6199bdb16 [FIX] stage 2: produce its first package
Stage 2 could build and could not deliver. Four obstacles, all in the tail of
package(), after a compile that had already succeeded.

Our meson ships arch-meson and it passes --auto-features enabled, so each of
the nine documentation tools this chroot lacks was a hard error, not a skipped
feature. A wrapper appends --auto-features auto; meson honours the last one.
Building those tools was the alternative and it is not close -- doxygen alone
wants clang, fmt, spdlog, llvm-libs.

Then bsdtar would not start: stage-1 libxml2 asks for the host's
libicuuc.so.76, our icu ships 78, and bsdtar is what writes the package. The
package that would fix it was the one being built. libarchive only links
libxml2 for xar, which nothing here reads, so stage 1 drops it.

Verified: libxml2 rebuilt against libicuuc.so.78, provides libxml2.so=16-64,
zero multiarch paths.

--- FR ---

L'étage 2 savait bâtir et ne savait pas livrer. Quatre obstacles, tous dans la
queue de package(), après une compilation déjà réussie.

Notre meson livre arch-meson, qui passe --auto-features enabled : chacun des
neuf outils de documentation absents de ce chroot devenait une erreur franche
au lieu d'une option écartée. Une enveloppe ajoute --auto-features auto, meson
retenant la dernière occurrence. Bâtir ces outils était l'autre voie et l'écart
est net -- doxygen seul réclame clang, fmt, spdlog, llvm-libs.

Puis bsdtar ne démarrait plus : le libxml2 de l'étage 1 réclame le
libicuuc.so.76 de l'hôte, notre icu livre le 78, et bsdtar est ce qui écrit le
paquet. Le paquet qui corrigeait cela était celui qu'on bâtissait. libarchive
ne lie libxml2 que pour xar, que rien ici ne lit : l'étage 1 l'abandonne.

Vérifié : libxml2 rebâti sur libicuuc.so.78, fournit libxml2.so=16-64, aucun
chemin multiarch.

Assisted-by: Claude Opus 5
2026-08-20 01:12:14 -04:00

43 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
# libxml2: the docs split assumes the docs were built.
#
# mv: cannot stat '<pkgdir>/usr/share/doc': No such file or directory
#
# package_libxml2() ends on
#
# mv "$pkgdir"/usr/share/doc -t doc/usr/share
#
# which feeds the libxml2-docs sub-package. On the build HOST the docs exist,
# because doxygen is installed there. Inside the stage-2 chroot they do not:
# that chroot has none of Arch's optional documentation tools, and
# build-stage2.sh wraps arch-meson with --auto-features auto precisely so a
# missing tool skips a feature instead of failing the build. The skipped
# feature then trips the split.
#
# FOURTH TIME THIS SHAPE APPEARS -- pam's PDFs, e2fsprogs' fuse2fs, cmake's
# emacs byte-compilation, and now this. A failure on the last line of
# package(), after a completely successful compile, naming a path rather than
# a reason. It has never once been a broken build.
#
# The move is made conditional rather than removed, because on the host the
# docs DO exist and belong in their own package. And libxml2-docs stays in
# pkgname: makepkg is content to produce an empty sub-package, and dropping it
# would diverge from Arch for a reason that only holds in one of the two
# stages.
set -euo pipefail
python3 - <<'ZZPY'
import io
s = io.open("PKGBUILD", encoding="utf-8").read()
old = ' mv "$pkgdir"/usr/share/doc -t doc/usr/share\n'
assert s.count(old) == 1, "libxml2: the docs move is not in the expected form"
new = (' # Present when doxygen was available, absent in the stage-2 chroot, which\n'
' # has no documentation tools and builds with --auto-features auto.\n'
' if [ -d "$pkgdir"/usr/share/doc ]; then\n'
' mv "$pkgdir"/usr/share/doc -t doc/usr/share\n'
' fi\n')
s = s.replace(old, new, 1)
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
ZZPY
grep -q 'has no documentation tools' PKGBUILD || {
echo "libxml2: the docs move was not made conditional" >&2; exit 1; }
echo "libxml2: docs split tolerates a build without doxygen"