323.5. powder-toy-100.1.400
The Powder Toy — a falling-sand physics sandbox of air pressure, heat, gravity and electronics, with local saves
| Version | 100.1.400, release 1 |
| Shelf | games-action — Action, arcade, racing, platform and sandbox games |
| Phase | 44_apps (Applications), 140 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://powdertoy.co.uk |
| Build time | 5.5 SBU |
| Installed size | 4.1 MiB in 7 files |
| Recipe | ports/core/games-action/powder-toy/kpkgbuild |
About
The Powder Toy is a falling-sand physics sandbox: the player places particles of powders, liquids, gases, explosives and electronic parts, and the game simulates air pressure, heat, gravity and electricity between them. The program is powder; it saves simulations as local .cps files and stamps, its reusable pieces of a simulation, as .stm files.
Sources
powder-toy-100.1.400.tar.gz(898.7 KiB)
sha25675cd971e1b2d6789f9e35b75926b76d037a564ad9291fa852ad9996c8ac40c96
upstream: https://github.com/The-Powder-Toy/The-Powder-Toy/archive/refs/tags/v100.1.400.tar.gz
archive copy: sources-2/games-action--powder-toy-100.1.400.tar.gz
Dependencies
Depends on: meson, ninja, pkgconf, python3, sdl2-compat, luajit, fftw, jsoncpp, libpng, bzip2, zlib.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-Drender_icons_with_inkscape=disabled, line 21: inkscape (explained with the switches below)
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 powder-toy'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-action/powder-toy.
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/games-action/powder-toy
echo '75cd971e1b2d6789f9e35b75926b76d037a564ad9291fa852ad9996c8ac40c96 powder-toy-100.1.400.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/powder-toy
SRC=$SRC_ROOT/powder-toy-100.1.400
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf powder-toy-100.1.400.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:
meson setup build --prefix=/usr --libdir=lib --buildtype=release \
-Dstatic=none \
-Dhttp=false \
-Dignore_updates=true \
-Dcan_install=no \
-Dlua=luajit \
-Dworkaround_elusive_bzip2=none \
-Duse_bluescreen=no \
-Dresolve_vcs_tag=no \
-Drender_icons_with_inkscape=disabled
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
install -Dm644 resources/powder.man "$PKG/usr/share/man/man6/powder.6"
install -Dm644 resources/generated_icons/icon_exe.png \
"$PKG/usr/share/icons/hicolor/256x256/apps/powder-toy.png"
install -Dm644 resources/generated_icons/icon_exe_48.png \
"$PKG/usr/share/icons/hicolor/48x48/apps/powder-toy.png"
install -Dm644 build/resources/save.xml \
"$PKG/usr/share/mime/packages/powder-toy.xml"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/powder-toy.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=The Powder Toy
GenericName=Physics Sandbox
Comment=Falling-sand sandbox of pressure, heat, gravity and electronics
Exec=powder %f
Icon=powder-toy
Terminal=false
StartupWMClass=powder
MimeType=application/vnd.powdertoy.save;
Categories=Game;Simulation;
Keywords=sandbox;physics;falling sand;simulation;tpt;powder;
DESKTOP
chmod 644 "$PKG/usr/share/applications/powder-toy.desktop"
The switches, and why each is set:
-Dstatic=none— link against the system’s shared libraries. The other choices link statically, against system libraries or against the prebuilt bundle official builds download. Upstream’s default, named.-Dhttp=false— build without libcurl. The online save browser, signing in, voting and the update check all talk topowdertoy.co.ukover HTTP; without it saves are opened and written as local files only, and curl is not independs.-Dignore_updates=true— no notice of new versions. Upstream’s default, named.-Dcan_install=no— keep the game from setting up its own file and URL associations. Left atauto, a release build offers at start-up to write a desktop entry and a MIME type into the user’s home directory; this port installs both system-wide instead.-Dlua=luajit— the Lua scripting console and scripts run on luajit.autopicks by platform, which on Linux is LuaJIT too; naming it makes a missing LuaJIT a configure error.-Dworkaround_elusive_bzip2=none— find bzip2 through its pkg-config file like every other dependency. The default,simple, finds it by asking the compiler for-lbz2in its built-in directories.-Duse_bluescreen=no— no blue error screen with a stack trace on a crash. Its Linux stack-trace code usesbacktrace()fromexecinfo.h, which musl does not have;autoturns it on for every build that is not a debug build.-Dresolve_vcs_tag=no— do not ask git for a version tag at build time, which upstream does through a target that is always out of date. Its default does so only for a static release build, so withstatic=nonethis names the outcome.-Drender_icons_with_inkscape=disabled— use the PNG icons the source ships inresources/generated_iconsrather than rendering them from SVG with Inkscape. Upstream’s default, named.
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/powder-toy, 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 powder-toy-100.1.400-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/powder-toy, and runs the triggers its paths call for.
Contents
Installed programs: powder.
Installed directories: /usr/share/licenses/powder-toy.
Short descriptions
powder |
a physics sandbox game |
Notes
meson install installs the program alone, so build.sh installs the rest from the source and build trees: the manual page, two of the generated icons, and build/resources/save.xml, the shared-MIME definition of application/vnd.powdertoy.save, which kpkg folds into the MIME database (see Shared indexes). The desktop entry is written by build.sh and claims that type, so a .cps or .stm file opens in the game. Upstream’s own entry also claims the ptsave: URL scheme, which opens the online save browser that this build does not have, so the entry here leaves it out. The window’s Wayland app id is SDL’s default, the executable’s name, powder, which is what StartupWMClass names.