Feat: UI / UX fixes
This commit is contained in:
@@ -314,7 +314,7 @@ copy_artifacts() {
|
||||
|
||||
# Plugin artifacts for native targets (cross handled in bundle_plugins_cross)
|
||||
if $build_plugins && ! is_cross_target "$platform"; then
|
||||
local bundle_dir="$rd/bundle"
|
||||
local bundle_dir="target/bundled"
|
||||
|
||||
# CLAP
|
||||
local clap_src="$bundle_dir/${PLUGIN_NAME}.clap"
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
# Usage: scripts/make-appimage.sh <binary-path> <arch> <output-dir>
|
||||
# Produces an AppImage from a Linux binary using linuxdeploy.
|
||||
# Produces an AppImage from a Linux binary.
|
||||
# On native Linux with matching arch: uses linuxdeploy.
|
||||
# Otherwise (cross-compilation): builds AppImage via mksquashfs in Docker.
|
||||
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "Usage: $0 <binary-path> <arch> <output-dir>"
|
||||
@@ -16,121 +18,124 @@ OUTDIR="$3"
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
CACHE_DIR="$REPO_ROOT/.cache"
|
||||
APP_NAME="$(basename "$BINARY")"
|
||||
APPDIR="$(mktemp -d)/AppDir"
|
||||
|
||||
LINUXDEPLOY_URL="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${ARCH}.AppImage"
|
||||
LINUXDEPLOY="$CACHE_DIR/linuxdeploy-${ARCH}.AppImage"
|
||||
RUNTIME_URL="https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-${ARCH}"
|
||||
RUNTIME="$CACHE_DIR/runtime-${ARCH}"
|
||||
|
||||
# Map arch to linuxdeploy's expected values
|
||||
case "$ARCH" in
|
||||
x86_64) export LDAI_ARCH="x86_64" ;;
|
||||
aarch64) export LDAI_ARCH="aarch64" ;;
|
||||
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
build_appdir() {
|
||||
local appdir="$1"
|
||||
mkdir -p "$appdir/usr/bin"
|
||||
cp "$BINARY" "$appdir/usr/bin/cagire"
|
||||
chmod +x "$appdir/usr/bin/cagire"
|
||||
|
||||
download_tools() {
|
||||
mkdir -p "$appdir/usr/share/icons/hicolor/512x512/apps"
|
||||
cp "$REPO_ROOT/assets/Cagire.png" "$appdir/usr/share/icons/hicolor/512x512/apps/cagire.png"
|
||||
|
||||
cp "$REPO_ROOT/assets/cagire.desktop" "$appdir/cagire.desktop"
|
||||
|
||||
# AppRun entry point
|
||||
cat > "$appdir/AppRun" <<'APPRUN'
|
||||
#!/bin/sh
|
||||
SELF="$(readlink -f "$0")"
|
||||
HERE="$(dirname "$SELF")"
|
||||
exec "$HERE/usr/bin/cagire" "$@"
|
||||
APPRUN
|
||||
chmod +x "$appdir/AppRun"
|
||||
|
||||
# Symlink icon at root for AppImage spec
|
||||
ln -sf usr/share/icons/hicolor/512x512/apps/cagire.png "$appdir/cagire.png"
|
||||
ln -sf cagire.desktop "$appdir/.DirIcon" 2>/dev/null || true
|
||||
}
|
||||
|
||||
download_runtime() {
|
||||
mkdir -p "$CACHE_DIR"
|
||||
if [[ ! -f "$LINUXDEPLOY" ]]; then
|
||||
echo " Downloading linuxdeploy for $ARCH..."
|
||||
curl -fSL "$LINUXDEPLOY_URL" -o "$LINUXDEPLOY"
|
||||
chmod +x "$LINUXDEPLOY"
|
||||
fi
|
||||
if [[ ! -f "$RUNTIME" ]]; then
|
||||
echo " Downloading AppImage runtime for $ARCH..."
|
||||
curl -fSL "$RUNTIME_URL" -o "$RUNTIME"
|
||||
fi
|
||||
}
|
||||
|
||||
build_appdir() {
|
||||
mkdir -p "$APPDIR/usr/bin"
|
||||
cp "$BINARY" "$APPDIR/usr/bin/cagire"
|
||||
chmod +x "$APPDIR/usr/bin/cagire"
|
||||
run_native() {
|
||||
local linuxdeploy_url="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${ARCH}.AppImage"
|
||||
local linuxdeploy="$CACHE_DIR/linuxdeploy-${ARCH}.AppImage"
|
||||
|
||||
mkdir -p "$APPDIR/usr/share/icons/hicolor/512x512/apps"
|
||||
cp "$REPO_ROOT/assets/Cagire.png" "$APPDIR/usr/share/icons/hicolor/512x512/apps/cagire.png"
|
||||
mkdir -p "$CACHE_DIR"
|
||||
if [[ ! -f "$linuxdeploy" ]]; then
|
||||
echo " Downloading linuxdeploy for $ARCH..."
|
||||
curl -fSL "$linuxdeploy_url" -o "$linuxdeploy"
|
||||
chmod +x "$linuxdeploy"
|
||||
fi
|
||||
|
||||
cp "$REPO_ROOT/assets/cagire.desktop" "$APPDIR/cagire.desktop"
|
||||
}
|
||||
local appdir
|
||||
appdir="$(mktemp -d)/AppDir"
|
||||
build_appdir "$appdir"
|
||||
|
||||
run_linuxdeploy_native() {
|
||||
export ARCH="$LDAI_ARCH"
|
||||
export ARCH
|
||||
export LDAI_RUNTIME_FILE="$RUNTIME"
|
||||
"$LINUXDEPLOY" \
|
||||
"$linuxdeploy" \
|
||||
--appimage-extract-and-run \
|
||||
--appdir "$APPDIR" \
|
||||
--desktop-file "$APPDIR/cagire.desktop" \
|
||||
--icon-file "$APPDIR/usr/share/icons/hicolor/512x512/apps/cagire.png" \
|
||||
--appdir "$appdir" \
|
||||
--desktop-file "$appdir/cagire.desktop" \
|
||||
--icon-file "$appdir/usr/share/icons/hicolor/512x512/apps/cagire.png" \
|
||||
--output appimage
|
||||
|
||||
local appimage
|
||||
appimage=$(ls -1t ./*.AppImage 2>/dev/null | head -1 || true)
|
||||
if [[ -z "$appimage" ]]; then
|
||||
echo " ERROR: No AppImage produced"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$OUTDIR"
|
||||
mv "$appimage" "$OUTDIR/${APP_NAME}-linux-${ARCH}.AppImage"
|
||||
echo " AppImage -> $OUTDIR/${APP_NAME}-linux-${ARCH}.AppImage"
|
||||
}
|
||||
|
||||
run_linuxdeploy_docker() {
|
||||
run_docker() {
|
||||
local platform
|
||||
case "$ARCH" in
|
||||
x86_64) platform="linux/amd64" ;;
|
||||
aarch64) platform="linux/arm64" ;;
|
||||
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
local appdir
|
||||
appdir="$(mktemp -d)/AppDir"
|
||||
build_appdir "$appdir"
|
||||
|
||||
local image_tag="cagire-appimage-${ARCH}"
|
||||
|
||||
echo " Building Docker image $image_tag ($platform)..."
|
||||
docker build --platform "$platform" -q -t "$image_tag" - <<'DOCKERFILE'
|
||||
FROM ubuntu:22.04
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
file \
|
||||
libasound2 \
|
||||
libjack0 \
|
||||
libxcb-render0 \
|
||||
libxcb-shape0 \
|
||||
libxcb-xfixes0 \
|
||||
libxkbcommon0 \
|
||||
libgl1 \
|
||||
squashfs-tools \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
DOCKERFILE
|
||||
|
||||
echo " Running linuxdeploy inside Docker ($image_tag)..."
|
||||
echo " Creating squashfs via Docker ($image_tag)..."
|
||||
docker run --rm --platform "$platform" \
|
||||
-v "$REPO_ROOT:/project" \
|
||||
-v "$APPDIR:/appdir" \
|
||||
-v "$appdir:/appdir:ro" \
|
||||
-v "$CACHE_DIR:/cache" \
|
||||
-e ARCH="$LDAI_ARCH" \
|
||||
-e LDAI_RUNTIME_FILE="/cache/runtime-${ARCH}" \
|
||||
-w /project \
|
||||
"$image_tag" \
|
||||
bash -c "
|
||||
chmod +x /cache/linuxdeploy-${ARCH}.AppImage && \
|
||||
/cache/linuxdeploy-${ARCH}.AppImage \
|
||||
--appimage-extract-and-run \
|
||||
--appdir /appdir \
|
||||
--desktop-file /appdir/cagire.desktop \
|
||||
--icon-file /appdir/usr/share/icons/hicolor/512x512/apps/cagire.png \
|
||||
--output appimage
|
||||
"
|
||||
mksquashfs /appdir /cache/appimage-${ARCH}.squashfs \
|
||||
-root-owned -noappend -comp gzip -no-progress
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
local final="$OUTDIR/${APP_NAME}-linux-${ARCH}.AppImage"
|
||||
cat "$RUNTIME" "$CACHE_DIR/appimage-${ARCH}.squashfs" > "$final"
|
||||
chmod +x "$final"
|
||||
rm -f "$CACHE_DIR/appimage-${ARCH}.squashfs"
|
||||
echo " AppImage -> $final"
|
||||
}
|
||||
|
||||
HOST_ARCH="$(uname -m)"
|
||||
|
||||
download_tools
|
||||
build_appdir
|
||||
download_runtime
|
||||
|
||||
echo " Building AppImage for cagire ($ARCH)..."
|
||||
echo " Building AppImage for ${APP_NAME} ($ARCH)..."
|
||||
|
||||
if [[ "$HOST_ARCH" == "$ARCH" ]] && [[ "$(uname -s)" == "Linux" ]]; then
|
||||
run_linuxdeploy_native
|
||||
run_native
|
||||
else
|
||||
run_linuxdeploy_docker
|
||||
run_docker
|
||||
fi
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
# linuxdeploy outputs to cwd; find and move the AppImage
|
||||
APPIMAGE=$(ls -1t ./*.AppImage 2>/dev/null | head -1 || true)
|
||||
if [[ -z "$APPIMAGE" ]]; then
|
||||
echo " ERROR: No AppImage produced"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FINAL_NAME="${APP_NAME}-linux-${ARCH}.AppImage"
|
||||
mv "$APPIMAGE" "$OUTDIR/$FINAL_NAME"
|
||||
echo " AppImage -> $OUTDIR/$FINAL_NAME"
|
||||
|
||||
Reference in New Issue
Block a user