From 8a4086957dd6293071929a854b19ba1eb190198c Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 13:48:58 +0100 Subject: [PATCH] Reuse LLVM runtime builds for Mesa development packages --- llvm17-dev/PKGBUILD.vile | 61 ++++++++++++++++++++++ llvm17-dev/rust-feature-tables-17.patch | 23 +++++++++ llvm17-libs/PKGBUILD.vile | 40 ++++++++++++++ llvm17-libs/rust-feature-tables-17.patch | 23 +++++++++ llvm19-dev/PKGBUILD.vile | 56 ++++++++++++++++++++ llvm19-libs/PKGBUILD.vile | 35 +++++++++++++ tests/x11/README.md | 2 + tools/vinix-llvm.v | 66 ++++++++++++++++++++++++ 8 files changed, 306 insertions(+) create mode 100644 llvm17-dev/PKGBUILD.vile create mode 100644 llvm17-dev/rust-feature-tables-17.patch create mode 100644 llvm17-libs/PKGBUILD.vile create mode 100644 llvm17-libs/rust-feature-tables-17.patch create mode 100644 llvm19-dev/PKGBUILD.vile create mode 100644 llvm19-libs/PKGBUILD.vile create mode 100644 tools/vinix-llvm.v diff --git a/llvm17-dev/PKGBUILD.vile b/llvm17-dev/PKGBUILD.vile new file mode 100644 index 0000000..c55ee24 --- /dev/null +++ b/llvm17-dev/PKGBUILD.vile @@ -0,0 +1,61 @@ +checkpoint := get-environment-variable("VINIX_LLVM_BUILD") +reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { false } +build-dir := if reuse { checkpoint } else { "build" } +sdk := get-environment-variable("VPAC_MAKEPKG_ROOT") + +defpkgbuild(llvm17-dev, + #:pkgname, "llvm17-dev", + #:pkgver, "17.0.6", + #:pkgrel, 1, + #:pkgdesc, "LLVM headers and configuration utility for Mesa (LLVM 17)", + #:arch, [#:x86-64, #:aarch64], + #:license, "Apache-2.0 WITH LLVM-exception", + #:url, "https://llvm.org/", + #:depends, ["llvm17-libs=17.0.6-1"], + #: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", + "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, if reuse { list() } else { ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813", + "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527", + "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78", + "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56", + "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"] }, + #: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"), + string-append(sdk, "/usr/lib/libLLVM-17.so")) + run("test", "-s", string-append(build-dir, "/CMakeCache.txt")) + } else { + ; 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() { + if not(reuse) { + run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", build-dir) + } + run("vinix-ninja", build-dir, "llvm-headers", "llvm-config") + }, + #:check, fn() { + run("vinix-run", string-append(build-dir, "/bin/llvm-config"), "--version") + run("test", "-s", string-append(build-dir, "/include/llvm/Config/llvm-config.h")) + }, + #: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("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) { + run("ln", "-s", "../../libLLVM-17.so", string-append(pkgdir(), "/usr/lib/llvm17/lib/", soname)) + }, list("libLLVM-17.so", "libLLVM-17.0.6.so", "libLLVM.so")) + run("install", "-Dm644", string-append(sdk, "/usr/share/licenses/llvm17-libs/LICENSE.TXT"), + string-append(pkgdir(), "/usr/share/licenses/llvm17-dev/LICENSE.TXT")) + }) diff --git a/llvm17-dev/rust-feature-tables-17.patch b/llvm17-dev/rust-feature-tables-17.patch new file mode 100644 index 0000000..3865369 --- /dev/null +++ b/llvm17-dev/rust-feature-tables-17.patch @@ -0,0 +1,23 @@ +From 0a157fd7a5f61973ffddf96b3d445a718193eb1a Mon Sep 17 00:00:00 2001 +From: Cameron Hart +Subject: [PATCH] Add accessors for MCSubtargetInfo CPU and feature tables + +Keep LLVM 17.0.6's getAllProcessorDescriptions alongside the Rust accessors. + +--- a/llvm/include/llvm/MC/MCSubtargetInfo.h ++++ b/llvm/include/llvm/MC/MCSubtargetInfo.h +@@ -234,6 +234,14 @@ + return ProcDesc; + } + ++ ArrayRef getCPUTable() const { ++ return ProcDesc; ++ } ++ ++ ArrayRef getFeatureTable() const { ++ return ProcFeatures; ++ } ++ + virtual unsigned getHwMode() const { return 0; } + + /// Return the cache size in bytes for the given level of cache. diff --git a/llvm17-libs/PKGBUILD.vile b/llvm17-libs/PKGBUILD.vile new file mode 100644 index 0000000..6240c9d --- /dev/null +++ b/llvm17-libs/PKGBUILD.vile @@ -0,0 +1,40 @@ +defpkgbuild(llvm17-libs, + #:pkgname, "llvm17-libs", + #:pkgver, "17.0.6", + #:pkgrel, 1, + #: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", + "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", + "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527", + "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78", + "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56", + "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")) + }, + #:build, fn() { + run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", "build") + run("vinix-ninja", "build", "LLVM") + }, + #:check, fn() { + run("readelf", "-d", "build/lib/libLLVM-17.so") + run("test", "-s", "build/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")) + }) diff --git a/llvm17-libs/rust-feature-tables-17.patch b/llvm17-libs/rust-feature-tables-17.patch new file mode 100644 index 0000000..3865369 --- /dev/null +++ b/llvm17-libs/rust-feature-tables-17.patch @@ -0,0 +1,23 @@ +From 0a157fd7a5f61973ffddf96b3d445a718193eb1a Mon Sep 17 00:00:00 2001 +From: Cameron Hart +Subject: [PATCH] Add accessors for MCSubtargetInfo CPU and feature tables + +Keep LLVM 17.0.6's getAllProcessorDescriptions alongside the Rust accessors. + +--- a/llvm/include/llvm/MC/MCSubtargetInfo.h ++++ b/llvm/include/llvm/MC/MCSubtargetInfo.h +@@ -234,6 +234,14 @@ + return ProcDesc; + } + ++ ArrayRef getCPUTable() const { ++ return ProcDesc; ++ } ++ ++ ArrayRef getFeatureTable() const { ++ return ProcFeatures; ++ } ++ + virtual unsigned getHwMode() const { return 0; } + + /// Return the cache size in bytes for the given level of cache. diff --git a/llvm19-dev/PKGBUILD.vile b/llvm19-dev/PKGBUILD.vile new file mode 100644 index 0000000..dc614a8 --- /dev/null +++ b/llvm19-dev/PKGBUILD.vile @@ -0,0 +1,56 @@ +checkpoint := get-environment-variable("VINIX_LLVM_BUILD") +reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { false } +build-dir := if reuse { checkpoint } else { "build" } +sdk := get-environment-variable("VPAC_MAKEPKG_ROOT") + +defpkgbuild(llvm19-dev, + #:pkgname, "llvm19-dev", + #:pkgver, "19.1.4", + #:pkgrel, 1, + #:pkgdesc, "LLVM headers and configuration utility for Mesa (LLVM 19)", + #:arch, [#:x86-64, #:aarch64], + #:license, "Apache-2.0 WITH LLVM-exception", + #:url, "https://llvm.org/", + #:depends, ["llvm19-libs=19.1.4-1"], + #:makedepends, ["linux-headers"], + #:source, if reuse { list() } else { ["llvm-project-19.1.4.src.xz::https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.4/llvm-project-19.1.4.src.tar.xz", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/fix-memory-mf_exec-on-aarch64.patch", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/llvm-stack-size.patch"] }, + #:sha256sums, if reuse { list() } else { ["3aa2d2d2c7553164ad5c6f3b932b31816e422635e18620c9349a7da95b98d811", + "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527", + "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78"] }, + #: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.so.19.1"), + string-append(sdk, "/usr/lib/libLLVM.so.19.1")) + run("test", "-s", string-append(build-dir, "/CMakeCache.txt")) + } else { + ; LLVM's release archive also contains Clang, LLDB and other independent projects. + run("tar", "-xf", "llvm-project-19.1.4.src.xz", "llvm-project-19.1.4.src/llvm", "llvm-project-19.1.4.src/cmake", "llvm-project-19.1.4.src/third-party") + for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-19.1.4.src", "-p1", "-i", string-append("../", patch)) }, + list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch")) + } + }, + #:build, fn() { + if not(reuse) { + run("vinix-llvm", "19.1.4", "llvm-project-19.1.4.src/llvm", build-dir) + } + run("vinix-ninja", build-dir, "llvm-headers", "llvm-config") + }, + #:check, fn() { + run("vinix-run", string-append(build-dir, "/bin/llvm-config"), "--version") + run("test", "-s", string-append(build-dir, "/include/llvm/Config/llvm-config.h")) + }, + #: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/llvm19/bin/llvm-config")) + run("mkdir", "-p", string-append(pkgdir(), "/usr/bin"), string-append(pkgdir(), "/usr/lib/llvm19/lib")) + run("ln", "-s", "../lib/llvm19/bin/llvm-config", string-append(pkgdir(), "/usr/bin/llvm-config-19")) + for-each(fn(soname) { + run("ln", "-s", "../../libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/llvm19/lib/", soname)) + }, list("libLLVM.so.19.1", "libLLVM-19.so", "libLLVM.so")) + run("install", "-Dm644", string-append(sdk, "/usr/share/licenses/llvm19-libs/LICENSE.TXT"), + string-append(pkgdir(), "/usr/share/licenses/llvm19-dev/LICENSE.TXT")) + }) diff --git a/llvm19-libs/PKGBUILD.vile b/llvm19-libs/PKGBUILD.vile new file mode 100644 index 0000000..3867b48 --- /dev/null +++ b/llvm19-libs/PKGBUILD.vile @@ -0,0 +1,35 @@ +defpkgbuild(llvm19-libs, + #:pkgname, "llvm19-libs", + #:pkgver, "19.1.4", + #:pkgrel, 1, + #:pkgdesc, "LLVM runtime for the native CPU and AMDGPU (LLVM 19)", + #: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-19.1.4.src.xz::https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.4/llvm-project-19.1.4.src.tar.xz", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/fix-memory-mf_exec-on-aarch64.patch", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/llvm-stack-size.patch"], + #:sha256sums, ["3aa2d2d2c7553164ad5c6f3b932b31816e422635e18620c9349a7da95b98d811", + "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527", + "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78"], + #:prepare, fn() { + ; LLVM's release archive also contains Clang, LLDB and other independent projects. + run("tar", "-xf", "llvm-project-19.1.4.src.xz", "llvm-project-19.1.4.src/llvm", "llvm-project-19.1.4.src/cmake", "llvm-project-19.1.4.src/third-party") + for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-19.1.4.src", "-p1", "-i", string-append("../", patch)) }, + list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch")) + }, + #:build, fn() { + run("vinix-llvm", "19.1.4", "llvm-project-19.1.4.src/llvm", "build") + run("vinix-ninja", "build", "LLVM") + }, + #:check, fn() { + run("readelf", "-d", "build/lib/libLLVM.so.19.1") + run("test", "-s", "build/lib/libLLVM.so.19.1") + }, + #:package, fn() { + run("install", "-Dm755", "build/lib/libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/libLLVM.so.19.1")) + run("ln", "-s", "libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/libLLVM-19.so")) + run("install", "-Dm644", "llvm-project-19.1.4.src/llvm/LICENSE.TXT", string-append(pkgdir(), "/usr/share/licenses/llvm19-libs/LICENSE.TXT")) + }) diff --git a/tests/x11/README.md b/tests/x11/README.md index 2ae89c4..a513692 100644 --- a/tests/x11/README.md +++ b/tests/x11/README.md @@ -42,3 +42,5 @@ The LLVM fixture compiles a two-argument integer addition function from LLVM IR, On AArch64, libelf 0.191-2 built from elfutils and installed with its signed libraries. The audit covered 11 package records, 1,311 owned files and links, and 18 target ELFs. The package page check is in `xorg/arm/abi16/logs/libelf-pages.log`, SHA-256 `3a230cbe92e1469fbdeefb23d1625d1ffcb595fc0c91caa97a59376b9067c477`. 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. Install the signed runtime in the development SDK and set `VINIX_LLVM_BUILD` to the runtime's CMake build directory inside the same worker environment. The recipe compares the built shared object to the installed runtime and asks Ninja for the headers and `llvm-config` using the existing objects. With the variable unset, the source recipe builds those targets independently. Both recipe fixtures reused a configured tree, packaged headers and a versioned `llvm-config`, and rejected a different runtime file. See `xorg/llvm/reuse-dev-fixture-02`, receipt SHA-256 `8123239e3d4ac7ed770df0f1be8d03bf9e214029e22596438a5b3f105033e9b6`. The release builds and LLVM guest checks are separate gates. diff --git a/tools/vinix-llvm.v b/tools/vinix-llvm.v new file mode 100644 index 0000000..6282dad --- /dev/null +++ b/tools/vinix-llvm.v @@ -0,0 +1,66 @@ +// Configure LLVM's shared runtime or Mesa development headers for the signed SDK. +module main + +import os + +fn configure(version string, source string, build string) ! { + major := version.all_before('.') + if version !in ['17.0.6', '19.1.4'] { + return error('unsupported LLVM release ${version}') + } + arch := os.getenv_opt('VPAC_TARGET_ARCH') or { os.uname().machine } + backend := match arch { + 'x86_64' { 'X86' } + 'aarch64' { 'AArch64' } + else { return error('unsupported LLVM target ${arch}') } + } + root := os.getenv('VPAC_MAKEPKG_ROOT') + if !os.is_abs_path(root) { + return error('set VPAC_MAKEPKG_ROOT to the installed SDK') + } + name := if major == '17' { 'llvm17-tblgen' } else { 'llvm-tblgen' } + tablegen := os.getenv_opt('LLVM_TABLEGEN') or { os.find_abs_path_of_executable(name)! } + report := os.exec([tablegen, '--version']) + if report.exit_code != 0 || !report.output.split_into_lines().any(it.trim_space() == 'LLVM version ' + version) { + return error('LLVM_TABLEGEN needs a native ${version} TableGen: ${report.output}') + } + // Both supported LLVM releases let the full native TableGen service the + // headers-only generator as well. Cross builds never execute a target tool. + mut opts := [source, build, '-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm' + major, + '-DCMAKE_C_FLAGS_RELEASE=-O1 -g0 -DNDEBUG', '-DCMAKE_CXX_FLAGS_RELEASE=-O1 -g0 -DNDEBUG', + '-DLLVM_TABLEGEN=' + tablegen, '-DLLVM_HEADERS_TABLEGEN=' + tablegen, + '-DLLVM_HOST_TRIPLE=' + arch + '-linux-musl', + '-DLLVM_DEFAULT_TARGET_TRIPLE=' + arch + '-linux-musl', + '-DLLVM_TARGETS_TO_BUILD=' + backend + ';AMDGPU', '-DLLVM_NATIVE_ARCH=' + backend, + '-DLLVM_USE_LINKER=lld', '-DLLVM_PARALLEL_LINK_JOBS=1', '-DLLVM_BUILD_LLVM_DYLIB=ON', + '-DLLVM_LINK_LLVM_DYLIB=ON', '-DLLVM_ENABLE_EH=ON', '-DLLVM_ENABLE_RTTI=ON', + '-DLLVM_ENABLE_FFI=ON', '-DFFI_INCLUDE_DIR=' + root + '/usr/include', + '-DLLVM_ENABLE_ZLIB=FORCE_ON', '-DLLVM_ENABLE_ZSTD=FORCE_ON', '-DLLVM_ENABLE_LIBXML2=FORCE_ON', + '-DLLVM_ENABLE_TERMINFO=OFF', '-DLLVM_ENABLE_LIBEDIT=OFF', '-DLLVM_ENABLE_CURL=OFF', + '-DLLVM_INCLUDE_TESTS=OFF', '-DLLVM_INCLUDE_BENCHMARKS=OFF', '-DLLVM_INCLUDE_EXAMPLES=OFF', + '-DLLVM_INCLUDE_DOCS=OFF', '-DLLVM_APPEND_VC_REV=OFF', '-DLLVM_ENABLE_ASSERTIONS=OFF'] + // A matching native llvm-config avoids a second host LLVM build when + // building the target development package's relocatable llvm-config. + config := os.getenv_opt('LLVM_CONFIG_PATH') or { + os.join_path(os.dir(os.real_path(tablegen)), 'llvm-config') + } + if os.is_file(config) || os.getenv('LLVM_CONFIG_PATH') != '' { + result := os.exec([config, '--version']) + if result.exit_code != 0 || result.output.trim_space() != version { + return error('expected native llvm-config ${version} at ${config}: ${result.output}') + } + opts << '-DLLVM_CONFIG_PATH=' + config + } + os.execvp('vinix-cmake', opts)! +} + +fn main() { + if os.args.len != 4 { + eprintln('usage: vinix-llvm VERSION LLVM_SOURCE_DIR BUILD_DIR') + exit(2) + } + configure(os.args[1], os.args[2], os.args[3]) or { + eprintln(err) + exit(1) + } +} -- 2.56.1