Skip to content

Commit f896290

Browse files
committed
Initial commit
0 parents  commit f896290

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake-build-*/
2+
*build*/
3+
.idea/
4+
squashfs-root/
5+
*.AppImage
6+
AppDir/

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# linuxdeploy-plugin-conda
2+
3+
GStreamer plugin for linuxdeploy. Copies GStreamer plugins into an AppDir, and installs an AppRun hook to make GStreamer load these instead of ones on the system.
4+
5+
6+
## Usage
7+
8+
```bash
9+
# get linuxdeploy and linuxdeploy-plugin-conda (see below for more information)
10+
# call through linuxdeploy
11+
> ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin gstreamer --output appimage --icon mypackage.png --desktop-file mypackage.desktop
12+
```

linuxdeploy-plugin-gstreamer.sh

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#! /bin/bash
2+
3+
# abort on all errors
4+
set -e
5+
6+
if [ "$DEBUG" != "" ]; then
7+
set -x
8+
fi
9+
10+
script=$(readlink -f "$0")
11+
12+
show_usage() {
13+
echo "Usage: $script --appdir <path to AppDir>"
14+
echo
15+
echo "Bundles GStreamer plugins into an AppDir"
16+
echo
17+
echo "Variables:"
18+
echo " GSTREAMER_INCLUDE_BAD_PLUGINS=\"1\" (optional; default: disabled; set to empty string or unset to disable)"
19+
echo " GSTREAMER_PLUGINS_DIR=\"...\" (optional; directory containing GStreamer plugins; default: guessed based on main distro architecture)"
20+
echo " GSTREAMER_HELPERS_DIR=\"...\" (optional; directory containing GStreamer helper tools like gst-plugin-scanner; default: guessed based on main distro architecture)"
21+
echo " GSTREAMER_VERSION=\"1.0\" (optional; default: 1.0)"
22+
}
23+
24+
while [ "$1" != "" ]; do
25+
case "$1" in
26+
--plugin-api-version)
27+
echo "0"
28+
exit 0
29+
;;
30+
--appdir)
31+
APPDIR="$2"
32+
shift
33+
shift
34+
;;
35+
--help)
36+
show_usage
37+
exit 0
38+
;;
39+
*)
40+
echo "Invalid argument: $1"
41+
echo
42+
show_usage
43+
exit 1
44+
;;
45+
esac
46+
done
47+
48+
if [ "$APPDIR" == "" ]; then
49+
show_usage
50+
exit 1
51+
fi
52+
53+
mkdir -p "$APPDIR"
54+
55+
export GSTREAMER_VERSION=${GSTREAMER_VERSION:-1.0}
56+
57+
plugins_target_dir="$APPDIR"/usr/lib/gstreamer-"$GSTREAMER_VERSION"
58+
helpers_target_dir="$APPDIR"/usr/lib/gstreamer"$GSTREAMER_VERSION"/gstreamer-"$GSTREAMER_VERSION"
59+
60+
if [ "$GSTREAMER_PLUGINS_DIR" != "" ]; then
61+
plugins_dir="${GSTREAMER_PLUGINS_DIR}"
62+
else
63+
plugins_dir=/usr/lib/$(uname -m)-linux-gnu/gstreamer-"$GSTREAMER_VERSION"
64+
fi
65+
66+
if [ "$GSTREAMER_PLUGINS_DIR" != "" ]; then
67+
helpers_dir="${GSTREAMER_PLUGINS_DIR}"
68+
else
69+
helpers_dir=/usr/lib/$(uname -m)-linux-gnu/gstreamer"$GSTREAMER_VERSION"/gstreamer-"$GSTREAMER_VERSION"
70+
fi
71+
72+
if [ ! -d "$plugins_dir" ]; then
73+
echo "Error: could not find plugins directory: $plugins_dir"
74+
exit 1
75+
fi
76+
77+
mkdir -p "$plugins_target_dir"
78+
79+
echo "Copying plugins into $plugins_target_dir"
80+
for i in "$plugins_dir"/*; do
81+
[ -d "$i" ] && continue
82+
83+
echo "Copying plugin: $i"
84+
cp "$i" "$plugins_target_dir"
85+
done
86+
87+
mkdir -p "$helpers_target_dir"
88+
89+
echo "Copying helpers in $helpers_target_dir"
90+
for i in "$helpers_dir"/*; do
91+
[ -d "$i" ] && continue
92+
93+
echo "Copying helper: $i"
94+
cp "$i" "$helpers_target_dir"
95+
done
96+
97+
echo "Installing AppRun hook"
98+
mkdir -p "$APPDIR"/apprun-hooks
99+
100+
if [ "$GSTREAMER_VERSION" == "1.0" ]; then
101+
cat > "$APPDIR"/apprun-hooks/linuxdeploy-plugin-gstreamer.sh <<\EOF
102+
#! /bin/bash
103+
104+
export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
105+
export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
106+
107+
export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
108+
export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
109+
EOF
110+
elif [ "$GSTREAMER_VERSION" == "0.10" ]; then
111+
cat > "$APPDIR"/apprun-hooks/linuxdeploy-plugin-gstreamer.sh <<\EOF
112+
#! /bin/bash
113+
114+
export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
115+
export GST_PLUGIN_SYSTEM_PATH_0_10="${APPDIR}/usr/lib/gstreamer-1.0"
116+
117+
export GST_PLUGIN_SCANNER_0_10="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
118+
export GST_PTP_HELPER_0_10="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"
119+
EOF
120+
else
121+
echo "Warning: unknown GStreamer version: $GSTREAMER_VERSION, cannot install AppRun hook"
122+
fi

0 commit comments

Comments
 (0)