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

259.3. fltk-1.4.5

The Fast Light Toolkit — a small C++ GUI library, Wayland first with an X11 fallback, and FLUID

Version 1.4.5, release 1
Shelf toolkits — Other GUI and TUI toolkits for applications
Phase 43_toolkits (Toolkits), 329 of 344 in build order
Licence LGPL-2.0-only WITH FLTK-exception
Homepage https://www.fltk.org/
Build time 1.2 SBU
Installed size 14.1 MiB in 212 files
Recipe ports/core/toolkits/fltk/kpkgbuild

About

FLTK, the Fast Light Toolkit, is a small C++ GUI library, with FLUID, its interface designer, which writes the C++ code for a window laid out in it, and fltk-options, which sets FLTK’s system and user options. In KDOS it draws fldigi, flrig and Gmsh, among others. It is built as one hybrid library: a program uses Wayland when a Wayland display is reachable and X11 otherwise, and FLTK_BACKEND=x11 in the environment sends it to Xwayland.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, wayland, wayland-protocols, libxkbcommon, libdecor, dbus, cairo, pango, glib, fontconfig, freetype2, libX11, libXext, libXft, libXrender, libXfixes, libXcursor, libXinerama, libglvnd, mesa, glu, libjpeg-turbo, libpng, zlib.

Required by (6): flamp, fldigi, flmsg, flrig, gmsh, lmms.

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/43_toolkits/phase.env && kpkg install fltk'

What kpkg does

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

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

CFLAGS= CXXFLAGS= cmake -B build -G Ninja \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_C_FLAGS_RELEASE="$CFLAGS -O3 -DNDEBUG" \
	-DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS -O3 -DNDEBUG" \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DFLTK_BUILD_SHARED_LIBS=ON \
	-DFLTK_BACKEND_WAYLAND=ON \
	-DFLTK_BACKEND_X11=ON \
	-DFLTK_USE_SYSTEM_LIBDECOR=ON \
	-DFLTK_USE_DBUS=ON \
	-DFLTK_USE_SYSTEM_LIBJPEG=ON \
	-DFLTK_USE_SYSTEM_LIBPNG=ON \
	-DFLTK_USE_SYSTEM_ZLIB=ON \
	-DFLTK_USE_PTHREADS=ON \
	-DFLTK_BUILD_GL=ON \
	-DFLTK_OPTION_SVG=ON \
	-DFLTK_OPTION_PRINT_SUPPORT=ON \
	-DFLTK_OPTION_FILESYSTEM_SUPPORT=ON \
	-DFLTK_OPTION_LARGE_FILE=ON \
	-DFLTK_OPTION_CAIRO_WINDOW=ON \
	-DFLTK_OPTION_CAIRO_EXT=ON \
	-DFLTK_BUILD_FORMS=ON \
	-DFLTK_BUILD_FLUID=ON \
	-DFLTK_BUILD_FLTK_OPTIONS=ON \
	-DFLTK_BUILD_TEST=OFF \
	-DFLTK_BUILD_EXAMPLES=OFF \
	-DFLTK_BUILD_HTML_DOCS=OFF \
	-DFLTK_BUILD_PDF_DOCS=OFF \
	-DFLTK_BUILD_FLUID_DOCS=OFF
ninja -C build
DESTDIR=$PKG ninja -C build install

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/fluid.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=FLUID
GenericName=GUI Designer
Comment=Design FLTK user interfaces and generate their C++ code
TryExec=fluid
Exec=fluid %F
Icon=fluid
Terminal=false
StartupWMClass=fluid
MimeType=application/x-fluid;
Categories=Development;GUIDesigner;
Keywords=fltk;gui;designer;interface;fluid;
EOF
cat > "$PKG/usr/share/applications/fltk-options.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=FLTK Options
GenericName=Toolkit Settings
Comment=System and user options for FLTK programs
TryExec=fltk-options
Exec=fltk-options %F
Icon=fltk-options
Terminal=false
StartupWMClass=fltk-options
MimeType=application/x-fltk-options;
Categories=Development;Settings;
Keywords=fltk;options;settings;toolkit;
EOF
chmod 644 "$PKG/usr/share/applications/fluid.desktop" \
	"$PKG/usr/share/applications/fltk-options.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/fltk, 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 fltk-1.4.5-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/fltk, and runs the triggers its paths call for.

Contents

Installed programs: fltk-config, fltk-options, fltk-options-shared, fluid, fluid-shared.

Installed libraries: libfltk.a, libfltk.so, libfltk_cairo.a, libfltk_cairo.so, libfltk_forms.a, libfltk_forms.so, libfltk_gl.a, libfltk_gl.so, libfltk_images.a, libfltk_images.so.

Installed directories: /usr/include/FL, /usr/share/fltk, /usr/share/licenses/fltk.

Short descriptions

fltk-config script to get information about the installed version of fltk.
fltk-options application to get and modify FLTK runtime options.
fluid the fast light user-interface designer

Notes

A hybrid build requires Xfixes, Xrender, Xft, Xcursor and Xinerama: configure warns about each one whose headers are missing and then stops, rather than switching a feature off. Each library is a port in depends.

build.sh writes its own desktop entries for FLUID and fltk-options in place of upstream’s, adding a GenericName, Keywords and a StartupWMClass to each, and naming the second “FLTK Options”. Fl_Window::show(argc, argv) sets the window class, and so the Wayland app_id, from the program’s file name, which is what StartupWMClass names. The icons and the MIME types the entries name are upstream’s, installed by ninja install.