330.9. tuxpaint-0.9.35
Drawing program for children — brushes, stamps, shapes, text and magic tools
| Version | 0.9.35, release 2 |
| Shelf | education — Learning software, offline encyclopedias and reference dictionaries |
| Phase | 44_apps (Applications), 94 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://tuxpaint.org/ |
| Build time | 1.0 SBU |
| Installed size | 27.6 MiB in 1144 files |
| Recipe | ports/core/education/tuxpaint/kpkgbuild |
About
Tux Paint is a drawing program for children: brushes, stamps, shapes, lines, text and the “magic” tools, which are effects shipped as plugins under /usr/lib/tuxpaint/plugins. It is an SDL 2 program, drawn here by sdl2-compat on SDL 3, with its own large-button interface and no toolkit.
Sources
tuxpaint-0.9.35.tar.gz(24.5 MiB)
sha256c1c18af91be77e94fdaab2c928204c4c39ba39ac5da2f441aaf2ecab6d8bd0ad
upstream: https://downloads.sourceforge.net/project/tuxpaint/tuxpaint/0.9.35/tuxpaint-0.9.35.tar.gz
archive copy: sources-2/education--tuxpaint-0.9.35.tar.gz
Dependencies
Depends on: pkgconf, gperf, gettext, imagemagick, sdl2-compat, sdl2-image, sdl2-ttf, sdl2-mixer, sdl2-gfx, sdl2-pango, pango, fribidi, librsvg, cairo, libpng, zlib, libpaper, libimagequant, libxml2, fontconfig.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
app-id.patch— Ask for the window class and app id tuxpaintThe desktop entry and the AppStream launchable are tuxpaint.desktop, and a Wayland compositor finds a window's entry only by a file named after its app id. SDL takes the app id from SDL_VIDEO_X11_WMCLASS, so name the class tuxpaint, not TuxPaint.TuxPaint.
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 tuxpaint'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/education/tuxpaint.
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/education/tuxpaint
echo 'c1c18af91be77e94fdaab2c928204c4c39ba39ac5da2f441aaf2ecab6d8bd0ad tuxpaint-0.9.35.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/tuxpaint
SRC=$SRC_ROOT/tuxpaint-0.9.35
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf tuxpaint-0.9.35.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:
patch -p1 -i "$PORT_SRC/app-id.patch"
export CPPFLAGS="$CFLAGS -D_POSIX_PRIORITY_SCHEDULING -DHAVE_STRCASESTR -Wno-implicit-function-declaration"
_make=(
PREFIX=/usr
LDFLAGS="$LDFLAGS"
OPTFLAGS='$(FASTMATH)'
MAGIC_CFLAGS="$CFLAGS"' $(FASTMATH) -fno-common $(MAGIC_SDL_CPPFLAGS) -Isrc/'
)
make -j1 "${_make[@]}"
make -j1 "${_make[@]}" PACKAGE_ONLY=yes DESTDIR=$PKG \
COMPLETIONDIR=$PKG/usr/share/bash-completion/completions install
mv "$PKG/usr/share/bash-completion/completions/010_tuxpaint-completion.bash" \
"$PKG/usr/share/bash-completion/completions/tuxpaint"
install -Dm644 docs/COPYING.txt "$PKG/usr/share/licenses/$name/COPYING.txt"
rm -f "$PKG/usr/share/tuxpaint/fonts/locale/zh_tw_docs/maketuxfont.py"
for d in "$PKG"/usr/share/doc/tuxpaint-$version/*/ "$PKG"/usr/share/man/*/; do
case ${d%/} in
*/tuxpaint-$version/en | */tuxpaint-$version/html | */man/man[0-9]*) ;;
*) rm -rf "$d" ;;
esac
done
rm -f "$PKG"/usr/share/applications/tuxpaint*.desktop
cat > "$PKG/usr/share/applications/tuxpaint.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Tux Paint
GenericName=Drawing Program
Comment=A drawing program for children
TryExec=tuxpaint
Exec=tuxpaint
Icon=tuxpaint
Terminal=false
StartupWMClass=tuxpaint
Categories=Education;Art;Graphics;2DGraphics;Game;KidsGame;
Keywords=paint;draw;drawing;children;kids;art;stamps;tuxpaint;
DESKTOP
cat > "$PKG/usr/share/applications/tuxpaint-fullscreen.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Tux Paint (Fullscreen)
GenericName=Drawing Program
Comment=A drawing program for children, filling the screen
TryExec=tuxpaint
Exec=tuxpaint --fullscreen=native
Icon=tuxpaint
Terminal=false
StartupWMClass=tuxpaint
Categories=Education;Art;Graphics;2DGraphics;Game;KidsGame;
Keywords=paint;draw;drawing;children;kids;art;fullscreen;tuxpaint;
DESKTOP
chmod 644 "$PKG"/usr/share/applications/tuxpaint*.desktop
The switches, and why each is set:
The makefile assigns CFLAGS and LDFLAGS itself and never reads them from the environment. It does read CPPFLAGS, at the head of its own CFLAGS, so build.sh hands the tree’s compile flags over in CPPFLAGS, and everything else on the make command line in _make.
-D_POSIX_PRIORITY_SCHEDULING— The font loader insrc/fonts.cruns in a forked child that callssched_yield()to let the parent run. With this macro undefined the file definessched_yield()away to nothing. glibc’s headers define the macro; musl’s do not.-DHAVE_STRCASESTR— Tellsrc/tuxpaint.cthat the C library hasstrcasestr. Without it, the file defines its own copy whenever__USE_GNU, a glibc-internal macro, is undefined, as it always is under musl.-Wno-implicit-function-declaration— Let a call to a function with no declaration in scope compile silently instead of failing with the error GCC makes of it.LDFLAGS="$LDFLAGS"— Give the link the tree’s flags. The makefile’s ownLDFLAGSon Linux is empty, so this replaces nothing.OPTFLAGS='$(FASTMATH)'— Replace the makefile’s-O2 -g $(FASTMATH)for the program with-ffast-mathalone; the optimisation level comes from the tree’s flags inCPPFLAGS, and the program ships no DWARF.MAGIC_CFLAGS— Replace the makefile’s flags for the magic plugins,-g3 -O2 $(FASTMATH)and warnings, with the tree’sCFLAGSplus$(FASTMATH),-fno-common, the SDL include flags and-Isrc/, so the plugins are built with the tree’s hardening and without DWARF.PACKAGE_ONLY=yes— Install the desktop entries and hicolor icons intoDESTDIRinstead of registering them with xdg-utils on the build machine.COMPLETIONDIR=$PKG/usr/share/bash-completion/completions— Install the bash completion where bash-completion looks for it, instead of upstream’s/etc/bash_completion.d.build.shthen renames the file totuxpaint, the command it completes, which is the name bash-completion loads it by.
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/tuxpaint, 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 tuxpaint-0.9.35-2.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/tuxpaint, and runs the triggers its paths call for.
Contents
Installed programs: tp-magic-config, tuxpaint, tuxpaint-import.
Installed directories: /etc/tuxpaint, /usr/include/tuxpaint, /usr/lib/tuxpaint, /usr/share/doc/tuxpaint-0.9.35, /usr/share/licenses/tuxpaint, /usr/share/locale/en_ZA, /usr/share/tuxpaint.
Short descriptions
tp-magic-config |
Helps creating 'Magic' tool plugins for Tux Paint(1) |
tuxpaint |
"Tux Paint", a drawing program for young children. |
tuxpaint-import |
Import image files into Tux Paint(1) |
Notes
The makefile is not safe in parallel, so both make runs pass -j1.
build.sh keeps only the English documentation and manual pages: every directory under /usr/share/doc/tuxpaint-<version> other than en and html, and every directory under /usr/share/man other than the man<section> ones, is removed. It also removes maketuxfont.py, a Python helper that upstream installs with the zh_TW font documents.
The entries are replaced. Tux Paint names its window by setting SDL’s SDL_VIDEO_X11_WMCLASS with putenv() in setup(), and SDL takes the Wayland app id from it as well. Upstream’s TuxPaint.TuxPaint names no desktop entry, and KWin finds a window’s icon only by a file named after its app id, so app-id.patch sets tuxpaint, the name of the entry and of the AppStream launchable; without it the window shows the generic icon. Both entries carry StartupWMClass=tuxpaint. The patch is to be offered upstream.