Skip to content

Commit 23e9014

Browse files
authored
Merge pull request #3 from Stivius/master
Use linuxdeploy to deploy dependencies for gstreamer plugins
2 parents f896290 + 8ba9cc4 commit 23e9014

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

linuxdeploy-plugin-gstreamer.sh

+42-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ show_usage() {
1414
echo
1515
echo "Bundles GStreamer plugins into an AppDir"
1616
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)"
17+
echo "Required variables:"
18+
echo " LINUXDEPLOY=\".../linuxdeploy\" path to linuxdeploy (e.g., AppImage); set automatically when plugin is run directly by linuxdeploy"
19+
echo
20+
echo "Optional variables:"
21+
echo " GSTREAMER_INCLUDE_BAD_PLUGINS=\"1\" (default: disabled; set to empty string or unset to disable)"
22+
echo " GSTREAMER_PLUGINS_DIR=\"...\" (directory containing GStreamer plugins; default: guessed based on main distro architecture)"
23+
echo " GSTREAMER_HELPERS_DIR=\"...\" (directory containing GStreamer helper tools like gst-plugin-scanner; default: guessed based on main distro architecture)"
24+
echo " GSTREAMER_VERSION=\"1.0\" (default: 1.0)"
2225
}
2326

2427
while [ "$1" != "" ]; do
@@ -50,9 +53,23 @@ if [ "$APPDIR" == "" ]; then
5053
exit 1
5154
fi
5255

56+
if ! which patchelf &>/dev/null && ! type patchelf &>/dev/null; then
57+
echo "Error: patchelf not found"
58+
echo
59+
show_usage
60+
exit 2
61+
fi
62+
63+
if [[ "$LINUXDEPLOY" == "" ]]; then
64+
echo "Error: \$LINUXDEPLOY not set"
65+
echo
66+
show_usage
67+
exit 3
68+
fi
69+
5370
mkdir -p "$APPDIR"
5471

55-
export GSTREAMER_VERSION=${GSTREAMER_VERSION:-1.0}
72+
export GSTREAMER_VERSION="${GSTREAMER_VERSION:-1.0}"
5673

5774
plugins_target_dir="$APPDIR"/usr/lib/gstreamer-"$GSTREAMER_VERSION"
5875
helpers_target_dir="$APPDIR"/usr/lib/gstreamer"$GSTREAMER_VERSION"/gstreamer-"$GSTREAMER_VERSION"
@@ -63,8 +80,8 @@ else
6380
plugins_dir=/usr/lib/$(uname -m)-linux-gnu/gstreamer-"$GSTREAMER_VERSION"
6481
fi
6582

66-
if [ "$GSTREAMER_PLUGINS_DIR" != "" ]; then
67-
helpers_dir="${GSTREAMER_PLUGINS_DIR}"
83+
if [ "$GSTREAMER_HELPERS_DIR" != "" ]; then
84+
helpers_dir="${GSTREAMER_HELPERS_DIR}"
6885
else
6986
helpers_dir=/usr/lib/$(uname -m)-linux-gnu/gstreamer"$GSTREAMER_VERSION"/gstreamer-"$GSTREAMER_VERSION"
7087
fi
@@ -84,6 +101,15 @@ for i in "$plugins_dir"/*; do
84101
cp "$i" "$plugins_target_dir"
85102
done
86103

104+
"$LINUXDEPLOY" --appdir "$APPDIR"
105+
106+
for i in "$plugins_target_dir"/*; do
107+
[ -d "$i" ] && continue
108+
109+
echo "Manually setting rpath for $i"
110+
patchelf --set-rpath '$ORIGIN/..:$ORIGIN' "$i"
111+
done
112+
87113
mkdir -p "$helpers_target_dir"
88114

89115
echo "Copying helpers in $helpers_target_dir"
@@ -94,6 +120,13 @@ for i in "$helpers_dir"/*; do
94120
cp "$i" "$helpers_target_dir"
95121
done
96122

123+
for i in "$helpers_target_dir"/*; do
124+
[ -d "$i" ] && continue
125+
126+
echo "Manually setting rpath for $i"
127+
patchelf --set-rpath '$ORIGIN/../..' "$i"
128+
done
129+
97130
echo "Installing AppRun hook"
98131
mkdir -p "$APPDIR"/apprun-hooks
99132

@@ -103,6 +136,7 @@ if [ "$GSTREAMER_VERSION" == "1.0" ]; then
103136
104137
export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no"
105138
export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
139+
export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0"
106140
107141
export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"
108142
export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"

0 commit comments

Comments
 (0)