selected := get-environment-variable("VPAC_TARGET_ARCH") arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" } v-arch := if string=?("aarch64", arch) { "arm64" } else { "x64" } defpkgbuild(vpac, #:pkgname, "vpac", #:pkgver, "1.0.0", #:pkgrel, 2, #:pkgdesc, "Vinix package manager and native Vile package builder", #:arch, [#:x86-64, #:aarch64], #:url, "https://gitly.divio.city/me/vpac", #:license, "GPL-3.0-only", #:depends, ["musl", "gc", "curl", "libarchive", "libgpg-error", "gpgme", "gnupg", "libseccomp", "vinix-accounts>=0.1.0-2"], #:makedepends, ["linux-headers"], #:backup, ["etc/vpac.d/config.vile"], ; Native makepkg checks out each full commit after cloning its public repository. #:source, ["vpac-src::git+https://gitly.divio.city/me/vpac.git#commit=e7147c7fac0dc130fe03c7accf07c75a88188d3d", "nspkg::git+https://gitly.divio.city/me/nspkg.git#commit=c01b0795d1db56c7bce2539b2c46b110637fdc1a", "stutter::git+https://gitly.divio.city/me/stutter.git#commit=29b47cb4b818f95a5308d3c086bd7933b7c176bd", "vile::git+https://git.vorelabs.dev/diviocity/vile.git#commit=76646891b77a3d5c6af4a1e42b122cd61dc1654b", "config.vile.in", "check-config.py", "vinix-landlock.patch"], #:sha256sums, ["SKIP", "SKIP", "SKIP", "SKIP", "da473de43c4b1232145dee708df4762a1b26f930bb5693053b19a763df462bf4", "eb72a7f3ce972cfe0b653984324332cf119d778e723d7e659b3a49494cc883ea", "7c0e1262f5d7b65a1c95b4efb5ea00e2fab9f0ef4f27b304f359858e564aa212"], #:prepare, fn() { run("mkdir", "modules") run("mv", "nspkg", "stutter", "vile", "modules/") run("patch", "--batch", "--fuzz=0", "-d", "modules/nspkg", "-p1", "-i", string-append(srcdir(), "/vinix-landlock.patch")) run("cp", "config.vile.in", "config.vile") run("sed", "-i", string-append("s/@ARCH@/", arch, "/g"), "config.vile") }, #:build, fn() { paths := string-append(srcdir(), "/vpac-src|", srcdir(), "/modules|", srcdir(), "/modules/vile|@vlib") ; Embed the Vile assets while keeping the generated C inside the bootstrap build budget. ; The V driver runs on the build host. Match the target libc even when the host uses glibc. run("v", "-prod", "-no-prod-options", "-cflags", "-O0", "-no-parallel", "-no-retry-compilation", "-os", "linux", "-arch", v-arch, "-cc", "vinix-cc", "-gc", "boehm", "-d", "musl", "-d", "dynamic_boehm", "-d", "nspkg_libcurl", "-path", paths, "-o", "vpac-target", "vpac-src/src") }, #:check, fn() { run("python3", "check-config.py") }, #:package, fn() { run("install", "-Dm755", "vpac-target", string-append(pkgdir(), "/usr/bin/vpac")) run("install", "-Dm644", "config.vile", string-append(pkgdir(), "/etc/vpac.d/config.vile")) run("install", "-d", string-append(pkgdir(), "/var/lib/vpac"), string-append(pkgdir(), "/var/cache/vpac/pkg"), string-append(pkgdir(), "/etc/vpac.d/hooks"), string-append(pkgdir(), "/var/log")) run("install", "-d", "-m700", string-append(pkgdir(), "/etc/vpac.d/gnupg")) })