1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/sh
# Build script for tint2 (CMake, Ninja generator).
# Deps: cairo, pango, glib2, libX11, libXinerama, libXrandr, libXrender,
# libXcomposite, libXdamage, imlib2 (all ported).
#
# CMake doesn't recognize Hammerhead and won't set UNIX=TRUE / pick the
# right shared-lib conventions without a Platform module (same gotcha as
# base/libjpeg-turbo's cmake build) - map it to the SunOS platform module.
#
# ENABLE_BATTERY=OFF: no battery in a VM (task brief).
# ENABLE_TINT2CONF=OFF: tint2conf is a GTK+2 theme configurator - NO GTK
# anywhere per the toolkit-durability decision, and GTK+2 isn't ported.
# ENABLE_RSVG=OFF / ENABLE_SN=OFF: librsvg / libstartup-notification are
# not ported; both are optional (launcher SVG icons / startup-notification
# only) and tint2's CMakeLists gates them cleanly behind these options.
set -e
cd "$SRCDIR"
# GOTCHA (found 2026-07-22): src/util/window.c and src/util/timer.c use the
# BSD u_int32_t/u_int64_t typedefs, which illumos's <sys/types.h> does NOT
# provide (unlike glibc, which defines them unconditionally) - not even
# behind __EXTENSIONS__. window.c already includes <stdint.h>, so just
# swap the type names to their POSIX/C99 uintNN_t equivalents; timer.c
# needs the #include added too.
sed -i -e 's/u_int64_t/uint64_t/g' -e 's/u_int32_t/uint32_t/g' src/util/window.c
sed -i -e 's/u_int64_t/uint64_t/g' src/util/timer.c
{ printf '#include <stdint.h>\n'; cat src/util/timer.c; } > src/util/timer.c.new
mv src/util/timer.c.new src/util/timer.c
# bzero() lives in illumos's <strings.h> (BSD legacy function, not
# <string.h>) - several tint2 files call it without including that header,
# an implicit-declaration error under GCC 14. Prepend the include to every
# file that uses bzero() but doesn't already pull in strings.h.
for f in src/util/common.c src/util/area.c src/util/timer.c \
src/util/gradient.c src/battery/battery.c; do
if grep -q 'bzero(' "$f" && ! grep -q 'strings\.h' "$f"; then
{ printf '#include <strings.h>\n'; cat "$f"; } > "$f.new"
mv "$f.new" "$f"
fi
done
mkdir -p "$SRCDIR/.cmake/Platform"
echo 'include(Platform/SunOS)' > "$SRCDIR/.cmake/Platform/Hammerhead.cmake"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
cmake -B build -G Ninja \
-DCMAKE_MODULE_PATH="$SRCDIR/.cmake" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
-DCMAKE_INSTALL_RPATH="$PREFIX/lib" \
-DCMAKE_C_FLAGS="-D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS" \
-DENABLE_BATTERY=OFF \
-DENABLE_TINT2CONF=OFF \
-DENABLE_RSVG=OFF \
-DENABLE_SN=OFF
cmake --build build -j${JOBS:-1}
DESTDIR="$PKGDIR" cmake --install build
|