Reuse LLVM runtime builds for Mesa development packages
@@ -0,0 +1,61 @@
1+checkpoint := get-environment-variable("VINIX_LLVM_BUILD")
2+reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { false }
3+build-dir := if reuse { checkpoint } else { "build" }
4+sdk := get-environment-variable("VPAC_MAKEPKG_ROOT")
5+
6+defpkgbuild(llvm17-dev,
7+ #:pkgname, "llvm17-dev",
8+ #:pkgver, "17.0.6",
9+ #:pkgrel, 1,
10+ #:pkgdesc, "LLVM headers and configuration utility for Mesa (LLVM 17)",
11+ #:arch, [#:x86-64, #:aarch64],
12+ #:license, "Apache-2.0 WITH LLVM-exception",
13+ #:url, "https://llvm.org/",
14+ #:depends, ["llvm17-libs=17.0.6-1"],
15+ #:makedepends, ["linux-headers"],
16+ #: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",
17+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/fix-memory-mf_exec-on-aarch64.patch",
18+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/llvm-stack-size.patch",
19+ "rust-feature-tables-17.patch",
20+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"] },
21+ #:sha256sums, if reuse { list() } else { ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813",
22+ "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527",
23+ "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78",
24+ "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56",
25+ "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"] },
26+ #:prepare, fn() {
27+ if reuse {
28+ ; Use only the tree whose library is the installed runtime from this feed.
29+ run("cmp", string-append(build-dir, "/lib/libLLVM-17.so"),
30+ string-append(sdk, "/usr/lib/libLLVM-17.so"))
31+ run("test", "-s", string-append(build-dir, "/CMakeCache.txt"))
32+ } else {
33+ ; LLVM's release archive also contains Clang, LLDB and other independent projects.
34+ 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")
35+ for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-17.0.6.src", "-p1", "-i", string-append("../", patch)) },
36+ list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch", "rust-feature-tables-17.patch",
37+ "0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"))
38+ }
39+ },
40+ #:build, fn() {
41+ if not(reuse) {
42+ run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", build-dir)
43+ }
44+ run("vinix-ninja", build-dir, "llvm-headers", "llvm-config")
45+ },
46+ #:check, fn() {
47+ run("vinix-run", string-append(build-dir, "/bin/llvm-config"), "--version")
48+ run("test", "-s", string-append(build-dir, "/include/llvm/Config/llvm-config.h"))
49+ },
50+ #:package, fn() {
51+ run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "llvm-headers")
52+ run("install", "-Dm755", string-append(build-dir, "/bin/llvm-config"),
53+ string-append(pkgdir(), "/usr/lib/llvm17/bin/llvm-config"))
54+ run("mkdir", "-p", string-append(pkgdir(), "/usr/bin"), string-append(pkgdir(), "/usr/lib/llvm17/lib"))
55+ run("ln", "-s", "../lib/llvm17/bin/llvm-config", string-append(pkgdir(), "/usr/bin/llvm-config-17"))
56+ for-each(fn(soname) {
57+ run("ln", "-s", "../../libLLVM-17.so", string-append(pkgdir(), "/usr/lib/llvm17/lib/", soname))
58+ }, list("libLLVM-17.so", "libLLVM-17.0.6.so", "libLLVM.so"))
59+ run("install", "-Dm644", string-append(sdk, "/usr/share/licenses/llvm17-libs/LICENSE.TXT"),
60+ string-append(pkgdir(), "/usr/share/licenses/llvm17-dev/LICENSE.TXT"))
61+ })
@@ -0,0 +1,23 @@
1+From 0a157fd7a5f61973ffddf96b3d445a718193eb1a Mon Sep 17 00:00:00 2001
2+From: Cameron Hart <cameron.hart@gmail.com>
3+Subject: [PATCH] Add accessors for MCSubtargetInfo CPU and feature tables
4+
5+Keep LLVM 17.0.6's getAllProcessorDescriptions alongside the Rust accessors.
6+
7+--- a/llvm/include/llvm/MC/MCSubtargetInfo.h
8++++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
9+@@ -234,6 +234,14 @@
10+ return ProcDesc;
11+ }
12+
13++ ArrayRef<SubtargetSubTypeKV> getCPUTable() const {
14++ return ProcDesc;
15++ }
16++
17++ ArrayRef<SubtargetFeatureKV> getFeatureTable() const {
18++ return ProcFeatures;
19++ }
20++
21+ virtual unsigned getHwMode() const { return 0; }
22+
23+ /// Return the cache size in bytes for the given level of cache.
@@ -0,0 +1,40 @@
1+defpkgbuild(llvm17-libs,
2+ #:pkgname, "llvm17-libs",
3+ #:pkgver, "17.0.6",
4+ #:pkgrel, 1,
5+ #:pkgdesc, "LLVM runtime for the native CPU and AMDGPU (LLVM 17)",
6+ #:arch, [#:x86-64, #:aarch64],
7+ #:license, "Apache-2.0 WITH LLVM-exception",
8+ #:url, "https://llvm.org/",
9+ #:depends, ["musl", "gcc-libs", "libffi", "libxml2", "zlib", "zstd"],
10+ #:makedepends, ["linux-headers"],
11+ #: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",
12+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/fix-memory-mf_exec-on-aarch64.patch",
13+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/llvm-stack-size.patch",
14+ "rust-feature-tables-17.patch",
15+ "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"],
16+ #:sha256sums, ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813",
17+ "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527",
18+ "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78",
19+ "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56",
20+ "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"],
21+ #:prepare, fn() {
22+ ; LLVM's release archive also contains Clang, LLDB and other independent projects.
23+ 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")
24+ for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-17.0.6.src", "-p1", "-i", string-append("../", patch)) },
25+ list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch", "rust-feature-tables-17.patch",
26+ "0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"))
27+ },
28+ #:build, fn() {
29+ run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", "build")
30+ run("vinix-ninja", "build", "LLVM")
31+ },
32+ #:check, fn() {
33+ run("readelf", "-d", "build/lib/libLLVM-17.so")
34+ run("test", "-s", "build/lib/libLLVM-17.so")
35+ },
36+ #:package, fn() {
37+ run("install", "-Dm755", "build/lib/libLLVM-17.so", string-append(pkgdir(), "/usr/lib/libLLVM-17.so"))
38+ run("ln", "-s", "libLLVM-17.so", string-append(pkgdir(), "/usr/lib/libLLVM-17.0.6.so"))
39+ run("install", "-Dm644", "llvm-project-17.0.6.src/llvm/LICENSE.TXT", string-append(pkgdir(), "/usr/share/licenses/llvm17-libs/LICENSE.TXT"))
40+ })
@@ -0,0 +1,23 @@
1+From 0a157fd7a5f61973ffddf96b3d445a718193eb1a Mon Sep 17 00:00:00 2001
2+From: Cameron Hart <cameron.hart@gmail.com>
3+Subject: [PATCH] Add accessors for MCSubtargetInfo CPU and feature tables
4+
5+Keep LLVM 17.0.6's getAllProcessorDescriptions alongside the Rust accessors.
6+
7+--- a/llvm/include/llvm/MC/MCSubtargetInfo.h
8++++ b/llvm/include/llvm/MC/MCSubtargetInfo.h
9+@@ -234,6 +234,14 @@
10+ return ProcDesc;
11+ }
12+
13++ ArrayRef<SubtargetSubTypeKV> getCPUTable() const {
14++ return ProcDesc;
15++ }
16++
17++ ArrayRef<SubtargetFeatureKV> getFeatureTable() const {
18++ return ProcFeatures;
19++ }
20++
21+ virtual unsigned getHwMode() const { return 0; }
22+
23+ /// Return the cache size in bytes for the given level of cache.
@@ -0,0 +1,56 @@
1+checkpoint := get-environment-variable("VINIX_LLVM_BUILD")
2+reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { false }
3+build-dir := if reuse { checkpoint } else { "build" }
4+sdk := get-environment-variable("VPAC_MAKEPKG_ROOT")
5+
6+defpkgbuild(llvm19-dev,
7+ #:pkgname, "llvm19-dev",
8+ #:pkgver, "19.1.4",
9+ #:pkgrel, 1,
10+ #:pkgdesc, "LLVM headers and configuration utility for Mesa (LLVM 19)",
11+ #:arch, [#:x86-64, #:aarch64],
12+ #:license, "Apache-2.0 WITH LLVM-exception",
13+ #:url, "https://llvm.org/",
14+ #:depends, ["llvm19-libs=19.1.4-1"],
15+ #:makedepends, ["linux-headers"],
16+ #: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",
17+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/fix-memory-mf_exec-on-aarch64.patch",
18+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/llvm-stack-size.patch"] },
19+ #:sha256sums, if reuse { list() } else { ["3aa2d2d2c7553164ad5c6f3b932b31816e422635e18620c9349a7da95b98d811",
20+ "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527",
21+ "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78"] },
22+ #:prepare, fn() {
23+ if reuse {
24+ ; Use only the tree whose library is the installed runtime from this feed.
25+ run("cmp", string-append(build-dir, "/lib/libLLVM.so.19.1"),
26+ string-append(sdk, "/usr/lib/libLLVM.so.19.1"))
27+ run("test", "-s", string-append(build-dir, "/CMakeCache.txt"))
28+ } else {
29+ ; LLVM's release archive also contains Clang, LLDB and other independent projects.
30+ 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")
31+ for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-19.1.4.src", "-p1", "-i", string-append("../", patch)) },
32+ list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch"))
33+ }
34+ },
35+ #:build, fn() {
36+ if not(reuse) {
37+ run("vinix-llvm", "19.1.4", "llvm-project-19.1.4.src/llvm", build-dir)
38+ }
39+ run("vinix-ninja", build-dir, "llvm-headers", "llvm-config")
40+ },
41+ #:check, fn() {
42+ run("vinix-run", string-append(build-dir, "/bin/llvm-config"), "--version")
43+ run("test", "-s", string-append(build-dir, "/include/llvm/Config/llvm-config.h"))
44+ },
45+ #:package, fn() {
46+ run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "llvm-headers")
47+ run("install", "-Dm755", string-append(build-dir, "/bin/llvm-config"),
48+ string-append(pkgdir(), "/usr/lib/llvm19/bin/llvm-config"))
49+ run("mkdir", "-p", string-append(pkgdir(), "/usr/bin"), string-append(pkgdir(), "/usr/lib/llvm19/lib"))
50+ run("ln", "-s", "../lib/llvm19/bin/llvm-config", string-append(pkgdir(), "/usr/bin/llvm-config-19"))
51+ for-each(fn(soname) {
52+ run("ln", "-s", "../../libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/llvm19/lib/", soname))
53+ }, list("libLLVM.so.19.1", "libLLVM-19.so", "libLLVM.so"))
54+ run("install", "-Dm644", string-append(sdk, "/usr/share/licenses/llvm19-libs/LICENSE.TXT"),
55+ string-append(pkgdir(), "/usr/share/licenses/llvm19-dev/LICENSE.TXT"))
56+ })
@@ -0,0 +1,35 @@
1+defpkgbuild(llvm19-libs,
2+ #:pkgname, "llvm19-libs",
3+ #:pkgver, "19.1.4",
4+ #:pkgrel, 1,
5+ #:pkgdesc, "LLVM runtime for the native CPU and AMDGPU (LLVM 19)",
6+ #:arch, [#:x86-64, #:aarch64],
7+ #:license, "Apache-2.0 WITH LLVM-exception",
8+ #:url, "https://llvm.org/",
9+ #:depends, ["musl", "gcc-libs", "libffi", "libxml2", "zlib", "zstd"],
10+ #:makedepends, ["linux-headers"],
11+ #: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",
12+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/fix-memory-mf_exec-on-aarch64.patch",
13+ "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/llvm19/llvm-stack-size.patch"],
14+ #:sha256sums, ["3aa2d2d2c7553164ad5c6f3b932b31816e422635e18620c9349a7da95b98d811",
15+ "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527",
16+ "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78"],
17+ #:prepare, fn() {
18+ ; LLVM's release archive also contains Clang, LLDB and other independent projects.
19+ 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")
20+ for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-19.1.4.src", "-p1", "-i", string-append("../", patch)) },
21+ list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch"))
22+ },
23+ #:build, fn() {
24+ run("vinix-llvm", "19.1.4", "llvm-project-19.1.4.src/llvm", "build")
25+ run("vinix-ninja", "build", "LLVM")
26+ },
27+ #:check, fn() {
28+ run("readelf", "-d", "build/lib/libLLVM.so.19.1")
29+ run("test", "-s", "build/lib/libLLVM.so.19.1")
30+ },
31+ #:package, fn() {
32+ run("install", "-Dm755", "build/lib/libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/libLLVM.so.19.1"))
33+ run("ln", "-s", "libLLVM.so.19.1", string-append(pkgdir(), "/usr/lib/libLLVM-19.so"))
34+ run("install", "-Dm644", "llvm-project-19.1.4.src/llvm/LICENSE.TXT", string-append(pkgdir(), "/usr/share/licenses/llvm19-libs/LICENSE.TXT"))
35+ })
@@ -42,3 +42,5 @@ The LLVM fixture compiles a two-argument integer addition function from LLVM IR,
4242On 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`.
4343
4444The 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`.
45+
46+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.
@@ -0,0 +1,66 @@
1+// Configure LLVM's shared runtime or Mesa development headers for the signed SDK.
2+module main
3+
4+import os
5+
6+fn configure(version string, source string, build string) ! {
7+ major := version.all_before('.')
8+ if version !in ['17.0.6', '19.1.4'] {
9+ return error('unsupported LLVM release ${version}')
10+ }
11+ arch := os.getenv_opt('VPAC_TARGET_ARCH') or { os.uname().machine }
12+ backend := match arch {
13+ 'x86_64' { 'X86' }
14+ 'aarch64' { 'AArch64' }
15+ else { return error('unsupported LLVM target ${arch}') }
16+ }
17+ root := os.getenv('VPAC_MAKEPKG_ROOT')
18+ if !os.is_abs_path(root) {
19+ return error('set VPAC_MAKEPKG_ROOT to the installed SDK')
20+ }
21+ name := if major == '17' { 'llvm17-tblgen' } else { 'llvm-tblgen' }
22+ tablegen := os.getenv_opt('LLVM_TABLEGEN') or { os.find_abs_path_of_executable(name)! }
23+ report := os.exec([tablegen, '--version'])
24+ if report.exit_code != 0 || !report.output.split_into_lines().any(it.trim_space() == 'LLVM version ' + version) {
25+ return error('LLVM_TABLEGEN needs a native ${version} TableGen: ${report.output}')
26+ }
27+ // Both supported LLVM releases let the full native TableGen service the
28+ // headers-only generator as well. Cross builds never execute a target tool.
29+ mut opts := [source, build, '-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm' + major,
30+ '-DCMAKE_C_FLAGS_RELEASE=-O1 -g0 -DNDEBUG', '-DCMAKE_CXX_FLAGS_RELEASE=-O1 -g0 -DNDEBUG',
31+ '-DLLVM_TABLEGEN=' + tablegen, '-DLLVM_HEADERS_TABLEGEN=' + tablegen,
32+ '-DLLVM_HOST_TRIPLE=' + arch + '-linux-musl',
33+ '-DLLVM_DEFAULT_TARGET_TRIPLE=' + arch + '-linux-musl',
34+ '-DLLVM_TARGETS_TO_BUILD=' + backend + ';AMDGPU', '-DLLVM_NATIVE_ARCH=' + backend,
35+ '-DLLVM_USE_LINKER=lld', '-DLLVM_PARALLEL_LINK_JOBS=1', '-DLLVM_BUILD_LLVM_DYLIB=ON',
36+ '-DLLVM_LINK_LLVM_DYLIB=ON', '-DLLVM_ENABLE_EH=ON', '-DLLVM_ENABLE_RTTI=ON',
37+ '-DLLVM_ENABLE_FFI=ON', '-DFFI_INCLUDE_DIR=' + root + '/usr/include',
38+ '-DLLVM_ENABLE_ZLIB=FORCE_ON', '-DLLVM_ENABLE_ZSTD=FORCE_ON', '-DLLVM_ENABLE_LIBXML2=FORCE_ON',
39+ '-DLLVM_ENABLE_TERMINFO=OFF', '-DLLVM_ENABLE_LIBEDIT=OFF', '-DLLVM_ENABLE_CURL=OFF',
40+ '-DLLVM_INCLUDE_TESTS=OFF', '-DLLVM_INCLUDE_BENCHMARKS=OFF', '-DLLVM_INCLUDE_EXAMPLES=OFF',
41+ '-DLLVM_INCLUDE_DOCS=OFF', '-DLLVM_APPEND_VC_REV=OFF', '-DLLVM_ENABLE_ASSERTIONS=OFF']
42+ // A matching native llvm-config avoids a second host LLVM build when
43+ // building the target development package's relocatable llvm-config.
44+ config := os.getenv_opt('LLVM_CONFIG_PATH') or {
45+ os.join_path(os.dir(os.real_path(tablegen)), 'llvm-config')
46+ }
47+ if os.is_file(config) || os.getenv('LLVM_CONFIG_PATH') != '' {
48+ result := os.exec([config, '--version'])
49+ if result.exit_code != 0 || result.output.trim_space() != version {
50+ return error('expected native llvm-config ${version} at ${config}: ${result.output}')
51+ }
52+ opts << '-DLLVM_CONFIG_PATH=' + config
53+ }
54+ os.execvp('vinix-cmake', opts)!
55+}
56+
57+fn main() {
58+ if os.args.len != 4 {
59+ eprintln('usage: vinix-llvm VERSION LLVM_SOURCE_DIR BUILD_DIR')
60+ exit(2)
61+ }
62+ configure(os.args[1], os.args[2], os.args[3]) or {
63+ eprintln(err)
64+ exit(1)
65+ }
66+}