vinix-ports / llvm17-libs / PKGBUILD.vile
50 lines · 49 sloc · 3.12 KB · 6f0fcb2b76e79aea9930a86b7b9b508a72630e9f
Raw
1checkpoint := get-environment-variable("VINIX_LLVM_BUILD")
2reuse := if string?(checkpoint) { not(string=?("", checkpoint)) } else { #f }
3build-dir := if reuse { checkpoint } else { "build" }
4
5defpkgbuild(llvm17-libs,
6 #:pkgname, "llvm17-libs",
7 #:pkgver, "17.0.6",
8 #:pkgrel, 2,
9 #:pkgdesc, "LLVM runtime for the native CPU and AMDGPU (LLVM 17)",
10 #:arch, [#:x86-64, #:aarch64],
11 #:license, "Apache-2.0 WITH LLVM-exception",
12 #:url, "https://llvm.org/",
13 #:depends, ["musl", "gcc-libs", "libffi", "libxml2", "zlib", "zstd"],
14 #:makedepends, ["linux-headers"],
15 #: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",
16 "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/fix-memory-mf_exec-on-aarch64.patch",
17 "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/llvm-stack-size.patch",
18 "rust-feature-tables-17.patch",
19 "https://raw.githubusercontent.com/alpinelinux/aports/d556464b9015ef9447ce4ecacad98c956d730bb6/main/llvm17/0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"] },
20 #:sha256sums, if reuse { list() } else { ["58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813",
21 "0163a3cf492b5d0b91cafc142a6ac4f1333c65bc52e627bbccbf3ad927f8d527",
22 "3cacabc5c9b540c6240c063f8d9eca64c0f0d955ffec86bafc04d5f9bd986d78",
23 "8b0d457887e701f264ce4359facaf342f528a36c040cb408be04365127d93e56",
24 "989c86cf3f551afa8959ae976e26721569a744cfce6a75aba886ca50dfa87225"] },
25 #:prepare, fn() {
26 if not(reuse) {
27 ; LLVM's release archive also contains Clang, LLDB and other independent projects.
28 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")
29 for-each(fn(patch) { run("patch", "--batch", "--fuzz=0", "-d", "llvm-project-17.0.6.src", "-p1", "-i", string-append("../", patch)) },
30 list("fix-memory-mf_exec-on-aarch64.patch", "llvm-stack-size.patch", "rust-feature-tables-17.patch",
31 "0001-Revert-Pseudo-Probe-Make-.pseudo_probe-GC-able.patch"))
32 }
33 },
34 #:build, fn() {
35 if not(reuse) {
36 run("vinix-llvm", "17.0.6", "llvm-project-17.0.6.src/llvm", build-dir)
37 run("vinix-ninja", build-dir, "LLVM")
38 }
39 },
40 #:check, fn() {
41 run("test", "-s", string-append(build-dir, "/lib/libLLVM-17.so"))
42 },
43 #:package, fn() {
44 ; CMake replaces the build-tree RUNPATH while installing the runtime.
45 run("env", string-append("DESTDIR=", pkgdir()), "cmake", "--install", build-dir, "--component", "LLVM", "--prefix", "/usr")
46 run("rm", "-f", "--", string-append(pkgdir(), "/usr/lib/libLLVM.so"))
47 run("readelf", "-d", string-append(pkgdir(), "/usr/lib/libLLVM-17.so"))
48 license := string-append(build-dir, "/../llvm-project-17.0.6.src/llvm/LICENSE.TXT")
49 run("install", "-Dm644", license, string-append(pkgdir(), "/usr/share/licenses/llvm17-libs/LICENSE.TXT"))
50 })
51