kick/build.sh
Andrew Hamilton 6b4418ae4f feat: serve xdg-decoration-v1 pinned client-side
Every tab is maximized and kick draws no frames, so new toplevels
are pinned to client-side mode (headerbars keep working) and later
server-side requests are ignored. Pinning happens at map -- set_mode
asserts on a never-committed surface, and decoration-before-commit is
the normal order (calling it in new_toplevel_decoration aborts
wlroots); late binds pin immediately when already initialized.

Adds an xdeco probe (maps one shm-backed toplevel, reports the
configured mode) with a regression test asserting mode=1, tracks it
in build.sh staleness, and covers the global in protocol_globals.
Full suite: 153 passed, 2 skipped.
2026-09-10 03:08:18 +10:00

70 lines
2.5 KiB
Bash
Executable file

#!/bin/sh
set -e
cd "$(dirname "$0")"
# ./build.sh -> debug build in build/ (for the test suite)
# ./build.sh release -> optimized + stripped binary in build-release/
# for size benchmarking. The debug build/ is untouched.
#
# Rebuild only when a source is newer than the built binary; otherwise
# meson setup/compile would (re)generate everything each run. Sources
# are tracked per program: kick.c only feeds kick, tests/wltest.c only
# feeds wltest, tests/xdeco.c only feeds xdeco, while meson.build and
# the vendored subprojects feed all three.
stale() {
# $1 = binary; $2.. = source paths/dirs it depends on.
bin=$1
shift
[ -x "$bin" ] || return 0
for p in "$@"; do
[ -e "$p" ] || continue
if [ -d "$p" ]; then
if find "$p" -type f -newer "$bin" ! -name '.wraplock' -print -quit | grep -q .; then
return 0
fi
elif [ "$p" -nt "$bin" ]; then
return 0
fi
done
return 1
}
if [ "$1" = "release" ]; then
[ $# -ne 1 ] && { echo "usage: $0 [release]" >&2; exit 2; }
if stale build-release/kick kick.c meson.build subprojects wlr-protocols; then
set -x
meson setup build-release --reconfigure --buildtype=release
meson compile -C build-release kick
# meson only strips on install, not the build-tree binary, so strip
# it in place to match a distro package.
strip -o build-release/kick.tmp build-release/kick
mv -f build-release/kick.tmp build-release/kick
echo "Built: ./build-release/kick (optimized + stripped)"
else
echo "build: nothing to do (release binary up to date)"
fi
exit $?
fi
[ $# -gt 0 ] && { echo "usage: $0 [release]" >&2; exit 2; }
if stale build/kick kick.c meson.build subprojects wlr-protocols \
|| stale build/wltest tests/wltest.c meson.build subprojects \
|| stale build/xdeco tests/xdeco.c meson.build subprojects; then
set -x
meson setup build --reconfigure
meson compile -C build
# A successful build means the binaries now reflect every tracked
# source, even ones meson decided not to relink (e.g. wltest after
# only meson.build changed). Touch them so the mtime-based stale()
# fast-path doesn't keep flagging them forever. Ninja tracks
# incrementality via its own dep files, not the binary's mtime, so this
# never fools the next real rebuild.
touch build/kick build/wltest build/xdeco
echo "Built: ./build/kick"
else
echo "build: nothing to do (binaries up to date)"
fi