| 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 | arm := string=?(arch, "aarch64") |
| 4 | musl := if arm { "musl>=1.2.6-4" } else { "musl" } |
| 5 | cross := get-environment-variable("CROSS_COMPILE") |
| 6 | prefix := if string?(cross) { cross } else { "" } |
| 7 | |
| 8 | defpkgbuild(zlib, |
| 9 | #:pkgname, "zlib", |
| 10 | #:pkgver, "1.4", |
| 11 | #:pkgrel, if arm { 3 } else { 2 }, |
| 12 | #:pkgdesc, "DEFLATE compression library and development headers", |
| 13 | #:arch, [#:x86-64, #:aarch64], |
| 14 | #:license, "Zlib", |
| 15 | #:url, "https://zlib.net/", |
| 16 | #:depends, [musl], |
| 17 | #:source, ["https://zlib.net/fossils/zlib-1.4.tar.gz"], |
| 18 | #:sha256sums, ["02dd159783677a749c04adbdd02b55b8a2bcc7e054f51b76b549199a916ad584"], |
| 19 | |
| 20 | #:build, fn() { |
| 21 | run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", |
| 22 | "CC=vinix-cc", "CFLAGS=-O2", string-append("CHOST=", arch, "-linux-musl"), |
| 23 | string-append("AR=", prefix, "ar"), string-append("RANLIB=", prefix, "ranlib"), |
| 24 | "zlib-1.4/configure", "--prefix=/usr", "--shared", "--disable-crcvx") |
| 25 | run("make") |
| 26 | }, |
| 27 | #:check, fn() { |
| 28 | run("vinix-run", "--library-path", ".", "./examplesh") |
| 29 | }, |
| 30 | #:package, fn() { |
| 31 | run("make", "install", string-append("DESTDIR=", pkgdir())) |
| 32 | run("install", "-Dm644", "zlib-1.4/LICENSE", string-append(pkgdir(), "/usr/share/licenses/zlib/LICENSE")) |
| 33 | }) |
| 34 | |