selected := get-environment-variable("VPAC_TARGET_ARCH") arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" } defpkgbuild(musl-utils, #:pkgname, "musl-utils", #:pkgver, "1.2.6", #:pkgrel, 1, #:pkgdesc, "System configuration, account, encoding and shared library tools for musl", #:arch, [#:x86-64, #:aarch64], #:url, "https://musl.libc.org/", #:license, "MIT AND BSD-2-Clause AND GPL-2.0-or-later", #:depends, ["musl", "busybox", "scanelf"], #:source, ["https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/musl/getent.c", "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/musl/getconf.c", "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/musl/iconv.c", "https://raw.githubusercontent.com/alpinelinux/aports/f2f8ff7cc28e26fb08d050e3cc19eb44a6f749e9/main/musl/ldconfig", "ldd.in", "check.vsh"], #:sha256sums, ["b25f32d306d542246e9358ef65cd67c12b3e3a77656bc467853d3b0c76b5fbbd", "d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c", "f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7", "7065021e04a5060957b5c6907af671a7028230d91927fb0c25892cadd9312b7c", "8424ae8c0513846b9f8ee1948f8e7f26cde7dd63a83f3513e66c3e59c204e615", "b79e9cc82736849ea8696f34b985b3b2d4046caace81ce676dde0573e19efaf4"], #:build, fn() { for-each(fn(name) { run("vinix-cc", "-Os", string-append(name, ".c"), "-o", name) }, list("getent", "getconf", "iconv")) run("cp", "ldd.in", "ldd") run("sed", "-i", string-append("s/@ARCH@/", arch, "/"), "ldd") }, #:check, fn() { run("v", "run", "check.vsh") run("grep", "-F", string-append("/lib/ld-musl-", arch, ".so.1 --list"), "ldd") run("sh", "-n", "ldconfig") }, #:package, fn() { for-each(fn(name) { run("install", "-Dm755", name, string-append(pkgdir(), "/usr/bin/", name)) }, list("getent", "getconf", "iconv", "ldd")) run("install", "-Dm755", "ldconfig", string-append(pkgdir(), "/sbin/ldconfig")) for-each(fn(file) { run("install", "-Dm644", file, string-append(pkgdir(), "/usr/share/licenses/musl-utils/", file)) }, list("getent.c", "getconf.c", "iconv.c")) })