Add source ports for file and the GCC Graphite library
@@ -0,0 +1,39 @@
1+defpkgbuild(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+ })
@@ -0,0 +1,14 @@
1+"""Exercise the target file executable with its installed magic database."""
2+from pathlib import Path
3+import subprocess
4+
5+program = "checked/usr/bin/file"
6+magic = Path("checked/usr/share/misc/magic.mgc")
7+if not magic.is_file():
8+ raise SystemExit(f"installed magic database missing at {magic}")
9+command = ["vinix-run", "--library-path", "checked/usr/lib", program,
10+ "-m", str(magic), "--brief", "--mime-type"]
11+Path("plain.txt").write_text("Vinix package fixture\n")
12+types = subprocess.check_output([*command, program, "plain.txt"], text=True).splitlines()
13+if len(types) != 2 or types[0] not in ("application/x-executable", "application/x-pie-executable") or types[1] != "text/plain":
14+ raise SystemExit(f"unexpected target MIME types: {types}")
@@ -0,0 +1,26 @@
1+defpkgbuild(isl25,
2+ #:pkgname, "isl25",
3+ #:pkgver, "0.25",
4+ #:pkgrel, 1,
5+ #:pkgdesc, "Integer set and relation library with the libisl.so.23 ABI",
6+ #:arch, [#:x86-64, #:aarch64],
7+ #:url, "https://libisl.sourceforge.io/",
8+ #:license, "MIT",
9+ #:depends, ["musl", "gmp"],
10+ #:source, ["https://distfiles.alpinelinux.org/distfiles/v3.21/isl-0.25.tar.bz2", "count.c"],
11+ #:sha256sums, ["4305c54d4eebc4bf3ce365af85f04984ef5aa97a52e01128445e26da5b1f467a", "6d9c89822656eb1ae360cdb00b37774cd1cbe790ec5028f64209947404bee201"],
12+ #:build, fn() {
13+ run("vinix-configure", "isl-0.25/configure", "--with-int=gmp", "--disable-static")
14+ run("make", "gitversion.h")
15+ run("make", "libisl.la")
16+ },
17+ #:check, fn() {
18+ run("vinix-cc", "-Iinclude", "-Iisl-0.25/include", "count.c", "-L.libs", "-lisl", "-lgmp", "-o", "count")
19+ run("vinix-run", "--library-path", ".libs", "./count")
20+ },
21+ #:package, fn() {
22+ run("make", "install-libLTLIBRARIES", "install-pkgincludeHEADERS", "install-nodist_pkgincludeHEADERS",
23+ "install-pkgconfigDATA", string-append("DESTDIR=", pkgdir()))
24+ run("find", pkgdir(), "-name", "*.la", "-delete")
25+ run("install", "-Dm644", "isl-0.25/LICENSE", string-append(pkgdir(), "/usr/share/licenses/isl25/LICENSE"))
26+ })
@@ -0,0 +1,14 @@
1+#include <isl/ctx.h>
2+#include <isl/set.h>
3+#include <isl/val.h>
4+
5+int main(void) {
6+ isl_ctx *ctx = isl_ctx_alloc();
7+ isl_set *set = isl_set_read_from_str(ctx, "{ [i] : 0 <= i <= 3 }");
8+ isl_val *n = isl_set_count_val(set);
9+ int ok = n && isl_val_eq_si(n, 4) == isl_bool_true;
10+ isl_val_free(n);
11+ isl_set_free(set);
12+ isl_ctx_free(ctx);
13+ return !ok;
14+}