archlinux-s390x/patches/pkgbuild/jsoncpp.sh

60 lines
2.6 KiB
Bash
Raw Permalink Normal View History

[ADD] nlohmann-json, and three more packages without their docs nlohmann-json is a real closure gap, not a documentation cut: both cmake and cppdap stop on "Could NOT find nlohmann_json". It is a header-only C++ library, one of the cheapest packages in the list, and cmake is not optional -- the cmake/cppdap/jsoncpp/libuv group behind it is what several other packages build with. The other three are doxygen and sphinx again. jsoncpp's is the least readable failure in the port so far: doxybuild.py is handed an empty doxygen path and raises Exception('path is empty.'), so a missing tool arrives as a Python traceback about a path. libuv needed two places -- `make man -C docs` and the install of docs/build/man/libuv.1 -- the same shape as libxml2's docs split and pam's PDFs: a failure on a path at the end of package(), after a compile that worked. --- FR --- nlohmann-json est un vrai trou de fermeture, pas une coupe de documentation : cmake et cppdap s'arrêtent tous deux sur « Could NOT find nlohmann_json ». C'est une bibliothèque C++ d'en-têtes seuls, l'un des paquets les moins chers de la liste, et cmake n'est pas optionnel — le groupe cmake/cppdap/jsoncpp/libuv derrière lui est ce avec quoi plusieurs autres se bâtissent. Les trois autres sont encore doxygen et sphinx. Celui de jsoncpp est l'échec le moins lisible du portage jusqu'ici : doxybuild.py reçoit un chemin de doxygen vide et lève Exception('path is empty.'), donc un outil manquant arrive sous la forme d'une trace Python parlant d'un chemin. libuv demandait deux endroits — `make man -C docs` et l'installation de docs/build/man/libuv.1 — même forme que le découpage de libxml2 et les PDF de pam : un échec sur un chemin en fin de package(), après une compilation réussie. Assisted-by: Claude Opus 5
2026-08-22 02:32:55 -04:00
#!/usr/bin/env bash
# jsoncpp: no doxygen build.
#
# File "doxybuild.py", line 82, in assert_is_exe
# raise Exception('path is empty.')
#
# A python traceback, which is what makes this one hard to read: doxybuild.py was
# handed an empty doxygen path because there is no doxygen, and it reports that
# as a path problem. build() runs it after the compile has already finished.
set -euo pipefail
python3 - <<'ZZPY'
import io, re
lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n")
# The call spans several lines: find it and drop through its last continuation.
hit = [i for i, l in enumerate(lines) if re.search(r"python doxybuild\.py", l)]
assert len(hit) == 1, "jsoncpp: expected one doxybuild call, got %d" % len(hit)
i = hit[0]
j = i
while lines[j].rstrip().endswith("\\"):
j += 1
del lines[i:j + 1]
# The `echo "Building docs..."` above it would now announce nothing.
if i > 0 and "Building docs" in lines[i - 1]:
del lines[i - 1]
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -q "doxybuild" PKGBUILD && { echo "jsoncpp: doxybuild survived" >&2; exit 1; }
echo "jsoncpp: doxygen build removed"
[ADD] gyp for nss, and jsoncpp's doxygen output nss will not configure without gyp: Building NSS requires an installation of gyp: https://gyp.gsrc.io Google's build-file generator, which nss uses to produce its ninja files. It is a real Arch package and a Python program, so it joins the Python set. jsoncpp is the fourteenth instance of this shape and the sixth of my own making. Removing the doxybuild.py call stopped the API html being generated; package() still copied the directory it would have produced, and the name carries pkgver so the path is not greppable without knowing the version. The rule is mechanical enough now to state as a procedure rather than a lesson: after removing a documentation build, grep package() for the OUTPUT directory name, not for the tool. The tool appears in build(); the path appears in package(), and it is the path that fails. --- FR --- nss ne se configure pas sans gyp : Building NSS requires an installation of gyp: https://gyp.gsrc.io Le générateur de fichiers de construction de Google, dont nss se sert pour produire ses fichiers ninja. C'est un vrai paquet Arch et un programme Python : il rejoint l'ensemble Python. jsoncpp est la quatorzième occurrence de cette forme, et la sixième de ma main. Retirer l'appel à doxybuild.py a arrêté la génération du html d'API ; package() copiait toujours le répertoire qu'il aurait produit, et son nom porte pkgver — le chemin n'est donc pas trouvable par grep sans connaître la version. La règle est assez mécanique pour être énoncée en procédure plutôt qu'en leçon : après avoir retiré une construction de documentation, chercher dans package() le nom du répertoire de SORTIE, pas celui de l'outil. L'outil est dans build() ; le chemin est dans package(), et c'est le chemin qui échoue. Assisted-by: Claude Opus 5
2026-08-24 00:03:26 -04:00
# --- and the html it no longer generates --------------------------------------
#
# cp: cannot stat 'dist/doxygen/jsoncpp-api-html-1.9.6': No such file or dir
#
# FOURTEENTH time, and the sixth of my own making. Removing the doxybuild.py call
# above stopped the API html being generated, and package() still copies the
# directory it would have produced. The name carries the version, so the path is
# not even greppable without knowing pkgver.
#
# By now the rule is mechanical and worth stating as a procedure rather than a
# lesson: after removing a documentation build, grep package() for the OUTPUT
# directory name, not for the tool. The tool appears in build(); the path appears
# in package(), and it is the path that fails.
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 "doxygen" in l and re.match(r"^[ \t]*(cp|mv|install) ", l)]
assert len(hit) >= 1, "jsoncpp: no doxygen output copy found in package()"
for i in reversed(hit):
j = i
while lines[j].rstrip().endswith("\\"):
j += 1
ind = re.match(r"^[ \t]*", lines[i]).group(0)
lines[i:j + 1] = [ind + ": # the doxygen html is not generated (no doxygen here)."]
io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines))
ZZPY
grep -qE "^[[:space:]]*(cp|mv|install) .*doxygen" PKGBUILD && {
echo "jsoncpp: a doxygen output copy survived" >&2; exit 1; }
echo "jsoncpp: doxygen html copy removed"