vinix-ports / bzip2 / PKGBUILD.vile
45 lines · 45 sloc · 2.33 KB · 592f9232f87bf13ff85c0a8fe1a64a979e4a8f92
Raw
1defpkgbuild(bzip2,
2 #:pkgname, "bzip2",
3 #:pkgver, "1.0.8",
4 #:pkgrel, 1,
5 #:pkgdesc, "Block-sorting compressor and libbz2",
6 #:arch, [#:x86-64],
7 #:license, "bzip2-1.0.6",
8 #:url, "https://sourceware.org/bzip2/",
9 #:depends, ["musl"],
10 #:source, ["https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz", "bzip2.pc"],
11 #:sha256sums, ["ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269",
12 "b029266dd94f768874e3913d8a791fe0ee7e5509cfc0457e85e8fefd150ec376"],
13 #:prepare, fn() {
14 ; Existing Vinix consumers ask the loader for libbz2.so.1.
15 run("sed", "-i", "s/-Wl,libbz2.so.1.0 /-Wl,libbz2.so.1 /", "bzip2-1.0.8/Makefile-libbz2_so")
16 },
17 #:build, fn() {
18 run("make", "-C", "bzip2-1.0.8", "-f", "Makefile-libbz2_so", "CC=vinix-cc")
19 run("ln", "-s", "libbz2.so.1.0.8", "bzip2-1.0.8/libbz2.so.1")
20 run("make", "-C", "bzip2-1.0.8", "CC=vinix-cc", "libbz2.a", "bzip2recover")
21 },
22 #:check, fn() {
23 root := get-environment-variable("VPAC_MAKEPKG_ROOT")
24 run("cp", "bzip2-1.0.8/sample1.bz2", "input.bz2")
25 run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path", "bzip2-1.0.8",
26 "bzip2-1.0.8/bzip2-shared", "-dk", "input.bz2")
27 run("cmp", "input", "bzip2-1.0.8/sample1.ref")
28 },
29 #:package, fn() {
30 dest := string-append(pkgdir(), "/usr")
31 run("install", "-Dm755", "bzip2-1.0.8/libbz2.so.1.0.8", string-append(dest, "/lib/libbz2.so.1.0.8"))
32 for-each(fn(link) {
33 run("ln", "-s", "libbz2.so.1.0.8", string-append(dest, "/lib/", link))
34 }, list("libbz2.so", "libbz2.so.1", "libbz2.so.1.0"))
35 run("install", "-Dm644", "bzip2-1.0.8/libbz2.a", string-append(dest, "/lib/libbz2.a"))
36 run("install", "-Dm644", "bzip2-1.0.8/bzlib.h", string-append(dest, "/include/bzlib.h"))
37 run("install", "-Dm644", "bzip2.pc", string-append(dest, "/lib/pkgconfig/bzip2.pc"))
38 run("install", "-Dm755", "bzip2-1.0.8/bzip2-shared", string-append(dest, "/bin/bzip2"))
39 run("install", "-Dm755", "bzip2-1.0.8/bzip2recover", string-append(dest, "/bin/bzip2recover"))
40 for-each(fn(link) {
41 run("ln", "-s", "bzip2", string-append(dest, "/bin/", link))
42 }, list("bunzip2", "bzcat"))
43 run("install", "-Dm644", "bzip2-1.0.8/bzip2.1", string-append(dest, "/share/man/man1/bzip2.1"))
44 run("install", "-Dm644", "bzip2-1.0.8/LICENSE", string-append(dest, "/share/licenses/bzip2/LICENSE"))
45 })
46