vinix-ports / vpac / PKGBUILD.vile
48 lines · 47 sloc · 2.85 KB · 7225c24983dbc3e90a158f419956a160512c862b
Raw
1selected := get-environment-variable("VPAC_TARGET_ARCH")
2arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" }
3v-arch := if string=?("aarch64", arch) { "arm64" } else { "x64" }
4
5defpkgbuild(vpac,
6 #:pkgname, "vpac",
7 #:pkgver, "1.0.0",
8 #:pkgrel, 1,
9 #:pkgdesc, "Vinix package manager and native Vile package builder",
10 #:arch, [#:x86-64, #:aarch64],
11 #:url, "https://gitly.divio.city/me/vpac",
12 #:license, "GPL-3.0-only",
13 #:depends, ["musl", "gc", "curl", "libarchive", "libgpg-error", "gpgme", "gnupg", "libseccomp", "vinix-accounts>=0.1.0-2"],
14 #:makedepends, ["linux-headers"],
15 #:backup, ["etc/vpac.d/config.vile"],
16 ; Native makepkg checks out each full commit after cloning its public repository.
17 #:source, ["vpac-src::git+https://gitly.divio.city/me/vpac.git#commit=e7147c7fac0dc130fe03c7accf07c75a88188d3d",
18 "nspkg::git+https://gitly.divio.city/me/nspkg.git#commit=c01b0795d1db56c7bce2539b2c46b110637fdc1a",
19 "stutter::git+https://gitly.divio.city/me/stutter.git#commit=29b47cb4b818f95a5308d3c086bd7933b7c176bd",
20 "vile::git+https://git.vorelabs.dev/diviocity/vile.git#commit=76646891b77a3d5c6af4a1e42b122cd61dc1654b",
21 "config.vile.in", "check-config.py"],
22 #:sha256sums, ["SKIP", "SKIP", "SKIP", "SKIP", "da473de43c4b1232145dee708df4762a1b26f930bb5693053b19a763df462bf4",
23 "eb72a7f3ce972cfe0b653984324332cf119d778e723d7e659b3a49494cc883ea"],
24 #:prepare, fn() {
25 run("mkdir", "modules")
26 run("mv", "nspkg", "stutter", "vile", "modules/")
27 run("cp", "config.vile.in", "config.vile")
28 run("sed", "-i", string-append("s/@ARCH@/", arch, "/g"), "config.vile")
29 },
30 #:build, fn() {
31 paths := string-append(srcdir(), "/vpac-src|", srcdir(), "/modules|", srcdir(), "/modules/vile|@vlib")
32 ; Embed the Vile assets while keeping the generated C inside the bootstrap build budget.
33 ; The V driver runs on the build host. Match the target libc even when the host uses glibc.
34 run("v", "-prod", "-no-prod-options", "-cflags", "-O0", "-no-parallel", "-no-retry-compilation",
35 "-os", "linux", "-arch", v-arch, "-cc", "vinix-cc",
36 "-gc", "boehm", "-d", "musl", "-d", "dynamic_boehm", "-d", "nspkg_libcurl",
37 "-path", paths, "-o", "vpac-target", "vpac-src/src")
38 },
39 #:check, fn() {
40 run("python3", "check-config.py")
41 },
42 #:package, fn() {
43 run("install", "-Dm755", "vpac-target", string-append(pkgdir(), "/usr/bin/vpac"))
44 run("install", "-Dm644", "config.vile", string-append(pkgdir(), "/etc/vpac.d/config.vile"))
45 run("install", "-d", string-append(pkgdir(), "/var/lib/vpac"), string-append(pkgdir(), "/var/cache/vpac/pkg"),
46 string-append(pkgdir(), "/etc/vpac.d/hooks"), string-append(pkgdir(), "/var/log"))
47 run("install", "-d", "-m700", string-append(pkgdir(), "/etc/vpac.d/gnupg"))
48 })
49