From d7c07d8d2662c86b2ccd53b86eac2460f42dbddf Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 02:46:10 +0100 Subject: [PATCH] Package GNU Readline and the target libseccomp library --- libseccomp/PKGBUILD.vile | 33 ++++++++++ libseccomp/check.py | 8 +++ libseccomp/remove-redefinition-prctl.patch | 9 +++ readline/PKGBUILD.vile | 77 ++++++++++++++++++++++ readline/check-history.c | 15 +++++ 5 files changed, 142 insertions(+) create mode 100644 libseccomp/PKGBUILD.vile create mode 100644 libseccomp/check.py create mode 100644 libseccomp/remove-redefinition-prctl.patch create mode 100644 readline/PKGBUILD.vile create mode 100644 readline/check-history.c diff --git a/libseccomp/PKGBUILD.vile b/libseccomp/PKGBUILD.vile new file mode 100644 index 0000000..5f2c873 --- /dev/null +++ b/libseccomp/PKGBUILD.vile @@ -0,0 +1,33 @@ +defpkgbuild(libseccomp, + #:pkgname, "libseccomp", + #:pkgver, "2.5.5", + #:pkgrel, 1, + #:pkgdesc, "Library and tools for Linux syscall filtering", + #:arch, [#:x86-64, #:aarch64], + #:url, "https://github.com/seccomp/libseccomp", + #:license, "LGPL-2.1-or-later", + #:depends, ["musl"], + #:makedepends, ["linux-headers"], + #:source, ["https://github.com/seccomp/libseccomp/releases/download/v2.5.5/libseccomp-2.5.5.tar.gz", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/libseccomp/loongarch64.patch", + "remove-redefinition-prctl.patch", "check.py"], + #:sha256sums, ["248a2c8a4d9b9858aa6baf52712c34afefcf9c9e94b76dce02c1c9aa25fb3375", + "0b7c5782ebf6b996e16147f10b2e366fe75b6275ba589e043ec78ec7779cc651", + "3506ffadf6699b78164594b3615043233c9f57d9e6bde0418c552754a505f0dc", + "aeb5ec0522d3f9818369587a9a02305db2117db99744b193bed4eca475df157a"], + #:prepare, fn() { + run("patch", "--batch", "--fuzz=0", "-d", "libseccomp-2.5.5", "-p1", "-i", "../loongarch64.patch") + run("patch", "--batch", "--fuzz=0", "-d", "libseccomp-2.5.5", "-p1", "-i", "../remove-redefinition-prctl.patch") + }, + #:build, fn() { + run("vinix-configure", "libseccomp-2.5.5/configure", "--disable-python") + run("make") + }, + #:check, fn() { + run("python3", "check.py") + }, + #:package, fn() { + run("make", "install", string-append("DESTDIR=", pkgdir())) + run("find", pkgdir(), "-name", "*.la", "-delete") + run("install", "-Dm644", "libseccomp-2.5.5/LICENSE", string-append(pkgdir(), "/usr/share/licenses/libseccomp/LICENSE")) + }) diff --git a/libseccomp/check.py b/libseccomp/check.py new file mode 100644 index 0000000..f8c1cc9 --- /dev/null +++ b/libseccomp/check.py @@ -0,0 +1,8 @@ +"""Query both release ABI tables with the target resolver.""" +import subprocess + +for architecture, expected in (("x86_64", "0"), ("aarch64", "63")): + result = subprocess.check_output(["vinix-run", "--library-path", "src/.libs", + "tools/.libs/scmp_sys_resolver", "-a", architecture, "read"], text=True) + if result.strip() != expected: + raise SystemExit(f"incorrect read syscall for {architecture}: {result.strip()}") diff --git a/libseccomp/remove-redefinition-prctl.patch b/libseccomp/remove-redefinition-prctl.patch new file mode 100644 index 0000000..3c77beb --- /dev/null +++ b/libseccomp/remove-redefinition-prctl.patch @@ -0,0 +1,9 @@ +--- a/src/system.c ++++ b/src/system.c +@@ -22,6 +22,5 @@ + #include + #include +-#include + + #define _GNU_SOURCE + #include diff --git a/readline/PKGBUILD.vile b/readline/PKGBUILD.vile new file mode 100644 index 0000000..faf61e5 --- /dev/null +++ b/readline/PKGBUILD.vile @@ -0,0 +1,77 @@ +defpkgbuild(readline, + #:pkgname, "readline", + #:pkgver, "8.2.13", + #:pkgrel, 1, + #:pkgdesc, "GNU readline and history libraries", + #:arch, [#:x86-64, #:aarch64], + #:license, "GPL-3.0-or-later", + #:url, "https://tiswww.case.edu/php/chet/readline/rltop.html", + #:depends, ["musl", "ncurses"], + #:backup, ["etc/inputrc"], + #:source, ["https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/readline/fix-ncurses-underlinking.patch", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/readline/fix-rl_do_undo-crash.patch", + "https://raw.githubusercontent.com/alpinelinux/aports/a7de3e63cc8015474a4feadd8bb7c0ecc097b1fa/main/readline/inputrc", + "readline82-001.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-001", + "readline82-002.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-002", + "readline82-003.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-003", + "readline82-004.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-004", + "readline82-005.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-005", + "readline82-006.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-006", + "readline82-007.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-007", + "readline82-008.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-008", + "readline82-009.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-009", + "readline82-010.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-010", + "readline82-011.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-011", + "readline82-012.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-012", + "readline82-013.patch::https://ftp.gnu.org/gnu/readline/readline-8.2-patches/readline82-013", "check-history.c"], + #:sha256sums, ["3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35", + "2b95ef139bba6ada370d1182b21ea92029923ff9d29ca0b45d25ae7e07fec5a5", + "da6c997aac6601bd52e274e365da38850c7f3b2bd6e44fc057fa7f567c0727fa", + "1372f6d69c3638d63724c6daecf339c82bb9520a77ead2d497cb66e7114e62bb", + "bbf97f1ec40a929edab5aa81998c1e2ef435436c597754916e6a5868f273aff7", + "e06503822c62f7bc0d9f387d4c78c09e0ce56e53872011363c74786c7cd4c053", + "24f587ba46b46ed2b1868ccaf9947504feba154bb8faabd4adaea63ef7e6acb0", + "79572eeaeb82afdc6869d7ad4cba9d4f519b1218070e17fa90bbecd49bd525ac", + "622ba387dae5c185afb4b9b20634804e5f6c1c6e5e87ebee7c35a8f065114c99", + "c7b45ff8c0d24d81482e6e0677e81563d13c74241f7b86c4de00d239bc81f5a1", + "5911a5b980d7900aabdbee483f86dab7056851e6400efb002776a0a4a1bab6f6", + "a177edc9d8c9f82e8c19d0630ab351f3fd1b201d655a1ddb5d51c4cee197b26a", + "3d9885e692e1998523fd5c61f558cecd2aafd67a07bd3bfe1d7ad5a31777a116", + "758e2ec65a0c214cfe6161f5cde3c5af4377c67d820ea01d13de3ca165f67b4c", + "e0013d907f3a9e6482cc0934de1bd82ee3c3c4fd07a9646aa9899af237544dd7", + "6c8adf8ed4a2ca629f7fd11301ed6293a6248c9da0c674f86217df715efccbd3", + "1ea434957d6ec3a7b61763f1f3552dad0ebdd6754d65888b5cd6d80db3a788a8", + "4a865aa80975c4c53212fe632508150b5414d9c50bd662dad13e9692d34290f4"], + #:prepare, fn() { + for-each(fn(file) { + run("patch", "--batch", "-d", "readline-8.2", "-p0", "-i", string-append("../", file)) + }, list("fix-ncurses-underlinking.patch", + "fix-rl_do_undo-crash.patch", + "readline82-001.patch", + "readline82-002.patch", + "readline82-003.patch", + "readline82-004.patch", + "readline82-005.patch", + "readline82-006.patch", + "readline82-007.patch", + "readline82-008.patch", + "readline82-009.patch", + "readline82-010.patch", + "readline82-011.patch", + "readline82-012.patch", + "readline82-013.patch")) + }, + #:build, fn() { + run("vinix-configure", "readline-8.2/configure", "--enable-static", "--enable-shared") + run("make") + }, + #:package, fn() { + run("make", "install", string-append("DESTDIR=", pkgdir())) + run("rm", "-f", string-append(pkgdir(), "/usr/share/info/dir")) + run("install", "-Dm644", "inputrc", string-append(pkgdir(), "/etc/inputrc")) + run("vinix-cc", string-append("-I", pkgdir(), "/usr/include"), "check-history.c", + string-append("-L", pkgdir(), "/usr/lib"), "-lreadline", "-o", "check-history") + run("vinix-run", "--library-path", string-append(pkgdir(), "/usr/lib"), "./check-history") + run("install", "-Dm644", "readline-8.2/COPYING", string-append(pkgdir(), "/usr/share/licenses/readline/COPYING")) + }) diff --git a/readline/check-history.c b/readline/check-history.c new file mode 100644 index 0000000..3fce9cf --- /dev/null +++ b/readline/check-history.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include +#include + +int main(void) { + using_history(); + add_history("Vinix history"); + HIST_ENTRY *entry = history_get(history_base); + int valid = rl_readline_version == RL_READLINE_VERSION && entry && + strcmp(entry->line, "Vinix history") == 0; + clear_history(); + return valid ? EXIT_SUCCESS : EXIT_FAILURE; +} -- 2.56.1