mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-30 07:37:38 +00:00
The .deb post-processing scripts each unpacked the whole package with dpkg-deb -R and rebuilt it with -Zxz, recompressing the ~340 MB payload to change a few control lines. The release desktop leg paid that three times on x64 and four on arm64, before the one step that really edits the payload (StartupWMClass). scripts/deb-control.sh swaps just control.tar inside the ar archive and copies data.tar through. relax-deb-libicu.sh, add-deb-libegl-dep.sh and add-deb-gstreamer-deps.sh use it; add-deb-libegl-dep.sh finds the arm64 skiko with a file listing instead of unpacking. On the 1.18.0 x64 .deb the release chain goes from 156 s to 51 s, the output matches the old chain (control, maintainer scripts, payload modes/owners/sizes), and apt, gdebi and a real dpkg install accept it. Also fixed: - relax-deb-libicu.sh and add-deb-libegl-dep.sh printed "skip" and exited 0 on a missing file, so an unmatched glob shipped an unpatched .deb. They now fail, like add-deb-gstreamer-deps.sh already did. - smoke-test-desktop.yml says it tests the .deb release ships but never added the GStreamer deps; it does now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtLex2qj7QL6sJX3BCswqh
79 lines
3.0 KiB
Bash
Executable File
79 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Declare the GStreamer packages the desktop app plays video and audio with in a
|
|
# jpackage-built .deb.
|
|
#
|
|
# Why this is needed: the media player (kdroidFilter ComposeMediaPlayer) ships a
|
|
# small native library that drives the system's GStreamer at runtime. It is
|
|
# unpacked from a jar when the first video plays, so neither jpackage's
|
|
# dpkg-shlibdeps pass nor anything else sees it, and the .deb declared no
|
|
# GStreamer at all. On a system without the plugins every video showed
|
|
# "Can't play this video — Failed to create native player".
|
|
#
|
|
# What the player uses, and where it comes from:
|
|
# playbin, appsink, volume, videoconvert gstreamer1.0-plugins-base
|
|
# souphttpsrc, qtdemux, HLS, autoaudiosink gstreamer1.0-plugins-good
|
|
# H.264 / AAC decoders gstreamer1.0-libav
|
|
# base and good are in Debian and Ubuntu main, so they are hard Depends.
|
|
# libav is in Ubuntu universe, so it is a Recommends: apt installs it by
|
|
# default, and a system without universe can still install the app.
|
|
#
|
|
# Neither jpackage nor the Compose Multiplatform DSL exposes a way to add to
|
|
# the auto-generated Depends, so we rewrite the .deb after the fact (same
|
|
# approach as scripts/relax-deb-libicu.sh and scripts/add-deb-libegl-dep.sh).
|
|
#
|
|
# Usage: add-deb-gstreamer-deps.sh <path-to-deb> [<path-to-deb> ...]
|
|
set -euo pipefail
|
|
|
|
source "$(dirname "${BASH_SOURCE[0]}")/deb-control.sh"
|
|
|
|
DEPENDS='gstreamer1.0-plugins-base, gstreamer1.0-plugins-good'
|
|
RECOMMENDS='gstreamer1.0-libav'
|
|
|
|
add_gstreamer() {
|
|
local control="$1"
|
|
|
|
if grep -qE '(^|[ ,])gstreamer1\.0-plugins-base([ ,]|$)' "$control"; then
|
|
return
|
|
fi
|
|
|
|
# A binary control file is one stanza; jpackage's template can end in a blank
|
|
# line (its Homepage slot), after which an appended field would start a second.
|
|
sed -i '/^[[:space:]]*$/d' "$control"
|
|
|
|
# jpackage writes Depends as one physical line, possibly empty
|
|
# ("Depends: " when it found nothing to depend on).
|
|
if grep -qE '^Depends:[[:space:]]*[^[:space:]]' "$control"; then
|
|
sed -i -E "s/^(Depends:.*[^,[:space:]])[[:space:]]*\$/\\1, ${DEPENDS}/" "$control"
|
|
elif grep -qE '^Depends:' "$control"; then
|
|
sed -i -E "s/^Depends:.*\$/Depends: ${DEPENDS}/" "$control"
|
|
else
|
|
echo "Depends: ${DEPENDS}" >> "$control"
|
|
fi
|
|
|
|
if grep -qE '^Recommends:' "$control"; then
|
|
sed -i -E "s/^(Recommends:.*[^,[:space:]])[[:space:]]*\$/\\1, ${RECOMMENDS}/" "$control"
|
|
else
|
|
echo "Recommends: ${RECOMMENDS}" >> "$control"
|
|
fi
|
|
}
|
|
|
|
# An unmatched glob reaches us as the literal pattern: fail rather than ship a .deb without the deps.
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "error: no .deb given" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for deb in "$@"; do
|
|
if [[ ! -f "$deb" ]]; then
|
|
echo "error: not a file: $deb" >&2
|
|
exit 1
|
|
fi
|
|
|
|
deb_edit_control "$deb" add_gstreamer
|
|
if [[ $DEB_CONTROL_CHANGED -eq 1 ]]; then
|
|
echo "Added GStreamer deps: $deb"
|
|
else
|
|
echo "GStreamer already declared, leaving as-is: $deb"
|
|
fi
|
|
done
|