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