vinix-ports / ports / libelf / PKGBUILD.vile
49 lines · 49 sloc · 3.3 KB · c33d8afc2906b8dd9a8b905224eccd49a44f7ad5
Raw
1defpkgbuild(libelf,
2 #:pkgname, "libelf",
3 #:pkgver, "0.191",
4 #:pkgrel, 2,
5 #:pkgdesc, "Read, create and modify ELF objects with the elfutils library",
6 #:arch, [#:x86-64, #:aarch64],
7 #:url, "https://sourceware.org/elfutils/",
8 #:license, "GPL-3.0-or-later AND (GPL-2.0-or-later OR LGPL-3.0-or-later)",
9 #:depends, ["musl", "bzip2", "xz", "zlib", "zstd"],
10 #:makedepends, ["argp-standalone", "bsd-compat-headers", "linux-headers", "musl-fts", "musl-obstack", "musl-legacy-error"],
11 #:source, ["https://sourceware.org/elfutils/ftp/0.191/elfutils-0.191.tar.bz2",
12 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/elfutils/fix-aarch64_fregs.patch",
13 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/elfutils/fix-uninitialized.patch",
14 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/elfutils/musl-macros.patch",
15 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/elfutils/musl-asm-ptrace-h.patch", "check.v"],
16 #:sha256sums, ["df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871",
17 "a5b131c65927da751aae47a476f26e59ce53300777d54aef6c65c1eceef1a12d",
18 "ee94f9ab26049f8100db1b6bfc760454f5a220190a5eb907faee65129ec9e962",
19 "8e3924f08d4af34a45d0059224ea42b7afdc43837d053243e855cdaf295dde67",
20 "f03d703dc76002413f4cd04e82c1da79365885df65fbd4eb660f1de42ee41ba9",
21 "f7274e98c3813baabf0bcdbe57c6c85ba1dbfc3dd73654b827c61f7cc5e7de20"],
22 #:prepare, fn() {
23 for-each(fn(file) {
24 run("patch", "--batch", "-d", "elfutils-0.191", "-p1", "-i", string-append("../", file))
25 }, list("fix-aarch64_fregs.patch", "fix-uninitialized.patch", "musl-macros.patch", "musl-asm-ptrace-h.patch"))
26 },
27 #:build, fn() {
28 run("env", "CFLAGS=-O2 -D_GNU_SOURCE -Wno-error -Wno-null-dereference", "vinix-configure", "elfutils-0.191/configure",
29 "--disable-nls", "--disable-demangler", "--disable-libdebuginfod", "--disable-debuginfod", "--with-zstd")
30 run("make", "-C", "lib")
31 run("make", "-C", "libelf")
32 },
33 #:check, fn() {
34 target := get-environment-variable("VPAC_TARGET_ARCH")
35 arch := if string?(target) {
36 if string=?("aarch64", target) { "arm64" } else { "amd64" }
37 } else if memq(string->symbol("aarch64"), features()) { "arm64" } else { "amd64" }
38 run("v", "-os", "linux", "-arch", arch, "-d", "musl", "-d", "no_backtrace", "-d", "no_segfault_handler", "-gc", "none", "-o", "check.c", "check.v")
39 run("vinix-cc", "-Ielfutils-0.191/libelf", "check.c", "-Llibelf", "-lelf",
40 string-append("-Wl,-rpath-link,", get-environment-variable("VPAC_MAKEPKG_ROOT"), "/usr/lib"), "-o", "check")
41 run("vinix-run", "--library-path", "libelf", "check", "libelf/libelf.so")
42 },
43 #:package, fn() {
44 run("make", "-C", "libelf", "install", string-append("DESTDIR=", pkgdir()))
45 run("install", "-Dm644", "config/libelf.pc", string-append(pkgdir(), "/usr/lib/pkgconfig/libelf.pc"))
46 for-each(fn(file) {
47 run("install", "-Dm644", string-append("elfutils-0.191/", file), string-append(pkgdir(), "/usr/share/licenses/libelf/", file))
48 }, list("COPYING", "COPYING-GPLV2", "COPYING-LGPLV3"))
49 })
50