Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

303.2. lagrange-1.21.1

Gemini, Gopher, Spartan and Finger browser, with a terminal build (clagrange) beside the SDL one

Version 1.21.1, release 1
Shelf browsers — Web, Gemini and text-mode browsers
Phase 44_apps (Applications), 13 of 422 in build order
Licence BSD-2-Clause
Homepage https://gmi.skyjake.fi/lagrange/
Build time 1.1 SBU
Installed size 7.6 MiB in 10 files
Recipe ports/core/browsers/lagrange/kpkgbuild

About

Lagrange is a browser for the small internet: Gemini, Gopher, Finger, Spartan and Nex. It draws its own interface through SDL and does its own text layout. The package installs two programs built from the one source, lagrange, the windowed browser, and clagrange, the same browser in a terminal on ncurses. Lagrange builds its own utility library, the_Foundation, and the terminal build’s curses layer, sealcurses, from copies under lib/.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, zip, sdl2-compat, openssl, zlib, pcre2, libunistring, harfbuzz, fribidi, mpg123, libwebp, libjxl, opusfile, ncurses.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install lagrange'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/browsers/lagrange.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/browsers/lagrange
echo '49389240e34fb9e79cebb9566af24723ae15f9ba2ca8e8933ffdd5c3e034953c  lagrange-1.21.1.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/lagrange
SRC=$SRC_ROOT/lagrange-1.21.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lagrange-1.21.1.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

cmake -S . -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DENABLE_GUI=ON \
	-DENABLE_TUI=ON \
	-DENABLE_X11_XLIB=OFF \
	-DENABLE_POPUP_MENUS=OFF \
	-DENABLE_RESIZE_DRAW=OFF \
	-DENABLE_FRIBIDI=ON \
	-DENABLE_FRIBIDI_BUILD=OFF \
	-DENABLE_HARFBUZZ=ON \
	-DENABLE_HARFBUZZ_MINIMAL=OFF \
	-DENABLE_MPG123=ON \
	-DENABLE_OPUS=ON \
	-DENABLE_WEBP=ON \
	-DENABLE_JXL=ON \
	-DENABLE_STATIC=OFF \
	-DTFDN_ENABLE_WARN_ERROR=OFF \
	-DTFDN_ENABLE_SSE41=OFF
cmake --build build
DESTDIR=$PKG cmake --install build

cat > "$PKG/usr/share/applications/fi.skyjake.clagrange.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Lagrange (terminal)
GenericName=Gemini Client
Comment=Browse Gemini, Gopher and Finger in a terminal
Exec=clagrange
Icon=fi.skyjake.clagrange
Terminal=true
Categories=Network;WebBrowser;
Keywords=gemini;gopher;finger;spartan;smolweb;browser;
DESKTOP
chmod 644 "$PKG/usr/share/applications/fi.skyjake.clagrange.desktop"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/lagrange, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf lagrange-1.21.1-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/lagrange, and runs the triggers its paths call for.

Contents

Installed programs: clagrange, lagrange.

Installed directories: /usr/share/lagrange, /usr/share/licenses/lagrange.

Short descriptions

lagrange a beautiful Gemini client

Notes

zip is in depends because the build packs the interface’s fonts, translations and help pages into /usr/share/lagrange/resources.lgr, which is a zip archive; configure stops without it.

Upstream writes a desktop entry for clagrange named plain clagrange, with an absolute Exec path and the same URL-scheme MimeType= list as the windowed browser’s. build.sh writes over it: the name is Lagrange (terminal), so the menu does not show two rows a person cannot tell apart, Exec is bare, and there is no MimeType=, so gemini: and the other schemes open in the windowed browser alone (see desktop entries).