selected := get-environment-variable("VPAC_TARGET_ARCH") arch := if string?(selected) { selected } else if memq(string->symbol("aarch64"), features()) { "aarch64" } else { "x86_64" } cross := get-environment-variable("CROSS_COMPILE") prefix := if string?(cross) { cross } else { "" } defpkgbuild(zlib, #:pkgname, "zlib", #:pkgver, "1.4", #:pkgrel, 2, #:pkgdesc, "DEFLATE compression library and development headers", #:arch, [#:x86-64, #:aarch64], #:license, "Zlib", #:url, "https://zlib.net/", #:depends, ["musl"], #:source, ["https://zlib.net/fossils/zlib-1.4.tar.gz"], #:sha256sums, ["02dd159783677a749c04adbdd02b55b8a2bcc7e054f51b76b549199a916ad584"], #:build, fn() { run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", "CC=vinix-cc", "CFLAGS=-O2", string-append("CHOST=", arch, "-linux-musl"), string-append("AR=", prefix, "ar"), string-append("RANLIB=", prefix, "ranlib"), "zlib-1.4/configure", "--prefix=/usr", "--shared", "--disable-crcvx") run("make") }, #:check, fn() { run("vinix-run", "--library-path", ".", "./examplesh") }, #:package, fn() { run("make", "install", string-append("DESTDIR=", pkgdir())) run("install", "-Dm644", "zlib-1.4/LICENSE", string-append(pkgdir(), "/usr/share/licenses/zlib/LICENSE")) })