mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-05 16:22:26 -08:00
fix(linux): bundle PulseAudio for CEF (#1500)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixes # #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
This commit is contained in:
4 files changed
+35
No files matched your search
@@ -173,6 +173,8 @@
|
||||
openssl
|
||||
dbus
|
||||
dbus.dev
|
||||
libpulseaudio
|
||||
alsa-lib
|
||||
libayatana-appindicator
|
||||
gst_all_1.gstreamer
|
||||
gst_all_1.gst-plugins-base
|
||||
|
||||
@@ -18,6 +18,7 @@ android-sdk = "22.0"
|
||||
"apt:build-essential" = "latest"
|
||||
"apt:file" = "latest"
|
||||
"apt:libayatana-appindicator3-dev" = "latest"
|
||||
"apt:libpulse0" = "latest"
|
||||
"apt:libgtk-3-dev" = "latest"
|
||||
"apt:librsvg2-dev" = "latest"
|
||||
"apt:libsoup-3.0-dev" = "latest"
|
||||
|
||||
@@ -31,6 +31,7 @@ overrides:
|
||||
- libdrm2
|
||||
- libxkbcommon0
|
||||
- libasound2
|
||||
- libpulse0
|
||||
- libcups2
|
||||
- xdg-utils
|
||||
- xwayland
|
||||
@@ -44,6 +45,7 @@ overrides:
|
||||
- libdrm
|
||||
- libxkbcommon
|
||||
- alsa-lib
|
||||
- pulseaudio-libs
|
||||
- cups-libs
|
||||
- xdg-utils
|
||||
- xorg-x11-server-Xwayland
|
||||
|
||||
@@ -74,6 +74,35 @@ stage_appindicator() {
|
||||
done
|
||||
}
|
||||
|
||||
# Bundle the PulseAudio client and its audio dependencies for CEF.
|
||||
stage_pulseaudio() {
|
||||
local dest="$1" main
|
||||
mkdir -p "$dest"
|
||||
main="$(ldconfig -p 2>/dev/null | awk '$1=="libpulse.so.0"{v=$NF} END{print v}')"
|
||||
[ -n "$main" ] || main="$(find /usr/lib /usr/lib64 /lib -name libpulse.so.0 2>/dev/null | sort | tail -n1)"
|
||||
if [ -z "$main" ] || [ ! -e "$main" ]; then
|
||||
echo "warning: libpulse.so.0 not found; PulseAudio disabled in the AppImage" >&2
|
||||
return 0
|
||||
fi
|
||||
local -A seen=()
|
||||
local -a queue=("$main")
|
||||
local lib dep
|
||||
while [ "${#queue[@]}" -gt 0 ]; do
|
||||
lib="${queue[-1]}"
|
||||
queue=("${queue[@]:0:${#queue[@]}-1}")
|
||||
[ -n "$lib" ] && [ -e "$lib" ] || continue
|
||||
seen["$lib"]=1
|
||||
while read -r dep; do
|
||||
[ -n "$dep" ] && [ -z "${seen[$dep]:-}" ] || continue
|
||||
seen["$dep"]=1
|
||||
queue+=("$dep")
|
||||
done < <(ldd "$lib" 2>/dev/null | awk '/=>/ {print $3}' | grep -iE 'pulse|sndfile|asyncns|FLAC|ogg|vorbis|opus|mpg123|mp3lame|lame|speexdsp' || true)
|
||||
done
|
||||
for lib in "${!seen[@]}"; do
|
||||
cp -Lf "$lib" "$dest/$(basename "$lib")"
|
||||
done
|
||||
}
|
||||
|
||||
write_desktop() {
|
||||
cat > "$1" <<EOF
|
||||
[Desktop Entry]
|
||||
@@ -130,6 +159,7 @@ if [ -n "$APPIMAGETOOL_CMD" ]; then
|
||||
APPDIR="$WORK/Sable.AppDir"
|
||||
stage_runtime "$APPDIR/usr/bin"
|
||||
stage_appindicator "$APPDIR/usr/bin"
|
||||
stage_pulseaudio "$APPDIR/usr/bin"
|
||||
# nosuid AppImage mount: drop setuid chrome-sandbox, use the namespace sandbox.
|
||||
rm -f "$APPDIR/usr/bin/chrome-sandbox"
|
||||
write_desktop "$APPDIR/sable.desktop"
|
||||
|
||||
Reference in new issue
Block a user