defpkgbuild(bzip2, #:pkgname, "bzip2", #:pkgver, "1.0.8", #:pkgrel, 1, #:pkgdesc, "Block-sorting compressor and libbz2", #:arch, [#:x86-64], #:license, "bzip2-1.0.6", #:url, "https://sourceware.org/bzip2/", #:depends, ["musl"], #:source, ["https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz", "bzip2.pc"], #:sha256sums, ["ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269", "b029266dd94f768874e3913d8a791fe0ee7e5509cfc0457e85e8fefd150ec376"], #:prepare, fn() { ; Existing Vinix consumers ask the loader for libbz2.so.1. run("sed", "-i", "s/-Wl,libbz2.so.1.0 /-Wl,libbz2.so.1 /", "bzip2-1.0.8/Makefile-libbz2_so") }, #:build, fn() { run("make", "-C", "bzip2-1.0.8", "-f", "Makefile-libbz2_so", "CC=vinix-cc") run("ln", "-s", "libbz2.so.1.0.8", "bzip2-1.0.8/libbz2.so.1") run("make", "-C", "bzip2-1.0.8", "CC=vinix-cc", "libbz2.a", "bzip2recover") }, #:check, fn() { root := get-environment-variable("VPAC_MAKEPKG_ROOT") run("cp", "bzip2-1.0.8/sample1.bz2", "input.bz2") run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path", "bzip2-1.0.8", "bzip2-1.0.8/bzip2-shared", "-dk", "input.bz2") run("cmp", "input", "bzip2-1.0.8/sample1.ref") }, #:package, fn() { dest := string-append(pkgdir(), "/usr") run("install", "-Dm755", "bzip2-1.0.8/libbz2.so.1.0.8", string-append(dest, "/lib/libbz2.so.1.0.8")) for-each(fn(link) { run("ln", "-s", "libbz2.so.1.0.8", string-append(dest, "/lib/", link)) }, list("libbz2.so", "libbz2.so.1", "libbz2.so.1.0")) run("install", "-Dm644", "bzip2-1.0.8/libbz2.a", string-append(dest, "/lib/libbz2.a")) run("install", "-Dm644", "bzip2-1.0.8/bzlib.h", string-append(dest, "/include/bzlib.h")) run("install", "-Dm644", "bzip2.pc", string-append(dest, "/lib/pkgconfig/bzip2.pc")) run("install", "-Dm755", "bzip2-1.0.8/bzip2-shared", string-append(dest, "/bin/bzip2")) run("install", "-Dm755", "bzip2-1.0.8/bzip2recover", string-append(dest, "/bin/bzip2recover")) for-each(fn(link) { run("ln", "-s", "bzip2", string-append(dest, "/bin/", link)) }, list("bunzip2", "bzcat")) run("install", "-Dm644", "bzip2-1.0.8/bzip2.1", string-append(dest, "/share/man/man1/bzip2.1")) run("install", "-Dm644", "bzip2-1.0.8/LICENSE", string-append(dest, "/share/licenses/bzip2/LICENSE")) })