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
lagrange-1.21.1.tar.gz(11.8 MiB)
sha25649389240e34fb9e79cebb9566af24723ae15f9ba2ca8e8933ffdd5c3e034953c
upstream: https://github.com/skyjake/lagrange/releases/download/v1.21.1/lagrange-1.21.1.tar.gz
archive copy: sources-1/browsers--lagrange-1.21.1.tar.gz
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:
-DENABLE_GUI=ON,-DENABLE_TUI=ON— Build both programs. The terminal one is off by default upstream.-DENABLE_X11_XLIB=OFF— Compile none ofsrc/platform/x11.c, which calls Xlib directly when the window is on X11 (the_NET_WM_DESKTOPworkspace hints and the_GTK_THEME_VARIANTdark title bar). SDL puts the window on Wayland here, and with this off the program links no libX11 of its own.-DENABLE_POPUP_MENUS=OFF— Draw context menus inside the main window rather than opening each as a separate popup window, which upstream does by default.-DENABLE_RESIZE_DRAW=OFF— Do not force a redraw of the window during a resize; on by default everywhere but Haiku and Android.-DENABLE_FRIBIDI=ON,-DENABLE_FRIBIDI_BUILD=OFF,-DENABLE_HARFBUZZ=ON,-DENABLE_HARFBUZZ_MINIMAL=OFF— Shape text with HarfBuzz and lay out bidirectional text with FriBidi, both the system’s (harfbuzz, fribidi) through pkg-config rather than the copies underlib/that the_BUILDand_MINIMALswitches would compile. All four values are upstream’s defaults.-DENABLE_MPG123=ON,-DENABLE_OPUS=ON,-DENABLE_WEBP=ON,-DENABLE_JXL=ON— Play MPEG and Opus audio and show WebP and JPEG XL images, through mpg123, opusfile, libwebp and libjxl. Each is on by default and quietly left out when its library is not found; naming it does not change that, so it is the library being independsthat puts each one in.-DENABLE_STATIC=OFF— Link the dependencies shared; upstream’s default.-DTFDN_ENABLE_WARN_ERROR=OFF— the_Foundation compiles with-Werrorby default, so a warning the tree’s compiler raises would stop the build.-DTFDN_ENABLE_SSE41=OFF— the_Foundation’s default is whether the build machine has SSE 4.1, and on adds-msse4.1to its compile lines, so the package would need that instruction set wherever it ran. KDOS ships no feature level above baseline x86-64 (see-marchmeasured per machine).
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).