diff --git a/patches/pkgbuild/libpsl.sh b/patches/pkgbuild/libpsl.sh new file mode 100755 index 0000000..0e95d68 --- /dev/null +++ b/patches/pkgbuild/libpsl.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# libpsl: no gtk-doc. +# +# configure: error: ... documentation by adding '--disable-gtk-doc' to +# './configure'. +# +# The error names its own fix, which is the whole of this hook. gtk-doc is a +# GNOME documentation toolchain; --enable-gtk-doc is in the PKGBUILD and the +# tool is not here. +set -euo pipefail +python3 - <<'ZZPY' +import io +s = io.open("PKGBUILD", encoding="utf-8").read() +old = "--enable-gtk-doc" +assert s.count(old) == 1, "libpsl: expected one --enable-gtk-doc, got %d" % s.count(old) +s = s.replace(old, "--disable-gtk-doc", 1) +io.open("PKGBUILD", "w", encoding="utf-8").write(s) +ZZPY +grep -q -- "--disable-gtk-doc" PKGBUILD || { echo "libpsl: gtk-doc not disabled" >&2; exit 1; } +echo "libpsl: gtk-doc disabled" diff --git a/patches/pkgbuild/sqlite.sh b/patches/pkgbuild/sqlite.sh index 6ee9cc8..a0f0bd7 100755 --- a/patches/pkgbuild/sqlite.sh +++ b/patches/pkgbuild/sqlite.sh @@ -43,3 +43,39 @@ PY grep -q "tclConfig.sh puts the tcl package tree" PKGBUILD || { echo "sqlite: tcl relocation not inserted" >&2; exit 1; } echo "sqlite: tcl extension relocated from share/tcltk to lib (host TCL_PACKAGE_PATH)" + +# --- and in the chroot, our tcl is not 8.6 ----------------------------------- +# +# mv: cannot stat '/usr/lib/tcl8.6/sqlite*': No such file or directory +# +# The section above solves the HOST's problem: Ubuntu's tclConfig.sh says +# share/tcltk, so the tree is relocated to usr/lib/tcl8.6 where the upstream mv +# expects it. Inside the stage-2 chroot neither half of that applies -- Arch's +# tclConfig.sh already says lib, and our tcl is 9.0, so sqlite installs into +# usr/lib/tcl9.0 and the upstream mv finds nothing. The relocation above becomes +# a no-op there, correctly, because it is guarded by [ -d ]. +# +# This is the deferred item this port had already written down -- "libtcl8.6 +# versus our tcl 9.0" -- arriving as a missing directory rather than as a version +# mismatch. +# +# The version is READ from the tree, not written in. Hardcoding 9.0 would put the +# same trap back one release later, and the tcl package is what decides it. +python3 - <<'ZZPY' +import io +s = io.open("PKGBUILD", encoding="utf-8").read() +old = 'mv "$pkgdir"/usr/lib/tcl8.6/sqlite* "$srcdir"/tcl' +assert s.count(old) == 1, "sqlite: the upstream tcl move is not in the expected form" +new = ('_tcldir=$(cd "$pkgdir"/usr/lib && echo tcl[0-9]*)\n' + ' [ -d "$pkgdir/usr/lib/$_tcldir" ] || { echo "sqlite: no tcl dir under usr/lib" >&2; exit 1; }\n' + ' mv "$pkgdir"/usr/lib/"$_tcldir"/sqlite* "$srcdir"/tcl') +s = s.replace(old, new, 1) +io.open("PKGBUILD", "w", encoding="utf-8").write(s) +ZZPY +# Only the upstream mv had to change. The relocation above still names tcl8.6 on +# purpose -- it is about the HOST's tcl -- so a blanket grep for tcl8.6 would +# condemn correct code, and did on the first attempt. +grep -qE '^[[:space:]]*mv .*usr/lib/tcl8\.6/sqlite' PKGBUILD && { + echo "sqlite: the hardcoded upstream move survived" >&2; exit 1; } +grep -q '_tcldir=' PKGBUILD || { echo "sqlite: the tcl dir is not discovered" >&2; exit 1; } +echo "sqlite: upstream tcl move reads the version from the tree" diff --git a/patches/pkgbuild/util-linux.sh b/patches/pkgbuild/util-linux.sh new file mode 100755 index 0000000..a771caf --- /dev/null +++ b/patches/pkgbuild/util-linux.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# util-linux: the man3 pages that were never built. +# +# mv: cannot stat '/usr/share/man/man3': No such file or directory +# +# util-linux renders its man pages from asciidoc, which this port does not have, +# so man3 does not exist. The util-linux-libs split moves it out of pkgdir and +# then back in -- TWO places, and removing only the first fails on the second. +# +# Both moves go. Nothing is left conditional: if the directory is never created, +# a guard around moving it is a guard around nothing, and it would read as if +# the man pages were sometimes present. +# +# Same shape as libxml2's docs split, pam's PDFs, libuv's man page and cmake's +# emacs byte-compilation: a failure on a path at the end of package(), after a +# compile that worked. Seventh time. +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.search(r"\bman3\b", l) and l.lstrip().startswith("mv ")] +assert len(hit) == 2, "util-linux: expected two man3 moves, got %d" % len(hit) +for i in reversed(hit): + ind = re.match(r"^[ \t]*", lines[i]).group(0) + lines[i] = ind + ": # man3 not built: no asciidoc at either stage." +io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines)) +ZZPY +if grep -qE "^[[:space:]]*mv .*\bman3\b" PKGBUILD; then + echo "util-linux: a man3 move survived" >&2; exit 1 +fi +grep -c "man3 not built" PKGBUILD | grep -qx 2 || { + echo "util-linux: expected both moves replaced" >&2; exit 1; } +echo "util-linux: man3 moves removed (both)"