build: add AppImage packaging pipeline and build scripts
This commit is contained in:
parent
7b4a9c1fe3
commit
26eaf8cf68
6 changed files with 220 additions and 0 deletions
51
packaging/appimage/build-appimage.sh
Executable file
51
packaging/appimage/build-appimage.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
APPIMAGE_ROOT="${ROOT_DIR}/appimage"
|
||||
BUILD_DIR="${APPIMAGE_ROOT}/build"
|
||||
APPDIR="${BUILD_DIR}/AppDir"
|
||||
DIST_DIR="${APPIMAGE_ROOT}/dist"
|
||||
|
||||
APPIMAGE_BUILDER_BIN="${APPIMAGE_BUILDER_BIN:-appimage-builder}"
|
||||
|
||||
for cmd in uv "${APPIMAGE_BUILDER_BIN}"; do
|
||||
if ! command -v "${cmd}" >/dev/null 2>&1; then
|
||||
echo "Missing required command: ${cmd}" >&2
|
||||
echo "See docs/appimage.md for setup instructions." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "${BUILD_DIR}" "${DIST_DIR}"
|
||||
rm -rf "${APPDIR}"
|
||||
mkdir -p "${APPDIR}"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
uv export \
|
||||
--frozen \
|
||||
--no-dev \
|
||||
--no-emit-project \
|
||||
--no-hashes \
|
||||
--format requirements-txt \
|
||||
--output-file "${BUILD_DIR}/requirements.txt"
|
||||
uv build --wheel --out-dir "${BUILD_DIR}"
|
||||
|
||||
WHEEL_PATH="$(ls -1 "${BUILD_DIR}"/scanslicer-*.whl | head -n 1)"
|
||||
if [[ -z "${WHEEL_PATH}" ]]; then
|
||||
echo "Could not find built wheel in ${BUILD_DIR}" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf "%s\n" "${WHEEL_PATH}" >> "${BUILD_DIR}/requirements.txt"
|
||||
|
||||
export SCANSLICER_ROOT="${ROOT_DIR}"
|
||||
export SCANSLICER_APPDIR="${APPDIR}"
|
||||
export SCANSLICER_REQUIREMENTS="${BUILD_DIR}/requirements.txt"
|
||||
|
||||
cd "${BUILD_DIR}"
|
||||
"${APPIMAGE_BUILDER_BIN}" --recipe "${ROOT_DIR}/packaging/appimage/AppImageBuilder.yml"
|
||||
|
||||
mkdir -p "${DIST_DIR}"
|
||||
find "${BUILD_DIR}" -maxdepth 1 -type f \( -name "*.AppImage" -o -name "*.zsync" \) -exec mv -f {} "${DIST_DIR}/" \;
|
||||
|
||||
echo "AppImage build complete. Output in ${DIST_DIR}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue