From e65dcbb790568be66615c568fd2ca4ff9daf18de Mon Sep 17 00:00:00 2001 From: huntedbytheirs Date: Tue, 18 Aug 2026 02:10:54 -0400 Subject: [PATCH] vimium --- stable/index.kap | 4 +++- stable/links.kap | 42 ++++++++++++++++++++++++++++++++++++++++++ stable/ncurses.kap | 15 ++++++++------- stable/tcc.kap | 41 +++++++++++++++++++++++++---------------- stable/vim.kap | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+), 24 deletions(-) create mode 100644 stable/links.kap create mode 100644 stable/vim.kap diff --git a/stable/index.kap b/stable/index.kap index ee29a25..84bfce6 100644 --- a/stable/index.kap +++ b/stable/index.kap @@ -13,7 +13,7 @@ index "local" { ninja { version = "1.13.2" } meson { version = "1.12.0" } openrc { version = "0.63.3" } - tcc { version = "0.9.27" } + tcc { version = "0.9.28rc" } musl { version = "1.2.6" } perl { version = "5.42.3" } cmake { version = "4.4.1" } @@ -24,4 +24,6 @@ index "local" { bash { version = "5.3" } ncurses { version = "6.6" } readline { version = "8.3" } + vim { version = "9.2.0967" } + links { version = "2.30" } } diff --git a/stable/links.kap b/stable/links.kap new file mode 100644 index 0000000..a571fbb --- /dev/null +++ b/stable/links.kap @@ -0,0 +1,42 @@ +/* + * links — the text-mode web browser. + * + * Two modern-compiler fixes (verified): + * - ftp.c: const-correct strchr (clang 16+) rejects assigning through + * the const result; sed casts the operand to char*. + * - CFLAGS=-std=gnu17 keeps pre-C23 strchr semantics everywhere else. + * + * Optional deps (openssl/libevent/libjpeg/libpng/libtiff) disabled — + * http-only until an openssl package exists. Terminfo from store ncurses. + */ +package "links" { + const version = "2.30" + const source = "https://fossies.org/linux/www/links-${version}.tar.gz" + sha256 = "19bea8eaff960314cd9583749accc78ef22277581783fbfab8130c9dff077095" + license = "GPL-2.0-or-later" + + provides = ["links"] + + depends = [ + { name = "ncurses" }, + { name = "make" }, + ] + + prepare { + curl -L -o links-${version}.tar.gz ${source} + echo "19bea8eaff960314cd9583749accc78ef22277581783fbfab8130c9dff077095 links-${version}.tar.gz" | sha256sum -c - + tar xf links-${version}.tar.gz --strip-components=1 + ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ -d $ROOT/temp/ncurses/destdir/usr ]; then echo $ROOT/temp/ncurses/destdir/usr; else echo $ROOT/bin/$(grep '^ncurses ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > ncurses.path + } + + build { + // note: no "= 0" in the pattern — the DSL strips spaces before '='. + sed -i 's/strchr(cast_const_char ud, POST_CHAR)/strchr((char *)ud, POST_CHAR)/g' ftp.c + CFLAGS=-std=gnu17 CPPFLAGS=-I$(cat ncurses.path)/include LDFLAGS=-L$(cat ncurses.path)/lib ./configure --prefix=${prefix} --without-ssl --without-libevent --without-libjpeg --without-libpng --without-libtiff + make -j${jobs} + } + + install { + make DESTDIR=${destdir} install + } +} diff --git a/stable/ncurses.kap b/stable/ncurses.kap index 308da43..a3c6ab7 100644 --- a/stable/ncurses.kap +++ b/stable/ncurses.kap @@ -1,11 +1,12 @@ /* * ncurses — terminal handling library + terminfo database. * - * Built wide-char (ncurses 6.x default) with --with-termlib so the - * terminal-capability code is split into libtinfow. The narrow names - * (libncurses, libtinfo, ...) are symlinked to the wide libs — the - * standard distro arrangement — so consumers linking -lncurses/-ltinfo - * resolve to the wide implementations (symbols are compatible). + * Wide-char default (ncurses 6.x). Deliberately WITHOUT --with-termlib: + * keeping the termcap functions (tgetent & co) inside libncursesw lets + * consumers link just -lncurses (vim does exactly this). The narrow + * names (libncurses, libtinfo, ...) are symlinked to the wide lib — the + * standard distro arrangement — so -ltinfo consumers (readline) resolve + * to the same archive (symbols are compatible). */ package "ncurses" { const version = "6.6" @@ -26,14 +27,14 @@ package "ncurses" { } build { - ./configure --prefix=${prefix} --with-termlib + ./configure --prefix=${prefix} make -j${jobs} } install { make DESTDIR=${destdir} install ln -sf libncursesw.a ${destdir}/usr/lib/libncurses.a - ln -sf libtinfow.a ${destdir}/usr/lib/libtinfo.a + ln -sf libncursesw.a ${destdir}/usr/lib/libtinfo.a ln -sf libpanelw.a ${destdir}/usr/lib/libpanel.a ln -sf libmenuw.a ${destdir}/usr/lib/libmenu.a ln -sf libformw.a ${destdir}/usr/lib/libform.a diff --git a/stable/tcc.kap b/stable/tcc.kap index 5118692..c7eb1e1 100644 --- a/stable/tcc.kap +++ b/stable/tcc.kap @@ -1,18 +1,20 @@ /* * tcc — Tiny C Compiler. The fast, tiny, self-hosting C compiler. * - * Built with the stable 0.9.27 release plus the glibc-2.34 patch - * (bcheck.c's __malloc_hook was removed from glibc; the bounds checker - * is disabled on glibc >= 2.34, where the API no longer exists). - * The patch lives in the repo: patches/tcc-0.9.27-glibc-2.34.patch. + * Built from the MOB branch (0.9.28rc, commit d9d02c56 — the same + * snapshot Alpine ships): the 0.9.27 release segfaults when compiling on + * modern glibc/kernel (verified — even hello world crashed), while mob + * carries the codegen and glibc-2.34 fixes (__malloc_hook is already + * handled, so no patch is needed). Pinned commit = reproducible. + * Hosted on Alpine's stable archive (dev.alpinelinux.org). * - * The check phase verifies self-hosting: tcc compiles its own compiler - * and the result runs. + * The check phase proves self-hosting: tcc compiles its own compiler + * (-B. points at the uninstalled include dir) and the result runs. */ package "tcc" { - const version = "0.9.27" - const source = "https://download.savannah.nongnu.org/releases/tinycc/tcc-${version}.tar.bz2" - sha256 = "de23af78fca90ce32dff2dd45b3432b2334740bb9bb7b05bf60fdbfc396ceb9c" + const version = "0.9.28rc" + const source = "https://dev.alpinelinux.org/archive/tcc/tcc-d9d02c56401e43be43760b63f7d82f771a7ed1f6.tar.gz" + sha256 = "b25f68a46930549553f6d679106d99d5a00b4d8f39a178baaeae6a50018e37ae" license = "LGPL-2.1-or-later" provides = ["tcc", "cc"] @@ -22,12 +24,9 @@ package "tcc" { ] prepare { - curl -L -O ${source} - echo "de23af78fca90ce32dff2dd45b3432b2334740bb9bb7b05bf60fdbfc396ceb9c tcc-${version}.tar.bz2" | sha256sum -c - - tar xf tcc-${version}.tar.bz2 --strip-components=1 - curl -L -O https://files.spectoria.dev/kappa-packages/patches/tcc-0.9.27-glibc-2.34.patch - echo "d5c2b6865cd4f80c646ffc85a0fe53e15e3a1877e0a8d29556d01742e5094d6e tcc-0.9.27-glibc-2.34.patch" | sha256sum -c - - patch -p1 < tcc-0.9.27-glibc-2.34.patch + curl -L -o tcc-${version}.tar.gz ${source} + echo "b25f68a46930549553f6d679106d99d5a00b4d8f39a178baaeae6a50018e37ae tcc-${version}.tar.gz" | sha256sum -c - + tar xf tcc-${version}.tar.gz --strip-components=1 } build { @@ -36,11 +35,21 @@ package "tcc" { } check { - ./tcc -o tcc-selfhost tcc.c -I. -DONE_SOURCE -lm -ldl + ./tcc -B. -o tcc-selfhost tcc.c -I. -DONE_SOURCE -lm -ldl ./tcc-selfhost -v } + // The store is not a standard /usr tree, but tcc bakes absolute paths + // (configure --prefix). A tiny wrapper injects -B/../lib/tcc so + // the plain `tcc` invocation finds its includes and runtime from any + // store location. $@ is deliberately unquoted (word-split; tcc args + // are paths/flags). install { make DESTDIR=${destdir} install + mv ${destdir}/usr/bin/tcc ${destdir}/usr/bin/tcc.real + echo '#!/bin/sh' > ${destdir}/usr/bin/tcc + echo 'DIR=$(dirname $(readlink -f $0))' >> ${destdir}/usr/bin/tcc + echo 'exec $DIR/tcc.real -B$DIR/../lib/tcc $@' >> ${destdir}/usr/bin/tcc + chmod 755 ${destdir}/usr/bin/tcc } } diff --git a/stable/vim.kap b/stable/vim.kap new file mode 100644 index 0000000..877a981 --- /dev/null +++ b/stable/vim.kap @@ -0,0 +1,36 @@ +/* + * vim — the editor. + * + * Links the store ncurses for the terminal UI (--with-tlib=ncurses). + * The GitHub archive URL needs the explicit -o name (basename would be + * the tag). The sh/vi symlinks are distro-managed. + */ +package "vim" { + const version = "9.2.0967" + const source = "https://github.com/vim/vim/archive/refs/tags/v${version}.tar.gz" + sha256 = "12873dde4981e771c51f20a5afba96f5982f4b022cbea1beb392924a0a4de0f7" + license = "Vim" + + provides = ["vim"] + + depends = [ + { name = "ncurses" }, + { name = "make" }, + ] + + prepare { + curl -L -o vim-${version}.tar.gz ${source} + echo "12873dde4981e771c51f20a5afba96f5982f4b022cbea1beb392924a0a4de0f7 vim-${version}.tar.gz" | sha256sum -c - + tar xf vim-${version}.tar.gz --strip-components=1 + ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ -d $ROOT/temp/ncurses/destdir/usr ]; then echo $ROOT/temp/ncurses/destdir/usr; else echo $ROOT/bin/$(grep '^ncurses ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > ncurses.path + } + + build { + CPPFLAGS=-I$(cat ncurses.path)/include LDFLAGS=-L$(cat ncurses.path)/lib ./configure --prefix=${prefix} --with-tlib=ncurses + make -j${jobs} + } + + install { + make DESTDIR=${destdir} install + } +}