CI / Formatting, tests and builds (push) Successful in 3m19s
Code en anglais (#83): identifiants, noms de fichiers et de modules, commentaires, journal (champ event, noms d'événements anglais), messages d'erreur, commandes Tauri, types générés, clés de traduction, sorties de rustscreen-cli, scripts, Nix et CI. Les textes affichés passent toujours par locales/ (français et anglais); la documentation et les commits restent en français. AGENTS.md porte la règle. Ce qui est déjà écrit chez l'utilisateur se relit: anciens noms de champs des réglages (alias serde), reglages.json à défaut de settings.json, anciennes clés localStorage dont l'identifiant d'appareil, jeton de restauration du portail, anciennes options de la ligne de commande, ancien argument du démarrage automatique. rustscreen ouvre l'application de bureau (#84): la ligne de commande devient rustscreen-cli. Le paquet Nix par défaut construit l'application (interface pnpm, Tauri avec WebKitGTK et PipeWire, icône de barre système), avec rustscreen-cli et le viewer. Début du jalon 0.6.0, pas encore essayé en vrai: miroir du viewer (#29), barres qui s'effacent en fenêtre et en plein écran (#31, #81), confirmation avant de quitter pendant un partage (#43), démarrage automatique caché dans la barre système et fichier .desktop réparé au lancement (#32). Closes #83, #84 Refs #29, #31, #32, #43, #81 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
122 lines
4.6 KiB
Bash
Executable File
122 lines
4.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# Assembles a rustscreen AppImage: binary, viewer, icon, .desktop file.
|
|
#
|
|
# ./scripts/build-appimage.sh [output-dir]
|
|
#
|
|
# The AppImage depends on glibc and libpipewire-0.3: the binary links libvpx
|
|
# statically, and the viewer is served from the AppDir. libpipewire is
|
|
# deliberately not bundled: the client must speak the version of the machine's
|
|
# PipeWire daemon, and every Wayland distribution provides it.
|
|
#
|
|
# appimagetool is downloaded and extracted without FUSE: the build machine does
|
|
# not always have /dev/fuse, and `--appimage-extract` does not need it.
|
|
set -eu
|
|
|
|
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
|
OUT=${1:-"$ROOT/dist-appimage"}
|
|
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' "$ROOT/Cargo.toml" | head -1)
|
|
ARCH=$(uname -m)
|
|
|
|
# appimagetool is pinned: a "continuous" URL would change underneath us and
|
|
# break the package's reproducibility without anyone asking for it.
|
|
TOOL_VERSION=1.9.0
|
|
TOOL_SHA256=46fdd785094c7f6e545b61afcfb0f3d98d8eab243f644b4b17698c01d06083d1
|
|
TOOL_URL="https://github.com/AppImage/appimagetool/releases/download/${TOOL_VERSION}/appimagetool-${ARCH}.AppImage"
|
|
CACHE=${RUSTSCREEN_CACHE:-"$ROOT/.cache/appimage"}
|
|
|
|
# `CARGO_TARGET_DIR` can move the target out of the repository (the release
|
|
# pipeline uses it to reuse its cache). The script honours it, and
|
|
# `RUSTSCREEN_BIN` points to a binary already built elsewhere.
|
|
TARGET_DIR=${CARGO_TARGET_DIR:-"$ROOT/target"}
|
|
BIN=${RUSTSCREEN_BIN:-"$TARGET_DIR/release/rustscreen-cli"}
|
|
VIEWER="$ROOT/apps/viewer/dist"
|
|
ICON="$ROOT/assets/rustscreen-256.png"
|
|
DESKTOP="$ROOT/assets/rustscreen.desktop"
|
|
|
|
say() { printf '\n== %s\n' "$*"; }
|
|
|
|
say "Checks"
|
|
# `file` is a standard prerequisite on distributions, but not in every
|
|
# container image: appimagetool uses it to find the binary's architecture, and
|
|
# fails with an obscure message when it is missing.
|
|
for tool in file desktop-file-validate; do
|
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
echo "command '$tool' missing: install the file and desktop-file-utils packages" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
if [ ! -x "$BIN" ]; then
|
|
echo "binary missing: build it first with" >&2
|
|
echo " cargo build --release -p rs-session --features pipewire --bin rustscreen-cli" >&2
|
|
exit 1
|
|
fi
|
|
if [ ! -f "$VIEWER/index.html" ]; then
|
|
echo "viewer missing: build it first with" >&2
|
|
echo " npm --prefix apps/viewer ci && npm --prefix apps/viewer run build" >&2
|
|
exit 1
|
|
fi
|
|
if [ ! -f "$ICON" ]; then
|
|
"$ROOT/scripts/make-icon.py" "$ICON"
|
|
fi
|
|
|
|
say "appimagetool $TOOL_VERSION"
|
|
mkdir -p "$CACHE"
|
|
TOOL="$CACHE/appimagetool-$TOOL_VERSION.AppImage"
|
|
if [ ! -x "$TOOL" ]; then
|
|
curl -sSL -o "$TOOL" "$TOOL_URL"
|
|
chmod +x "$TOOL"
|
|
fi
|
|
# The checksum is verified even when the file comes from the cache: a
|
|
# download truncated last time shows up here, not three steps later as an
|
|
# incomprehensible mksquashfs error.
|
|
ACTUAL=$(sha256sum "$TOOL" | cut -d' ' -f1)
|
|
if [ "$ACTUAL" != "$TOOL_SHA256" ]; then
|
|
echo "unexpected checksum for appimagetool: $ACTUAL" >&2
|
|
exit 1
|
|
fi
|
|
TOOL_DIR="$CACHE/appimagetool-$TOOL_VERSION"
|
|
if [ ! -x "$TOOL_DIR/squashfs-root/AppRun" ]; then
|
|
rm -rf "$TOOL_DIR"
|
|
mkdir -p "$TOOL_DIR"
|
|
(cd "$TOOL_DIR" && "$TOOL" --appimage-extract >/dev/null 2>&1)
|
|
fi
|
|
|
|
say "AppDir"
|
|
APPDIR="$OUT/rustscreen.AppDir"
|
|
rm -rf "$APPDIR"
|
|
install -d "$APPDIR/usr/bin" \
|
|
"$APPDIR/usr/share/rustscreen/viewer" \
|
|
"$APPDIR/usr/share/icons/hicolor/256x256/apps" \
|
|
"$APPDIR/usr/share/applications"
|
|
install -m755 "$BIN" "$APPDIR/usr/bin/rustscreen-cli"
|
|
cp -a "$VIEWER/." "$APPDIR/usr/share/rustscreen/viewer/"
|
|
install -m644 "$ICON" "$APPDIR/rustscreen.png"
|
|
install -m644 "$ICON" "$APPDIR/usr/share/icons/hicolor/256x256/apps/rustscreen.png"
|
|
install -m644 "$DESKTOP" "$APPDIR/rustscreen.desktop"
|
|
install -m644 "$DESKTOP" "$APPDIR/usr/share/applications/rustscreen.desktop"
|
|
|
|
# AppRun: a package cannot assume where it is mounted, so the viewer path is
|
|
# computed at runtime.
|
|
cat >"$APPDIR/AppRun" <<'APPRUN'
|
|
#!/bin/sh
|
|
HERE=$(dirname "$(readlink -f "$0")")
|
|
exec "$HERE/usr/bin/rustscreen-cli" --viewer "$HERE/usr/share/rustscreen/viewer" "$@"
|
|
APPRUN
|
|
chmod 755 "$APPDIR/AppRun"
|
|
|
|
say "AppImage"
|
|
TARGET="$OUT/rustscreen-${VERSION}-${ARCH}.AppImage"
|
|
mkdir -p "$OUT"
|
|
# --no-appstream: no metainfo file, so no metadata check that would fail for a
|
|
# reason unrelated to the package.
|
|
# appimagetool delegates to `desktop-file-validate` and `mksquashfs`, shipped in
|
|
# its own extraction: they are put on the PATH rather than requiring two more
|
|
# system packages.
|
|
PATH="$TOOL_DIR/squashfs-root/usr/bin:$PATH" \
|
|
ARCH="$ARCH" "$TOOL_DIR/squashfs-root/AppRun" --no-appstream "$APPDIR" "$TARGET" >/dev/null
|
|
|
|
say "Result"
|
|
ls -l "$TARGET" | awk '{printf "%s %s\n", $5, $9}'
|
|
echo "test: $TARGET --version"
|
|
echo "run: $TARGET --synthetic --port 8099"
|