#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Use the matching image or cache prefix; rebuild after a vendored source bump. set -euo pipefail prefix="${WX_PREFIX:?WX_PREFIX is required}" if [ -L "$prefix" ] || [ -L "$prefix/.alkane-source-sha256" ]; then echo 'refusing symlinked wxWidgets prefix or source marker' >&2 exit 1 fi expected="$(awk '$1 == "sha256:" {print $2}' thirdparty/wxwidgets/VERSION)" [[ "$expected" =~ ^[0-9a-f]{64}$ ]] || { echo 'invalid pinned wxWidgets source digest' >&2 exit 1 } marker="$prefix/.alkane-source-sha256" if [ -e "$marker" ] && [ "$(cat "$marker")" != "$expected" ]; then python3 - "$prefix" <<'PY' from pathlib import Path import shutil import sys prefix = Path(sys.argv[1]) allowed = Path('/root/.cache/wx-3.3.3-linux') if prefix != allowed or prefix.is_symlink(): raise SystemExit('refusing unsafe wxWidgets prefix reset') if prefix.is_dir(): shutil.rmtree(prefix) PY fi built=false if [ ! -x "$prefix/bin/wx-config" ] || [ ! -s "$prefix/lib/libwx_gtk3u-3.3.a" ]; then bash scripts/build-wx-linux.sh built=true else echo 'wx prefix available from matching image or cache' fi [ -s "$prefix/lib/libwx_gtk3u-3.3.a" ] printf '%s\n' "$expected" > "$marker" if [ -n "${GITHUB_OUTPUT:-}" ]; then printf 'built=%s\n' "$built" >> "$GITHUB_OUTPUT" fi