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
fltk-1.4.5.tar.gz(8.9 MiB)
sha256eede1fb2b8e9c2e581e77082e15252145855c79aad30070ee3b24aabe2f926f1
upstream: https://github.com/fltk/fltk/releases/download/release-1.4.5/fltk-1.4.5-source.tar.gz
archive copy: sources-4/toolkits--fltk-1.4.5.tar.gz
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:
CFLAGS=— withCXXFLAGS=in front ofcmake, and the tree’s flags handed over in-DCMAKE_C_FLAGS_RELEASEand-DCMAKE_CXX_FLAGS_RELEASEinstead. FLTK compiles with both, so the library is built with the tree’s flags and-O3. What changes isfltk-config: it recordsCMAKE_C_FLAGS, which CMake fills from the environment’sCFLAGS, as the--cflagsand the--cxxflagsit hands to every program built against FLTK, and it leaves the Release flags out. With the environment empty, those outputs carry FLTK’s own include and feature flags and none of this build’s, so a C-only flag such as-std=gnu11does not reach a C++ consumer’s compile line.-DFLTK_BACKEND_WAYLAND=ON— with-DFLTK_BACKEND_X11=ON: the hybrid library. The Wayland backend draws with cairo and lays out text with pango; a hybrid build draws its X11 windows the same way, so the X11 half needs pango’spangoxftas well.-DFLTK_USE_SYSTEM_LIBDECOR=ON— use the libdecor port instead of compiling the copy FLTK carries. Window frames on Wayland come from the plugins that port installs. configure falls back to the bundled copy without failing when the port is older than 0.2.0 or itslibdecor/plugins-1directory is missing.-DFLTK_USE_DBUS=ON— use D-Bus, which FLTK’s Wayland backend needs to read the desktop’s cursor theme.-DFLTK_BUILD_SHARED_LIBS=ON— build the shared libraries, which a program links by default, as well as the static archives FLTK always builds. Off by upstream’s default.-DFLTK_BUILD_GL=ON— buildlibfltk_gl: OpenGL on EGL under Wayland and on GLX under X11. configure needsgl.pc,egl.pc,glu.pcandwayland-egl.pcfor it.-DFLTK_OPTION_CAIRO_WINDOW=ON— with-DFLTK_OPTION_CAIRO_EXT=ON: buildFl_Cairo_Window, a window that sets up a Cairo context for the application’s own drawing callback, and the “extended” support that provides a Cairo context in everyFl_Windowsubclass. FLTK’s own drawing does not depend on either; both are off by upstream’s default.-DFLTK_USE_SYSTEM_LIBJPEG=ON— with-DFLTK_USE_SYSTEM_LIBPNG=ONand-DFLTK_USE_SYSTEM_ZLIB=ON: link libjpeg-turbo, libpng and zlib instead of FLTK’s bundled copies. Upstream’s default on Linux, named.-DFLTK_BUILD_FORMS=ON— with-DFLTK_BUILD_FLUID=ON,-DFLTK_BUILD_FLTK_OPTIONS=ON,-DFLTK_OPTION_SVG=ON,-DFLTK_OPTION_PRINT_SUPPORT=ON,-DFLTK_OPTION_FILESYSTEM_SUPPORT=ON,-DFLTK_OPTION_LARGE_FILE=ONand-DFLTK_USE_PTHREADS=ON: the XForms compatibility library, FLUID,fltk-options, SVG images, printing, the file chooser’s file system support, large files and threads. Each is upstream’s default, named.-DFLTK_BUILD_TEST=OFF— with-DFLTK_BUILD_EXAMPLES=OFF,-DFLTK_BUILD_HTML_DOCS=OFF,-DFLTK_BUILD_PDF_DOCS=OFFand-DFLTK_BUILD_FLUID_DOCS=OFF: no demo programs, examples or Doxygen manuals.
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.