Package libedit and libbsd for native network and X clients
@@ -0,0 +1,27 @@
1+defpkgbuild(libbsd,
2+ #:pkgname, "libbsd",
3+ #:pkgver, "0.12.2",
4+ #:pkgrel, 2,
5+ #:pkgdesc, "BSD library functions and development headers",
6+ #:arch, [#:x86-64, #:aarch64],
7+ #:url, "https://libbsd.freedesktop.org/",
8+ ; Upstream COPYING itemizes the BSD variants and additional notices by file.
9+ #:license, ["BSD-2-Clause", "BSD-3-Clause", "Beerware", "ISC", "MIT", "LicenseRef-libbsd-COPYING"],
10+ #:depends, ["musl", "libmd", "bsd-compat-headers"],
11+ #:makedepends, ["linux-headers"],
12+ #:source, ["https://libbsd.freedesktop.org/releases/libbsd-0.12.2.tar.xz"],
13+ #:sha256sums, ["b88cc9163d0c652aaf39a99991d974ddba1c3a9711db8f1b5838af2a14731014"],
14+ #:build, fn() {
15+ run("vinix-configure", "libbsd-0.12.2/configure")
16+ run("make")
17+ },
18+ #:check, fn() {
19+ run("make", "-C", "test", "endian", "overlay")
20+ run("vinix-run", "--library-path", "src/.libs", "test/.libs/endian")
21+ run("vinix-run", "--library-path", "src/.libs", "test/.libs/overlay")
22+ },
23+ #:package, fn() {
24+ run("make", "install", string-append("DESTDIR=", pkgdir()))
25+ run("find", pkgdir(), "-name", "*.la", "-delete")
26+ run("install", "-Dm644", "libbsd-0.12.2/COPYING", string-append(pkgdir(), "/usr/share/licenses/libbsd/COPYING"))
27+ })
@@ -0,0 +1,28 @@
1+defpkgbuild(libedit,
2+ #:pkgname, "libedit",
3+ #:pkgver, "20240808.3.1",
4+ #:pkgrel, 1,
5+ #:pkgdesc, "NetBSD command-line editing and history library",
6+ #:arch, [#:x86-64, #:aarch64],
7+ #:url, "https://www.thrysoee.dk/editline/",
8+ #:license, "BSD-3-Clause",
9+ #:depends, ["musl", "ncurses"],
10+ #:source, ["https://www.thrysoee.dk/editline/libedit-20240808-3.1.tar.gz", "history.c", "wchar.c"],
11+ #:sha256sums, ["5f0573349d77c4a48967191cdd6634dd7aa5f6398c6a57fe037cc02696d6099f", "a0fdb40f4681d9c4ff14e576c99eaf2c45d98c2e9869e91a9f3b992bc3ab3f3f",
12+ "1ab07b1d432adad891ffe252bd62459ef05f4453fa1984fd46292eab7eb39a1b"],
13+ #:build, fn() {
14+ run("vinix-cc", "wchar.c", "-o", "check-wchar")
15+ run("vinix-run", "./check-wchar")
16+ run("env", "CPPFLAGS=-D__STDC_ISO_10646__=201103L", "vinix-configure", "libedit-20240808-3.1/configure")
17+ run("make")
18+ },
19+ #:check, fn() {
20+ run("make", "install", string-append("DESTDIR=", srcdir(), "/checked"))
21+ run("vinix-cc", "history.c", "-Ichecked/usr/include", "-Lchecked/usr/lib", "-o", "history-check", "-ledit")
22+ run("vinix-run", "--library-path", "checked/usr/lib", "./history-check")
23+ },
24+ #:package, fn() {
25+ run("make", "install", string-append("DESTDIR=", pkgdir()))
26+ run("find", pkgdir(), "-name", "*.la", "-delete")
27+ run("install", "-Dm644", "libedit-20240808-3.1/COPYING", string-append(pkgdir(), "/usr/share/licenses/libedit/COPYING"))
28+ })
@@ -0,0 +1,16 @@
1+#include <histedit.h>
2+#include <string.h>
3+
4+int main(void) {
5+ HistEvent event;
6+ History *history_state = history_init();
7+ if (!history_state)
8+ return 1;
9+ if (history(history_state, &event, H_SETSIZE, 4) < 0 ||
10+ history(history_state, &event, H_ENTER, "vinix") < 0 ||
11+ history(history_state, &event, H_FIRST) < 0 ||
12+ strcmp(event.str, "vinix") != 0)
13+ return 1;
14+ history_end(history_state);
15+ return 0;
16+}
@@ -0,0 +1,13 @@
1+#include <locale.h>
2+#include <stdint.h>
3+#include <stdlib.h>
4+#include <wchar.h>
5+
6+int main(void) {
7+ if (!setlocale(LC_CTYPE, "C.UTF-8") || sizeof(wchar_t) != 4 || WCHAR_MAX < INT32_MAX)
8+ return EXIT_FAILURE;
9+ wchar_t wc;
10+ mbstate_t state = {0};
11+ return mbrtowc(&wc, "\xf0\x9f\x8c\x8d", 4, &state) == 4 && wc == 0x1f30d
12+ ? EXIT_SUCCESS : EXIT_FAILURE;
13+}