mirror of
https://github.com/Brodino96/webkit2gtk-automator.git
synced 2026-05-05 22:29:57 +02:00
63 lines
1.7 KiB
Bash
Executable File
63 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# build.sh
|
|
# Runs INSIDE the Docker container as builduser.
|
|
# Builds webkit2gtk from the AUR PKGBUILD and copies the resulting
|
|
# .pkg.tar.zst packages to /workspace/state/artifacts/.
|
|
|
|
set -euo pipefail
|
|
|
|
WORKSPACE=/workspace
|
|
SRC_DIR="${WORKSPACE}/webkit2gtk"
|
|
ARTIFACTS_DIR="${WORKSPACE}/state/artifacts"
|
|
|
|
log() {
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [build] $*"
|
|
}
|
|
|
|
# Sanity checks
|
|
if [[ ! -f "${SRC_DIR}/PKGBUILD" ]]; then
|
|
log "ERROR: PKGBUILD not found at ${SRC_DIR}/PKGBUILD"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "${ARTIFACTS_DIR}"
|
|
|
|
# Clean any leftover build artifacts from a previous run
|
|
log "Cleaning previous build artifacts in ${SRC_DIR}"
|
|
# makepkg leaves behind src/, pkg/ and the .pkg.tar.zst files
|
|
cd "${SRC_DIR}"
|
|
rm -rf src/ pkg/
|
|
find . -maxdepth 1 -name '*.pkg.tar.zst' -delete
|
|
find . -maxdepth 1 -name '*.pkg.tar.zst.sig' -delete
|
|
|
|
# Build
|
|
log "Running makepkg in ${SRC_DIR}"
|
|
# --syncdeps : install missing makedepends automatically
|
|
# --noconfirm : do not ask for confirmations
|
|
# --clean : clean up src/ and pkg/ after a successful build
|
|
# --log : write build log to makepkg-<pkgname>.log
|
|
makepkg \
|
|
--syncdeps \
|
|
--noconfirm \
|
|
--log
|
|
|
|
# Collect artifacts
|
|
log "Collecting built packages"
|
|
packages=()
|
|
while IFS= read -r -d '' pkg; do
|
|
packages+=("${pkg}")
|
|
done < <(find "${SRC_DIR}" -maxdepth 1 -name '*.pkg.tar.zst' -print0)
|
|
|
|
if [[ ${#packages[@]} -eq 0 ]]; then
|
|
log "ERROR: No .pkg.tar.zst files found after build"
|
|
exit 1
|
|
fi
|
|
|
|
for pkg in "${packages[@]}"; do
|
|
log "Copying $(basename "${pkg}") to ${ARTIFACTS_DIR}/"
|
|
cp "${pkg}" "${ARTIFACTS_DIR}/"
|
|
done
|
|
|
|
log "Build complete, artifacts:"
|
|
ls -lh "${ARTIFACTS_DIR}"/*.pkg.tar.zst
|