[neon/snap-packaging/elisa-snap] /: Use alsa-mixin helper and force pulseaudio.

Scarlett Moore null at kde.org
Wed Jun 26 13:38:11 BST 2024


Git commit 8bf153b1c38ecb36f863f945bba81cd793921e5f by Scarlett Moore.
Committed on 26/06/2024 at 12:38.
Pushed by scarlettmoore into branch 'master'.

Use alsa-mixin helper and force pulseaudio.

M  +38   -4    snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/elisa-snap/-/commit/8bf153b1c38ecb36f863f945bba81cd793921e5f

diff --git a/snapcraft.yaml b/snapcraft.yaml
index bb6288d..59b4bcc 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -24,6 +24,7 @@ apps:
         - screen-inhibit-control
         command-chain:
         - snap/command-chain/desktop-launch6
+        - snap/command-chain/alsa-launch
 plugs:
     gtk-gtk3-themes:
         interface: "content"
@@ -31,6 +32,7 @@ plugs:
         default-provider: "gtk-common-themes"
 environment:
   LD_LIBRARY_PATH: "/snap/kf6-core22/current/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/ffmpeg-2204/current/usr/lib:$SNAP/usr/lib:$SNAP/lib/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/elisa:/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:/usr/lib:/lib"
+  ALWAYS_USE_PULSEAUDIO: '1'
   PATH: /snap/ffmpeg-2204/current/usr/bin:/snap/kf6-core22/current/usr/bin:$SNAP/usr/bin:/usr/bin:/bin
   XDG_DATA_DIRS: $SNAP/usr/share:/snap/kf6-core22/current/usr/share:$SNAP/.local/usr/share:$SNAP/usr/share:$SNAP/data-dir
   XDG_CONFIG_HOME: $SNAP/etc/xdg:/snap/kf6-core22/current/etc/xdg:/etc/xdg
@@ -43,6 +45,8 @@ environment:
 layout:
   /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib:
     bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib
+  /usr/share/alsa:
+    bind: $SNAP/usr/share/alsa
 slots:
     session-dbus-interface:
         interface: dbus
@@ -63,6 +67,7 @@ package-repositories:
     key-server: keyserver.ubuntu.com
 parts:
     elisa:
+        after: [alsa-mixin]
         parse-info:
         - usr/share/metainfo/org.kde.elisa.appdata.xml
         plugin: cmake
@@ -72,9 +77,6 @@ parts:
         build-snaps:
         - ffmpeg-2204-sdk
         stage-packages:
-        - libasound2
-        - libasound2-plugins
-        - libasound2-data
         - libpulse0
         stage-snaps:
         - ffmpeg-2204
@@ -119,6 +121,37 @@ parts:
             craftctl default
 
             sed -i "${CRAFT_PART_INSTALL}/usr/share/applications/org.kde.elisa.desktop" -e 's|Icon=elisa$|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/elisa.svg|'
+    alsa-mixin:
+        plugin: dump
+        source: https://github.com/diddlesnaps/snapcraft-alsa.git
+        source-subdir: snapcraft-assets
+        build-packages:
+        - libasound2-dev
+        stage-packages:
+        - libasound2
+        - libasound2-plugins
+        - yad
+        stage:
+        # restrict to only audio-related files - you need to ensure
+        # that gtk3 is staged for yad to work correctly, to prompt
+        # users to connect the alsa plug or proceed with pulseaudio.
+        #
+        # This helps prevent symbol conflicts in situations where
+        # you're using a non-default library, such as those that the
+        # gnome-3-34 extension for core18 provides.
+        - etc/asound.conf
+        - snap/command-chain/alsa-launch
+        - usr/bin/yad*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libasound*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libdnsfile*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libFLAC*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libjack*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libpulse*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libsamplerate*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libspeex*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libvorbis*
+        - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio
     cleanup:
         after:
         - elisa
@@ -126,9 +159,10 @@ parts:
         build-snaps:
         - core22
         - kf6-core22
+        - ffmpeg-2204
         override-prime: |
             set -eux
-            for snap in "core22" "kf6-core22"; do
+            for snap in "core22" "kf6-core22" "ffmpeg-2204"; do
                 cd "/snap/$snap/current" && find . -type f,l -exec rm -rf "${CRAFT_PRIME}/{}" \;
             done
 


More information about the Neon-commits mailing list