From 6f0fcb2b76e79aea9930a86b7b9b508a72630e9f Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 18:21:44 +0100 Subject: [PATCH] Package LLVM 17 with the installed library search paths --- llvm17-dev/PKGBUILD.vile | 10 +++++---- llvm17-libs/PKGBUILD.vile | 44 ++++++++++++++++++++++++--------------- tests/x11/README.md | 4 +++- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/llvm17-dev/PKGBUILD.vile b/llvm17-dev/PKGBUILD.vile index f0bc462..2025de2 100644 --- a/llvm17-dev/PKGBUILD.vile +++ b/llvm17-dev/PKGBUILD.vile @@ -11,7 +11,7 @@ defpkgbuild(llvm17-dev, #:arch, [#:x86-64, #:aarch64], #:license, "Apache-2.0 WITH LLVM-exception", #:url, "https://llvm.org/", - #:depends, ["llvm17-libs=17.0.6-1"], + #:depends, ["llvm17-libs=17.0.6-2"], #:makedepends, ["linux-headers"], #:source, if reuse { list() } else { ["llvm-project-17.0.6.src.xz::https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-17.0.6.src.tar.xz", "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/fix-memory-mf_exec-on-aarch64.patch", @@ -26,8 +26,11 @@ defpkgbuild(llvm17-dev, #:prepare, fn() { if reuse { ; Use only the tree whose library is the installed runtime from this feed. - run("cmp", string-append(build-dir, "/lib/libLLVM-17.so"), + normalized := string-append(srcdir(), "/llvm-runtime-check") + run("env", string-append("DESTDIR=", normalized), "cmake", "--install", build-dir, "--component", "LLVM", "--prefix", "/usr") + run("cmp", string-append(normalized, "/usr/lib/libLLVM-17.so"), string-append(sdk, "/usr/lib/libLLVM-17.so")) + run("rm", "-r", "--", normalized) run("test", "-s", string-append(build-dir, "/CMakeCache.txt")) } else { ; LLVM's release archive also contains Clang, LLDB and other independent projects. @@ -49,8 +52,7 @@ defpkgbuild(llvm17-dev, }, #:package, fn() { run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "llvm-headers") - run("install", "-Dm755", string-append(build-dir, "/bin/llvm-config"), - string-append(pkgdir(), "/usr/lib/llvm17/bin/llvm-config")) + run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "llvm-config", "--prefix", "/usr/lib/llvm17") run("mkdir", "-p", string-append(pkgdir(), "/usr/bin"), string-append(pkgdir(), "/usr/lib/llvm17/lib")) run("ln", "-s", "../lib/llvm17/bin/llvm-config", string-append(pkgdir(), "/usr/bin/llvm-config-17")) for-each(fn(soname) { diff --git a/llvm17-libs/PKGBUILD.vile b/llvm17-libs/PKGBUILD.vile index 6240c9d..c566727 100644 --- a/llvm17-libs/PKGBUILD.vile +++ b/llvm17-libs/PKGBUILD.vile @@ -1,40 +1,50 @@ +checkpoint := get-environment-variable("VINIX_LLVM_BUILD") +reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { #f } +build-dir := if reuse { checkpoint } else { "build" } + defpkgbuild(llvm17-libs, #:pkgname, "llvm17-libs", #:pkgver, "17.0.6", - #:pkgrel, 1, + #:pkgrel, 2, #:pkgdesc, "LLVM runtime for the native CPU and AMDGPU (LLVM 17)", #:arch, [#:x86-64, #:aarch64], #:license, "Apache-2.0 WITH LLVM-exception", #:url, "https://llvm.org/", #:depends, ["musl", "gcc-libs", "libffi", "libxml2", "zlib", "zstd"], #:makedepends, ["linux-headers"], - #:source, ["llvm-project-17.0.6.src.xz::https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-17.0.6.src.tar.xz", + #:source, if reuse { list() } else { ["llvm-project-17.0.6.src.xz::https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-17.0.6.src.tar.xz", "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/fix-memory-mf_exec-on-aarch64.patch", "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/llvm-stack-size.patch", "rust-feature-tables-17.patch", - "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"], - #:sha256sums, ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813", + "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"] }, + #:sha256sums, if reuse { list() } else { ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813", "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527", "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78", "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56", - "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"], + "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"] }, #:prepare, fn() { - ; LLVM's release archive also contains Clang, LLDB and other independent projects. - run("tar", "-xf", "llvm-project-17.0.6.src.xz", "llvm-project-17.0.6.src/llvm", "llvm-project-17.0.6.src/cmake", "llvm-project-17.0.6.src/third-party") - for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-17.0.6.src", "-p1", "-i", string-append("../", patch)) }, - list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch", "rust-feature-tables-17.patch", - "0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch")) + if not(reuse) { + ; LLVM's release archive also contains Clang, LLDB and other independent projects. + run("tar", "-xf", "llvm-project-17.0.6.src.xz", "llvm-project-17.0.6.src/llvm", "llvm-project-17.0.6.src/cmake", "llvm-project-17.0.6.src/third-party") + for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-17.0.6.src", "-p1", "-i", string-append("../", patch)) }, + list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch", "rust-feature-tables-17.patch", + "0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch")) + } }, #:build, fn() { - run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", "build") - run("vinix-ninja", "build", "LLVM") + if not(reuse) { + run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", build-dir) + run("vinix-ninja", build-dir, "LLVM") + } }, #:check, fn() { - run("readelf", "-d", "build/lib/libLLVM-17.so") - run("test", "-s", "build/lib/libLLVM-17.so") + run("test", "-s", string-append(build-dir, "/lib/libLLVM-17.so")) }, #:package, fn() { - run("install", "-Dm755", "build/lib/libLLVM-17.so", string-append(pkgdir(), "/usr/lib/libLLVM-17.so")) - run("ln", "-s", "libLLVM-17.so", string-append(pkgdir(), "/usr/lib/libLLVM-17.0.6.so")) - run("install", "-Dm644", "llvm-project-17.0.6.src/llvm/LICENSE.TXT", string-append(pkgdir(), "/usr/share/licenses/llvm17-libs/LICENSE.TXT")) + ; CMake replaces the build-tree RUNPATH while installing the runtime. + run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "LLVM", "--prefix", "/usr") + run("rm", "-f", "--", string-append(pkgdir(), "/usr/lib/libLLVM.so")) + run("readelf", "-d", string-append(pkgdir(), "/usr/lib/libLLVM-17.so")) + license := string-append(build-dir, "/../llvm-project-17.0.6.src/llvm/LICENSE.TXT") + run("install", "-Dm644", license, string-append(pkgdir(), "/usr/share/licenses/llvm17-libs/LICENSE.TXT")) }) diff --git a/tests/x11/README.md b/tests/x11/README.md index bd45c80..413c849 100644 --- a/tests/x11/README.md +++ b/tests/x11/README.md @@ -49,7 +49,7 @@ On AArch64, libelf 0.191-2 built from elfutils and installed with its signed lib The cold AArch64 LLVM build SDK installed eight signed packages, including GCC's shared runtime, libffi, libxml2, XZ, zlib and Zstd. The worker counted 1,413 owned files and links and 21 target ELFs. The host tools verified CMake 3.28.3 from the pinned Ubuntu archive and the matching 17.0.6 and 19.1.4 TableGen programs in the private build environment. The SDK and host-tool receipts are under `xorg/llvm/arm-runtime-sdk-01` and `xorg/llvm/arm-host-tools-01`, manifest SHA-256 `85a0d963c61842d6696c92bd488f3a7b52f5b8441f172a4ff0ced50ca27a32e9` and `f8d1d5aaafbde5b748e8fa7c9888dbe9761ead42001b89d477120b24ecbbe283`. -Keep the completed LLVM runtime build tree until its development archive is packaged. To package from that tree, set `VINIX_LLVM_BUILD` to its CMake build directory inside the original worker environment. The LLVM 19 recipes use CMake's install components so the packaged library and `llvm-config` have the installed search path. The development recipe compares the CMake-installed library to the signed runtime in its SDK before Ninja builds the remaining `llvm-config` target and headers. With the variable unset, the recipes configure and build their own targets. +Keep the completed LLVM runtime build tree until its development archive is packaged. To package from that tree, set `VINIX_LLVM_BUILD` to its CMake build directory inside the original worker environment. The LLVM 17 and 19 recipes use CMake's install components so the packaged library and `llvm-config` have the installed search path. The development recipe compares the CMake-installed library to the signed runtime in its SDK before Ninja builds the remaining `llvm-config` target and headers. With the variable unset, the recipes configure and build their own targets. The x86_64 worker packaged `llvm19-libs` 19.1.4-2 and `llvm19-dev` 19.1.4-1 from the completed source tree. The clean, signed runtime install passed the ELF and ownership audit. Adding the signed development archive in a second clean root brought the totals to ten packages, 3,450 owned paths and 23 target ELFs. See `xorg/llvm/work/runtime19-01/dev-reuse-01`, receipt SHA-256 `03e0efcaf18a9b2226c75e76a6a29089cc1d45965daabc96a64b6d7c9f00994d`. @@ -57,6 +57,8 @@ The x86_64 QEMU guest ran the installed `llvm-config-19 --version` and executed The corresponding client and guest disk are archived in `foundation/archived-x86-llvm19-qemu-roots-01`, receipt SHA-256 `68071f5978f8ecbacced1469e402ef75b8e2485aedf4a086dafcd6fc60ff7ad2`. Extract the checked archive from the worker state directory before replaying the disk receipt check. +The AArch64 worker packaged `llvm17-libs` 17.0.6-2 and `llvm17-dev` 17.0.6-1 from completed objects. The clean signed development root passed the 16 KiB ELF and ownership audit with ten packages, 3,298 owned paths and 23 target ELFs. See `xorg/llvm/work/arm-dev-reuse-01/17`, receipt SHA-256 `34bc22cabc4b6d42c98e8a736dfee54f5a0e0b70873b5d3218da09834b66e544`. + The Mesa 24.2.8 recipe compiles Gallium once and uses one Meson installation to produce `mesa` and `mesa-gallium-sdk`. EGL, GLES and GBM stay in the runtime archive. The SDK archive carries OSMesa and XA for builds that request them. Both architecture plans resolve the split outputs to the same recipe, and the install fixture confirmed that the two outputs own disjoint paths. See `foundation/release-split-plan-01`, receipt SHA-256 `124659b0ae78559071f072e3845c4c5903da1b2f9a0b523931e422b21ac3b585`. The real Mesa binaries still need the LLVM dependencies and their guest graphics checks. For those checks, install `vinix-release-x11` and `busybox-init` from the signed feed into a clean root and audit it. Build `egl.v` and `glx.v` against that SDK and place the executables at `/vinix-egl-check` and `/vinix-glx-check` in a disposable guest root. Boot `graphics.sh` using `tests/disk-root.py`. The fixture reads back the expected pixel from current Mesa's surfaceless EGL and again from an authenticated indirect GLX connection to `Xvfb-glx` using the legacy DRI directory. -- 2.56.1