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

303.5. netsurf-3.11

Web browser with its own layout engine, on GTK 3

Version 3.11, release 1
Shelf browsers — Web, Gemini and text-mode browsers
Phase 44_apps (Applications), 16 of 422 in build order
Licence GPL-2.0-only
Homepage https://www.netsurf-browser.org/
Build time 1.1 SBU
Installed size 4.9 MiB in 56 files
Recipe ports/core/browsers/netsurf/kpkgbuild

About

NetSurf is a small web browser with its own layout engine, built for slow machines. Its parts are libraries of the NetSurf project, each a port of its own: libhubbub parses HTML, libcss parses and selects CSS, libdom holds the document, and libnsbmp, libnsgif and libsvgtiny decode images. JavaScript runs on the copy of Duktape in its source. This port builds the GTK 3 front end, netsurf-gtk3.

Sources

Dependencies

Depends on: nsgenbind, perl, pkgconf, gtk3, glib, curl, openssl, zlib, libjpeg-turbo, libpng, libwebp, libjxl, librsvg, utf8proc, libwapcaplet, libparserutils, libhubbub, libdom, libcss, libnsbmp, libnsgif, libnsutils, libnspsl, libnslog, libsvgtiny, imagemagick.

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 netsurf'

What kpkg does

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

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/netsurf
echo 'c28a626aefee428d053b13f88b5c440922245976522d12eaf137cfd32d201cb2  netsurf-3.11.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/netsurf
SRC=$SRC_ROOT/netsurf-3.11
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf netsurf-3.11.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:

mkdir -p "$SRC_ROOT/shim/libutf8proc"
ln -sf /usr/include/utf8proc.h "$SRC_ROOT/shim/libutf8proc/utf8proc.h"

export CFLAGS="$CFLAGS -fcommon -g0 -I$SRC_ROOT/shim"

_opts=(
	TARGET=gtk3 PREFIX=/usr LIBDIR=lib INCLUDEDIR=include
	NETSURF_USE_CURL=YES NETSURF_USE_OPENSSL=YES
	NETSURF_USE_UTF8PROC=YES NETSURF_USE_DUKTAPE=YES
	NETSURF_USE_JPEG=YES NETSURF_USE_PNG=YES NETSURF_USE_WEBP=YES
	NETSURF_USE_JPEGXL=YES NETSURF_USE_BMP=YES NETSURF_USE_GIF=YES
	NETSURF_USE_RSVG=YES NETSURF_USE_NSSVG=YES
	NETSURF_USE_NSPSL=YES NETSURF_USE_NSLOG=YES
	NETSURF_USE_ROSPRITE=NO NETSURF_USE_HARU_PDF=NO NETSURF_USE_VIDEO=NO
	NETSURF_USE_GRESOURCE=YES
	GTK_TRANSLATIONS_HTML=en
)
make "${_opts[@]}"
make "${_opts[@]}" DESTDIR=$PKG install
install -Dm644 docs/netsurf-gtk.1 "$PKG/usr/share/man/man1/netsurf-gtk3.1"

install -d "$PKG/usr/share/icons/hicolor/128x128/apps"
magick frontends/gtk/res/netsurf.xpm -background none -gravity center \
	-extent 136x136 -resize 128x128 \
	"$PKG/usr/share/icons/hicolor/128x128/apps/netsurf.png"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/netsurf.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=NetSurf
GenericName=Web Browser
Comment=A small, fast web browser for slow machines
Exec=netsurf-gtk3 %u
Icon=netsurf
Terminal=false
StartupWMClass=netsurf-gtk3
Categories=Network;WebBrowser;
Keywords=web;browser;internet;www;http;light;
DESKTOP
chmod 644 "$PKG/usr/share/applications/netsurf.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/netsurf, 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 netsurf-3.11-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/netsurf, and runs the triggers its paths call for.

Contents

Installed programs: netsurf-gtk3.

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

Short descriptions

netsurf-gtk3 a small fast web browser

Notes

Upstream’s -src tarball contains the browser alone; each NetSurf library in depends is built from its own port first, and the browser finds them through pkg-config.

make install installs the binary as netsurf-gtk3 and its resources under /usr/share/netsurf/, but no manual page, icon or desktop entry. build.sh installs docs/netsurf-gtk.1 under the binary’s name, netsurf-gtk3.1, and makes a 128-pixel hicolor icon from frontends/gtk/res/netsurf.xpm. That picture is 132 by 135 pixels; it is first centred on a transparent 136-pixel square, so the scaled icon keeps its proportions. The desktop entry is written last.