feat: add Nix flake package, AppImage and .deb packaging
- flake: build teleportfling and teleportfling-gui as nixpkgs packages (buildGoModule) with a .desktop entry and icon for the GUI - packaging/appimage.sh: bundle the GUI + runtime libs (recursive ldd) into a self-contained AppImage via appimagetool - packaging/deb.sh: build a .deb for Debian/Ubuntu with both binaries, desktop entry, icon and declared runtime dependencies - README: document all three packaging methods - .gitignore: ignore dist/
This commit is contained in:
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a self-contained AppImage of the TeleportFling GUI.
|
||||
#
|
||||
# Approach: build the GUI binary, then bundle it plus every shared library it
|
||||
# needs (from ldd, recursively) plus the dlopened PipeWire stack into an
|
||||
# AppDir, then package it with appimagetool. Output:
|
||||
# dist/TeleportFling-<version>-x86_64.AppImage
|
||||
#
|
||||
# Usage:
|
||||
# ./packaging/appimage.sh
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
OUT="${HERE}/dist"
|
||||
APPDIR="${OUT}/AppDir"
|
||||
LIBDIR="${APPDIR}/usr/lib"
|
||||
|
||||
VERSION="0.1.0"
|
||||
ARCH="x86_64"
|
||||
|
||||
echo "Building teleportfling-gui..."
|
||||
nix develop --command bash -c "go build -o '${OUT}/teleportfling-gui' ./cmd/teleportfling-gui"
|
||||
|
||||
echo "Preparing AppDir..."
|
||||
rm -rf "${APPDIR}"
|
||||
mkdir -p "${LIBDIR}" \
|
||||
"${APPDIR}/usr/bin" \
|
||||
"${APPDIR}/usr/share/applications" \
|
||||
"${APPDIR}/usr/share/icons/hicolor/512x512/apps"
|
||||
|
||||
install -m 0755 "${OUT}/teleportfling-gui" "${APPDIR}/usr/bin/teleportfling-gui"
|
||||
install -m 0644 "${HERE}/assets/teleportfling.desktop" "${APPDIR}/usr/share/applications/teleportfling.desktop"
|
||||
install -m 0644 "${HERE}/assets/teleportfling.png" "${APPDIR}/usr/share/icons/hicolor/512x512/apps/teleportfling.png"
|
||||
# appimagetool requires the desktop file and icon in the AppDir root.
|
||||
install -m 0644 "${HERE}/assets/teleportfling.desktop" "${APPDIR}/teleportfling.desktop"
|
||||
install -m 0644 "${HERE}/assets/teleportfling.png" "${APPDIR}/teleportfling.png"
|
||||
|
||||
echo "Bundling runtime libraries..."
|
||||
# Copy every library the binary links against, resolving dependencies
|
||||
# iteratively (ldd output may reference libs that themselves need libs).
|
||||
declare -A seen
|
||||
collect_libs() {
|
||||
local bin="$1"
|
||||
while IFS= read -r lib; do
|
||||
local name
|
||||
name="$(basename "${lib}")"
|
||||
if [[ -z "${seen[${name}]:-}" && -f "${lib}" ]]; then
|
||||
seen["${name}"]=1
|
||||
install -m 0755 "${lib}" "${LIBDIR}/${name}" 2>/dev/null || true
|
||||
collect_libs "${lib}"
|
||||
fi
|
||||
done < <(ldd "${bin}" 2>/dev/null | grep -oE '/[^ ]+\.so[^ ]*' | sort -u)
|
||||
}
|
||||
collect_libs "${APPDIR}/usr/bin/teleportfling-gui"
|
||||
echo " bundled $(ls "${LIBDIR}" | wc -l) libraries"
|
||||
|
||||
# The screencast backend dlopens libpipewire at runtime; ensure it and its
|
||||
# SPA plugin libs are present (they are pulled in via the recursive ldd walk
|
||||
# above, but guard against a missing libspa here).
|
||||
if [[ -f "${LIBDIR}/libpipewire-0.3.so.0" ]]; then
|
||||
echo " bundled libpipewire-0.3.so.0"
|
||||
fi
|
||||
|
||||
echo "Writing AppRun..."
|
||||
install -m 0755 "${HERE}/packaging/AppRun" "${APPDIR}/AppRun"
|
||||
|
||||
echo "Packaging AppImage with appimagetool..."
|
||||
if [[ ! -x "${OUT}/appimagetool" ]]; then
|
||||
echo "appimagetool not found at ${OUT}/appimagetool"
|
||||
echo "Download: https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
|
||||
exit 1
|
||||
fi
|
||||
"${OUT}/appimagetool" --appimage-extract-and-run "${APPDIR}" "${OUT}/TeleportFling-${VERSION}-${ARCH}.AppImage"
|
||||
|
||||
echo "Done: ${OUT}/TeleportFling-${VERSION}-${ARCH}.AppImage"
|
||||
Reference in New Issue
Block a user