ncurses: build wide terminal libraries and the terminfo database
@@ -0,0 +1,47 @@
1+; Alpine 3.21 source snapshot. The host tic builds architecture-independent
2+; terminfo while the staged musl toolchain builds the guest executables.
3+defpkgbuild(ncurses,
4+ #:pkgname, "ncurses",
5+ #:pkgver, "6.5_p20241006",
6+ #:pkgrel, 1,
7+ #:pkgdesc, "Wide-character terminal libraries, tools and terminfo database",
8+ #:arch, [#:x86-64],
9+ #:license, "X11",
10+ #:url, "https://invisible-island.net/ncurses/",
11+ #:depends, ["musl"],
12+ #:source, ["https://distfiles.alpinelinux.org/distfiles/v3.21/ncurses-6.5-20241006.tgz"],
13+ #:sha256sums, ["fefd7f516ba7a236239d3213f698fa9736c394bece176671411e94dac83eadfd"],
14+ #:build, fn() {
15+ root := get-environment-variable("VINIX_SYSROOT")
16+ run("test", "-f", string-append(root, "/usr/lib/musl-gcc-sysroot.specs"))
17+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH",
18+ "PKG_CONFIG_PATH=", string-append("PKG_CONFIG_SYSROOT_DIR=", root),
19+ string-append("PKG_CONFIG_LIBDIR=", root, "/usr/lib/pkgconfig"),
20+ string-append("CC=gcc --sysroot=", root, " -specs=", root, "/usr/lib/musl-gcc-sysroot.specs"),
21+ "CFLAGS=-O2 -D_GNU_SOURCE", "ncurses-6.5-20241006/configure",
22+ "--build=x86_64-pc-linux-gnu", "--host=x86_64-linux-musl", "--prefix=/usr",
23+ "--mandir=/usr/share/man", "--without-ada", "--without-tests", "--without-cxx-binding",
24+ "--without-cxx", "--without-debug", "--disable-termcap", "--disable-root-access",
25+ "--disable-rpath-hack", "--disable-setuid-environ", "--with-build-cc=gcc",
26+ "--with-tic-path=/usr/bin/tic", "--with-shared", "--enable-widec", "--enable-overwrite",
27+ "--with-pkg-config-libdir=/usr/lib/pkgconfig", "--enable-pc-files", "--enable-symlinks",
28+ "--with-terminfo-dirs=/etc/terminfo:/usr/share/terminfo:/lib/terminfo:/usr/lib/terminfo")
29+ run("env", "-u", "CPATH", "-u", "C_INCLUDE_PATH", "-u", "LIBRARY_PATH", "make")
30+ },
31+ #:package, fn() {
32+ run("make", "-j1", string-append("DESTDIR=", pkgdir()), "install")
33+ lib := string-append(pkgdir(), "/usr/lib/")
34+ pc := string-append(lib, "pkgconfig/")
35+ for-each(fn(name) {
36+ run("ln", "-sf", string-append("lib", name, "w.so"), string-append(lib, "lib", name, ".so"))
37+ run("ln", "-sf", string-append("lib", name, "w.a"), string-append(lib, "lib", name, ".a"))
38+ run("ln", "-sf", string-append(name, "w.pc"), string-append(pc, name, ".pc"))
39+ }, list("ncurses", "panel", "menu", "form"))
40+ for-each(fn(name) {
41+ run("ln", "-sf", "libncursesw.so", string-append(lib, "lib", name, ".so"))
42+ run("ln", "-sf", "libncursesw.a", string-append(lib, "lib", name, ".a"))
43+ run("ln", "-sf", "ncursesw.pc", string-append(pc, name, ".pc"))
44+ }, list("curses", "tic", "tinfo"))
45+ run("test", "-s", string-append(pkgdir(), "/usr/share/terminfo/x/xterm-256color"))
46+ run("install", "-Dm644", "ncurses-6.5-20241006/COPYING", string-append(pkgdir(), "/usr/share/licenses/ncurses/COPYING"))
47+ })