Skip to content

Commit

Permalink
Update README.md, make hooks identifiable in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Feb 5, 2025
1 parent d3dc7a8 commit e7848fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
10 changes: 9 additions & 1 deletion cmake/linux/apprun-hooks/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
When placed in `LMMS.AppDir/apprun-hooks`, linuxdeploy will automatically add scripts to startup.
# AppRun Hooks

Scripts placed in this directory will automatically be bundled into AppImages
(e.g. `LMMS.AppDir/apprun-hooks`) and executed immediately before lmms.

Quoting:

> "Sometimes it's important to perform actions before running the actual app. Some plugins might have to set e.g.,
> environment variables to work properly."
See also: https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system#apprun-hooks
9 changes: 5 additions & 4 deletions cmake/linux/apprun-hooks/carla-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Workaround nuances with carla being an optional-yet-hard-linked plugin
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
ME="$( basename "${BASH_SOURCE[0]}")"
CARLA_LIB="libcarla_native-plugin.so"
KNOWN_LOCATIONS=("lib" "lib64")

Expand All @@ -17,12 +18,12 @@ if command -v carla > /dev/null 2>&1; then
# Add library to LD_PRELOAD so libcarlabase.so can find it
carla_lib_found=true
export LD_PRELOAD="$CARLA_PREFIX/$lib/carla/${CARLA_LIB}:$LD_PRELOAD"
echo "Carla appears to be installed on this system at $CARLA_PREFIX/$lib so we'll use it." >&2
echo "[$ME] Carla appears to be installed on this system at $CARLA_PREFIX/$lib/carla so we'll use it." >&2
break
fi
done
else
echo "Carla does not appear to be installed. That's OK, please ignore any related library errors." >&2
echo "[$ME] Carla does not appear to be installed. That's OK, please ignore any related library errors." >&2
fi

# Additional workarounds for library conflicts
Expand All @@ -43,13 +44,13 @@ if [ "$carla_lib_found" = true ]; then
conflict_sys="$("$cmd" -p |grep "$(arch)" |grep "$conflict" |head -n 1 |awk '{print $4}')"
if [ -e "$conflict_sys" ]; then
# Add library to LD_PRELOAD so lmms can find it over its bundled version
echo "Preferring the system's $conflict over the version we bundle." >&2
echo "[$ME] Preferring the system's $conflict over the version we bundle." >&2
export LD_PRELOAD="$conflict_sys:$LD_PRELOAD"
fi
fi
fi
done
else
echo "Unable to locate ldconfig, skipping workaround for" "${KNOWN_CONFLICTS[@]}" >&2
echo "[$ME] Unable to locate ldconfig, skipping workaround for" "${KNOWN_CONFLICTS[@]}" >&2
fi
fi
5 changes: 3 additions & 2 deletions cmake/linux/apprun-hooks/jack-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

# Workaround crash when jack is missing by providing a dummy version
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
ME="$( basename "${BASH_SOURCE[0]}")"
if ldconfig -p | grep libjack.so.0 > /dev/null 2>&1; then
echo "Jack appears to be installed on this system, so we'll use it." >&2
echo "[$ME] Jack appears to be installed on this system, so we'll use it." >&2
else
echo "Jack does not appear to be installed. That's OK, we'll use a dummy version instead." >&2
echo "[$ME] Jack does not appear to be installed. That's OK, we'll use a dummy version instead." >&2
export LD_LIBRARY_PATH=$DIR/usr/lib/lmms/optional:$LD_LIBRARY_PATH
fi
4 changes: 2 additions & 2 deletions cmake/linux/apprun-hooks/vbox-hook.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

ME="$( basename "${BASH_SOURCE[0]}")"
# Workaround crash in VirtualBox when hardware rendering is enabled
if lsmod |grep vboxguest > /dev/null 2>&1; then
echo "VirtualBox detected. Forcing libgl software rendering." >&2
echo "[$ME] VirtualBox detected. Forcing libgl software rendering." >&2
export LIBGL_ALWAYS_SOFTWARE=1;
fi

0 comments on commit e7848fc

Please sign in to comment.