chore: add Apache License 2.0 and ignore build directory

This commit is contained in:
2026-07-16 17:24:50 +03:00
parent 45e4bce2a0
commit 7affa0dbc8
23 changed files with 1814 additions and 157 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/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'
+70
View File
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
set -Eeuo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
# shellcheck disable=SC2034 # Exported to scripts that source this helper.
repo_root="$(cd -- "$script_dir/../.." && pwd -P)"
container_name="${CAPTIONEER_DISTROBOX_NAME:-captioneer-dev}"
container_image="${CAPTIONEER_DISTROBOX_IMAGE:-registry.fedoraproject.org/fedora-toolbox:44}"
container_packages=(
ShellCheck
bzip2
curl
gcc
golang
gtk4-devel
gtk4-layer-shell-devel
libX11-devel
libXfixes-devel
pkgconf-pkg-config
pulseaudio-utils
tar
)
die() {
printf 'captioneer: %s\n' "$*" >&2
exit 1
}
require_command() {
command -v "$1" >/dev/null 2>&1 || die "$1 was not found in PATH"
}
ensure_container() {
require_command distrobox
distrobox create \
--yes \
--no-entry \
--name "$container_name" \
--image "$container_image" >/dev/null
}
ensure_dependencies() {
local dependency_script
# shellcheck disable=SC2016 # This script is evaluated inside the container.
dependency_script='set -Eeuo pipefail
missing=()
for package in "$@"; do
if ! rpm -q "$package" >/dev/null 2>&1; then
missing+=("$package")
fi
done
if (( ${#missing[@]} > 0 )); then
printf "Installing missing Captioneer dependencies: %s\\n" "${missing[*]}"
sudo dnf install -y "${missing[@]}"
fi'
distrobox enter --no-workdir --name "$container_name" -- \
bash -lc "$dependency_script" captioneer-dependencies "${container_packages[@]}"
}
prepare_distrobox() {
ensure_container
ensure_dependencies
}
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
die "common.sh is a shared helper; run build.sh or run.sh instead"
fi
+21
View File
@@ -0,0 +1,21 @@
#!/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"
prepare_distrobox
# shellcheck disable=SC2016 # This script is evaluated inside the container.
run_script='set -Eeuo pipefail
repo_root=$1
shift
cd -- "$repo_root"
# Avoid host/container DMABUF incompatibilities on mismatched GPU stacks. An
# explicit GTK renderer choice still takes precedence.
export GSK_RENDERER="${GSK_RENDERER:-cairo}"
exec go run -tags gtk ./src/cmd/captioneer-desktop "$@"'
exec distrobox enter --no-workdir --name "$container_name" -- \
bash -lc "$run_script" captioneer-run "$repo_root" "$@"