Build and test zlib with the selected target toolchain
@@ -1,9 +1,14 @@
1+selected := get-environment-variable("VPAC_TARGET_ARCH")
2+arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" }
3+cross := get-environment-variable("CROSS_COMPILE")
4+prefix := if string?(cross) { cross } else { "" }
5+
16defpkgbuild(zlib,
27 #:pkgname, "zlib",
38 #:pkgver, "1.4",
4- #:pkgrel, 1,
9+ #:pkgrel, 2,
510 #:pkgdesc, "DEFLATE compression library and development headers",
6- #:arch, [#:x86-64],
11+ #:arch, [#:x86-64, #:aarch64],
712 #:license, "Zlib",
813 #:url, "https://zlib.net/",
914 #:depends, ["musl"],
@@ -11,16 +16,14 @@ defpkgbuild(zlib,
1116 #:sha256sums, ["02dd159783677a749c04adbdd02b55b8a2bcc7e054f51b76b549199a916ad584"],
1217
1318 #:build, fn() {
14- root := get-environment-variable("VPAC_MAKEPKG_ROOT")
1519 run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",
16- string-append("CC=gcc --sysroot=", root, " -specs=", root, "/usr/lib/musl-gcc-sysroot.specs"),
17- "CFLAGS=-O2", "CHOST=x86_64-linux-musl", "AR=ar", "RANLIB=ranlib",
20+ "CC=vinix-cc", "CFLAGS=-O2", string-append("CHOST=", arch, "-linux-musl"),
21+ string-append("AR=", prefix, "ar"), string-append("RANLIB=", prefix, "ranlib"),
1822 "zlib-1.4/configure", "--prefix=/usr", "--shared", "--disable-crcvx")
1923 run("make")
2024 },
2125 #:check, fn() {
22- root := get-environment-variable("VPAC_MAKEPKG_ROOT")
23- run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path", ".", "./examplesh")
26+ run("vinix-run", "--library-path", ".", "./examplesh")
2427 },
2528 #:package, fn() {
2629 run("make", "install", string-append("DESTDIR=", pkgdir()))