31 lines
1.0 KiB
Bash
31 lines
1.0 KiB
Bash
#!/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"
|
||
|
|
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'
|