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
netsurf-3.11.tar.gz(4.1 MiB)
sha256c28a626aefee428d053b13f88b5c440922245976522d12eaf137cfd32d201cb2
upstream: https://download.netsurf-browser.org/netsurf/releases/source/netsurf-3.11-src.tar.gz
archive copy: sources-1/browsers--netsurf-3.11.tar.gz
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:
-fcommon— Added toCFLAGS. Places a global variable defined without an initialiser in a common block, so the same definition in more than one file is merged into one symbol at link time. The compiler’s default,-fno-common, makes that a multiple-definition link error.-g0— Added toCFLAGS. NetSurf’s GTK makefile puts-gin its own flags, and it places the environment’sCFLAGSafter its own on every compile line, so-g0cancels it and the binary carries no debugging information.-I$SRC_ROOT/shim—utils/idna.cincludes<libutf8proc/utf8proc.h>, and utf8proc installs its header as/usr/include/utf8proc.h.build.shmakes$SRC_ROOT/shim/libutf8proc/utf8proc.ha link to the real header and puts the shim directory on the include path.TARGET=gtk3— Build the GTK front end against GTK 3. It is also what an emptyTARGETbuilds; named, the build does not rest on that default.LIBDIR=lib,INCLUDEDIR=include— The install directories the NetSurf libraries’ makefiles read. The browser’s own makefiles read neither, so they change nothing here.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_GRESOURCE=YES— Fetching through curl with OpenSSL certificates, internationalised domain names through utf8proc, JavaScript, the image formats, SVG through both librsvg and libsvgtiny, the public suffix list through libnspsl, filtered logging through libnslog, and the interface’s resources compiled in as a GResource. Many of these default toAUTO, which enables the feature only when pkg-config finds its library;YESstops the build with “Unable to find library” instead.NETSURF_USE_ROSPRITE=NO— No RISC OS sprite images; librosprite is not a port.NETSURF_USE_HARU_PDF=NO— No PDF export through libharu; upstream’s default. The switch has noAUTOdetection, andYESlinks-lhpdfdirectly, which would need libharu independs.NETSURF_USE_VIDEO=NO— No video; upstream’s default. The GTK front end looks forgstreamer-0.10, and the tree’s gstreamer is not that series.GTK_TRANSLATIONS_HTML=en— Install the English resource tree only. The default list installs German, French, Italian, Japanese, Dutch and Chinese pages and messages as well. The system is English only (see size and language policy), and these trees hold plainMessagesfiles and HTML pages rather than message catalogues, so kpkg’s prune would leave them in the package.
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.