vinix-ports / file / PKGBUILD.vile
39 lines · 39 sloc · 2.09 KB · 704e7dee1b6b27840f3eb83a02f28e853435c47f
Raw
1defpkgbuild(file,
2 #:pkgname, "file",
3 #:pkgver, "5.46",
4 #:pkgrel, 1,
5 #:pkgdesc, "Identify file formats with the compiled magic database",
6 #:url, "https://www.darwinsys.com/file/",
7 #:license, "BSD-2-Clause",
8 #:arch, [#:x86-64, #:aarch64],
9 #:depends, ["musl"],
10 #:source, ["https://astron.com/pub/file/file-5.46.tar.gz",
11 "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/file/file-5.46-pr-579-net147-fix-stack-overrun.patch",
12 "check.py"],
13 #:sha256sums, ["c9cc77c7c560c543135edc555af609d5619dbef011997e988ce40a3d75d86088",
14 "c1f9f7c7195a09d8f5f846624665f74d27990b0d71fcf812d5bb0a55e2f25cdc",
15 "04af1f3aa45014a42bd59133ffc4bc5fea37e72affee1fb2c8a4b4a0ec15ad34"],
16 #:prepare, fn() {
17 for-each(fn(patch) {
18 run("patch", "--batch", "--fuzz=0", "-d", "file-5.46", "-p1", "-i", string-append(srcdir(), "/", patch))
19 }, list("file-5.46-pr-579-net147-fix-stack-overrun.patch"))
20 },
21 #:build, fn() {
22 ; The magic database compiler must run on the builder and match the target version.
23 run("mkdir", "native")
24 run("env", "-C", "native", "CC=cc", "../file-5.46/configure", "--disable-shared",
25 "--disable-zlib", "--disable-bzlib", "--disable-xzlib", "--disable-zstdlib", "--disable-lzlib")
26 run("make", "-C", "native/src", "all")
27 run("vinix-configure", "file-5.46/configure", "--enable-static", "--disable-zlib", "--disable-bzlib",
28 "--disable-xzlib", "--disable-zstdlib", "--disable-lzlib")
29 run("make", string-append("FILE_COMPILE=", srcdir(), "/native/src/file"))
30 },
31 #:check, fn() {
32 run("make", string-append("FILE_COMPILE=", srcdir(), "/native/src/file"), string-append("DESTDIR=", srcdir(), "/checked"), "install")
33 run("python3", "check.py")
34 },
35 #:package, fn() {
36 run("make", string-append("FILE_COMPILE=", srcdir(), "/native/src/file"), string-append("DESTDIR=", pkgdir()), "install")
37 run("find", pkgdir(), "-name", "*.la", "-delete")
38 run("install", "-Dm644", "file-5.46/COPYING", string-append(pkgdir(), "/usr/share/licenses/file/COPYING"))
39 })
40