Closes: #15807 by preloading API-related libraries for 3P plug-ins sake. This will only work if the .appimage is run normally (without extract), because when extracted its APPDIR can be placed on dirs with spaces unsupported by LD. It also requires plug-ins to be built with the Debian used for the AppImage. But there is nothing new under the sun, this rule is valid for all packages.
44 lines
1.1 KiB
Bash
44 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ -z "$APPDIR" ]; then
|
|
export APPDIR="$(dirname -- "$(readlink -f -- "${0}")")"
|
|
echo "Running without type2-runtime. AppDir is $APPDIR"
|
|
fi
|
|
|
|
|
|
## Minimum runtime paths. See: #13527, #13603 and #15807
|
|
export PATH="${APPDIR}/usr/bin/:$PATH"
|
|
unset LD_PRELOAD
|
|
for lib in "${APPDIR}"/usr/lib*/*.so* "${APPDIR}"/usr/lib/*linux-gnu/*.so*; do
|
|
case "$lib" in
|
|
*" "*)
|
|
#LD does not support spaces in LD_PRELOAD
|
|
break
|
|
;;
|
|
*libbabl*|*libgegl*|*libgimp*)
|
|
export LD_PRELOAD="$LD_PRELOAD${LD_PRELOAD:+:}$lib"
|
|
;;
|
|
esac
|
|
done
|
|
unset LD_LIBRARY_PATH
|
|
export XDG_DATA_DIRS="${APPDIR}/usr/share/:$XDG_DATA_DIRS"
|
|
|
|
|
|
## Other needed runtime paths (added by 3_dist-gimp-goappimage.sh)
|
|
### We need to run on APPDIR due to the bundled LD linux interpreter so
|
|
### relative file paths on CLI are converted to absolute (OWD). See: #13636
|
|
export OWD="$PWD"
|
|
cd "$APPDIR"
|
|
i="$#"
|
|
while [ "$i" -gt 0 ]; do
|
|
arg=$1
|
|
# if arg does NOT start with slash or dash, then test for existence from $OWD
|
|
if [ "$arg" = "${arg#/}" -a "$arg" = "${arg#-}" -a -e "$OWD/$arg" ] ; then
|
|
arg="$OWD/$arg"
|
|
fi
|
|
set -- "$@" "$arg"
|
|
shift
|
|
i=$(($i-1))
|
|
done
|