#!/bin/bash # SPDX-License-Identifier: AGPL-3.0-or-later # Copyright (c) 2025-2026 Cristian Cezar Moisés # Build vaptvupt CLI as AppImage (portable single-file binary). # Includes a legacy `zupt` symlink so AppDir users can invoke either name. set -e cd "$(dirname "$0")/.." VERSION="${VERSION:-4.2.0}" ARCH="${ARCH:-x86_64}" PKGNAME="vaptvupt" LEGACY="zupt" NAME="$PKGNAME-$VERSION-$ARCH" OUT="/tmp/${NAME}.AppDir" rm -rf "$OUT" mkdir -p "$OUT/usr/bin" "$OUT/usr/share/applications" "$OUT/usr/share/icons/hicolor/256x256/apps" # Source-only build: the binary links only libc/libm/pthread from the host, # so the AppDir ships no bundled libraries. install -m 755 $PKGNAME "$OUT/usr/bin/$PKGNAME" ln -sf $PKGNAME "$OUT/usr/bin/$LEGACY" cat > "$OUT/AppRun" < "$OUT/$PKGNAME.desktop" < "$OUT/$PKGNAME.png" cp "$OUT/$PKGNAME.png" "$OUT/usr/share/icons/hicolor/256x256/apps/$PKGNAME.png" if command -v appimagetool >/dev/null 2>&1; then ARCH=$ARCH appimagetool "$OUT" "/tmp/${NAME}.AppImage" 2>&1 | tail -5 echo "Built: /tmp/${NAME}.AppImage" fi # Always produce the AppDir tarball as well -- some environments (no FUSE, # strict execve policies, etc.) cannot run the .AppImage directly. The # tarball is the universal fallback: extract and run AppRun. cd /tmp tar -czf "${NAME}.AppDir.tar.gz" "$(basename "$OUT")" echo "Built: /tmp/${NAME}.AppDir.tar.gz" echo "Users can run: tar xzf ${NAME}.AppDir.tar.gz && ./${NAME}.AppDir/AppRun version"