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
+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