Skip to content

Commit 78e81a2

Browse files
authored
Merge pull request #228 from vandah/core24-content-snaps
Add plugins through the content interface
2 parents e133354 + 803e519 commit 78e81a2

File tree

3 files changed

+78
-14
lines changed

3 files changed

+78
-14
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# If a slot doesn't define snapname it shouldn't be able to connect so this should fail.
5+
SLOT_SNAP_NAME="$(snapctl get --slot :obs-plugins snapname)"
6+
7+
PLUGINS_DIR="${SNAP_DATA}/obs-plugins"
8+
SLOT_MOUNTS="${SNAP_DATA}/obs-plugins-mounts"
9+
MOUNT_DIR="${SLOT_MOUNTS}/${SLOT_SNAP_NAME}"
10+
11+
# Create directories
12+
for DIR in $(find ${MOUNT_DIR} -type d -printf '%P\n'); do
13+
mkdir -p "${PLUGINS_DIR}/${DIR}"
14+
done
15+
16+
for FILE in $(find ${MOUNT_DIR} -not -type d -printf '%P\n'); do
17+
ln -sfr "${MOUNT_DIR}/${FILE}" "${PLUGINS_DIR}/${FILE}"
18+
done
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
SLOT_SNAP_NAME="$(snapctl get --slot :obs-plugins snapname)"
5+
6+
PLUGINS_DIR="${SNAP_DATA}/obs-plugins"
7+
SLOT_MOUNTS="${SNAP_DATA}/obs-plugins-mounts"
8+
MOUNT_DIR="${SLOT_MOUNTS}/${SLOT_SNAP_NAME}"
9+
10+
# Delete all symlinks that point into the directory of the plug that is being
11+
# disconnected and all empty directories.
12+
find "${PLUGINS_DIR}" -type l -lname "${MOUNT_DIR}"/'*' -delete
13+
find ${PLUGINS_DIR} -type d -empty -delete
14+
15+
# Restore the symlinks and directories for the other plugs that are still
16+
# connected
17+
for BASE_DIR in ${SLOT_MOUNTS}/*; do
18+
if ! [ "${BASE_DIR}" = "${MOUNT_DIR}" ]; then
19+
for DIR in $(find ${BASE_DIR} -type d -printf '%P\n'); do
20+
mkdir -p "${PLUGINS_DIR}/${DIR}"
21+
done
22+
23+
for FILE in $(find ${BASE_DIR} -not -type d -printf '%P\n'); do
24+
ln -sfr "${BASE_DIR}/${FILE}" "${PLUGINS_DIR}/${FILE}"
25+
done
26+
fi
27+
done

snap/snapcraft.yaml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ compression: lzo
1212
platforms:
1313
amd64:
1414

15+
layout:
16+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/intel-opencl:
17+
bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/intel-opencl
18+
1519
package-repositories:
1620
- type: apt
1721
ppa: obsproject/obs-studio
@@ -23,10 +27,16 @@ package-repositories:
2327
key-id: 0C0E6AF955CE463C03FC51574D098D70AFBE5E1F
2428

2529
plugs:
26-
ffmpeg-2404:
30+
intel-npu:
31+
interface: custom-device
32+
custom-device: intel-npu-device
33+
npu-libs:
34+
interface: content
35+
content: npu-libs-2404
36+
target: $SNAP/npu-libs
37+
obs-plugins:
2738
interface: content
28-
target: ffmpeg-platform
29-
default-provider: ffmpeg-2404
39+
target: $SNAP_DATA/obs-plugins-mounts
3040

3141
parts:
3242
launcher:
@@ -43,31 +53,38 @@ parts:
4353
intel-graphics:
4454
plugin: nil
4555
stage-packages:
46-
- vainfo
4756
- intel-media-va-driver-non-free
48-
- libvpl2
49-
- libvpl-dev
57+
- intel-metrics-discovery
58+
- intel-ocloc
59+
- intel-opencl-icd
60+
- libigc2
61+
- libigc-tools
62+
- libigdfcl2
63+
- libigdgmm12
64+
- libmfx1
65+
- libmfx-gen1
5066
- libva-drm2
5167
- libva-glx2
5268
- libva-wayland2
5369
- libva-x11-2
54-
- libva-dev
55-
- libmfx1
56-
- libmfx-gen1
57-
- libmfx-gen-dev
58-
- libigdgmm12
59-
- libigdgmm-dev
70+
- libvpl2
71+
- libze1
72+
- libze-intel-gpu1
73+
- ocl-icd-libopencl1
6074

6175
apps:
6276
obs-studio:
6377
command: obs-wrapper
6478
extensions: [gnome]
79+
common-id: com.obsproject.Studio
6580
environment:
6681
QT_PLUGIN_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/plugins:$QT_PLUGIN_PATH
6782
QT_QPA_PLATFORM_PLUGIN_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/plugins/platforms
68-
LD_LIBRARY_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/obs-plugins:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/obs-scripting:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$SNAP/ffmpeg-platform/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$LD_LIBRARY_PATH
69-
PATH: $SNAP/ffmpeg-platform/usr/bin:$PATH
83+
LD_LIBRARY_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/obs-plugins:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/obs-scripting:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$SNAP_DATA/obs-plugins/lib/:$SNAP_DATA/obs-plugins/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/intel-opencl:$SNAP/npu-libs
7084
LIBVA_DRIVERS_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/dri:$LIBVA_DRIVERS_PATH
85+
OBS_PLUGINS_PATH: $SNAP_DATA/obs-plugins/plugins/
86+
OBS_PLUGINS_DATA_PATH: $SNAP_DATA/obs-plugins/data/
87+
OCL_ICD_VENDORS: $SNAP/etc/OpenCL/vendors
7188
plugs:
7289
- alsa
7390
- audio-playback
@@ -98,3 +115,5 @@ apps:
98115
- upower-observe
99116
- wayland
100117
- x11
118+
- intel-npu
119+
- npu-libs

0 commit comments

Comments
 (0)