Files
Captioneer/scripts/distrobox/build.sh
T
kato 41867429a5
Tests / Go and GTK tests (push) Failing after 1m44s
fix(build): ensure gtk4-layer-shell loads before libwayland-client
- Update CGO_LDFLAGS in build scripts to include gtk4-layer-shell with the correct load order.
- Add a new layershell_link.go file to maintain the dependency on gtk4-layer-shell.
- Modify overlay_gtk.go to clarify the importance of load order for Layer Shell functionality.
- Enhance run.sh to preload gtk4-layer-shell for proper overlay positioning.
2026-07-17 19:35:08 +03:00

34 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=scripts/distrobox/common.sh
source "$script_dir/common.sh"
for argument in "$@"; do
if [[ "$argument" == "-o" || "$argument" == -o=* ]]; then
die "build output is managed by this script; do not pass -o"
fi
done
prepare_distrobox
mkdir -p -- "$repo_root/build"
# shellcheck disable=SC2016 # This script is evaluated inside the container.
build_script='set -Eeuo pipefail
repo_root=$1
shift
cd -- "$repo_root"
# gtk4-layer-shell must precede libwayland-client in the loader order or the
# Wayland shim never installs and the overlay cannot be positioned.
export CGO_LDFLAGS="-Wl,--no-as-needed -lgtk4-layer-shell ${CGO_LDFLAGS:-}"
go build "$@" -o build/captioneer ./src/cmd/captioneer
go build "$@" -tags gtk -o build/captioneer-desktop ./src/cmd/captioneer-desktop'
distrobox enter --no-workdir --name "$container_name" -- \
bash -lc "$build_script" captioneer-build "$repo_root" "$@"
printf 'Built terminal binary: %s\n' "$repo_root/build/captioneer"
printf 'Built desktop binary: %s\n' "$repo_root/build/captioneer-desktop"
printf 'The desktop binary requires compatible GTK4 and gtk4-layer-shell runtime libraries.\n'