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
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# AppImage AppRun: locate bundled libraries and launch the GUI.
|
||||
HERE="$(dirname "$(readlink -f "$0")")"
|
||||
export LD_LIBRARY_PATH="${HERE}/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
exec "${HERE}/usr/bin/teleportfling-gui" "$@"
|
||||
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"
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a .deb package of TeleportFling for Debian/Ubuntu.
|
||||
#
|
||||
# The binary is built with cgo; runtime libraries (libturbojpeg, libpipewire,
|
||||
# and the GLFW/GL stack for the GUI) are declared as Debian package
|
||||
# dependencies so the .deb works on a stock Debian/Ubuntu install. Output:
|
||||
# dist/teleportfling_<version>_amd64.deb
|
||||
#
|
||||
# Usage:
|
||||
# ./packaging/deb.sh
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
OUT="${HERE}/dist"
|
||||
ROOT="${OUT}/deb-root"
|
||||
|
||||
VERSION="0.1.0"
|
||||
ARCH="amd64"
|
||||
PKG_NAME="teleportfling"
|
||||
|
||||
echo "Building teleportfling and teleportfling-gui..."
|
||||
nix develop --command bash -c "go build -o '${OUT}/teleportfling' ./cmd/teleportfling && go build -o '${OUT}/teleportfling-gui' ./cmd/teleportfling-gui"
|
||||
|
||||
echo "Assembling .deb root..."
|
||||
rm -rf "${ROOT}"
|
||||
mkdir -p "${ROOT}/DEBIAN" \
|
||||
"${ROOT}/usr/bin" \
|
||||
"${ROOT}/usr/share/applications" \
|
||||
"${ROOT}/usr/share/icons/hicolor/512x512/apps"
|
||||
|
||||
install -m 0755 "${OUT}/teleportfling" "${ROOT}/usr/bin/teleportfling"
|
||||
install -m 0755 "${OUT}/teleportfling-gui" "${ROOT}/usr/bin/teleportfling-gui"
|
||||
install -m 0644 "${HERE}/assets/teleportfling.desktop" "${ROOT}/usr/share/applications/teleportfling.desktop"
|
||||
install -m 0644 "${HERE}/assets/teleportfling.png" "${ROOT}/usr/share/icons/hicolor/512x512/apps/teleportfling.png"
|
||||
|
||||
# Debian package control file.
|
||||
cat > "${ROOT}/DEBIAN/control" <<EOF
|
||||
Package: ${PKG_NAME}
|
||||
Version: ${VERSION}
|
||||
Section: video
|
||||
Priority: optional
|
||||
Architecture: ${ARCH}
|
||||
Maintainer: Pete Edley <[email protected]>
|
||||
Depends: libjpeg-turbo8 (>= 2.0), libpipewire-0.3-0 (>= 0.3), libgl1, libglx0,
|
||||
libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0,
|
||||
libx11-6, libxrandr2, libxi6, libxcursor1, libxinerama1, libxxf86vm1,
|
||||
libxrender1, libxext6, libxfixes3
|
||||
Description: Stream a screen and audio to OBS Teleport receivers
|
||||
Standalone Linux sender for the OBS Teleport protocol. Captures a Wayland
|
||||
screen and system audio, encodes video to JPEG, and streams them over TCP
|
||||
so OBS with the obs-teleport plugin can discover and display the stream.
|
||||
.
|
||||
Provides a headless CLI (teleportfling) and a desktop GUI with system tray
|
||||
(teleportfling-gui).
|
||||
Homepage: http://homeserver:3050/pedley/TeleportFling
|
||||
EOF
|
||||
|
||||
echo "Building .deb..."
|
||||
nix shell nixpkgs#dpkg --command dpkg-deb --build --root-owner-group "${ROOT}" "${OUT}/${PKG_NAME}_${VERSION}_${ARCH}.deb"
|
||||
|
||||
echo "Done: ${OUT}/${PKG_NAME}_${VERSION}_${ARCH}.deb"
|
||||
Reference in New Issue
Block a user