fdade18e5a
- add build-scripts/bundle-sdl3-linux.sh closure walker and rpath patcher - set LDFLAGS rpath $ORIGIN/lib and BUNDLE_SDL3_LINUX on Linux SDL3 - invoke bundle script from bindist target - pin Linux SDL3 job to ubuntu-22.04 with clang-18 and patchelf - prepend lib dir in cataclysm-launcher LD_LIBRARY_PATH
53 lines
1.1 KiB
Bash
Executable File
53 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
printerr() {
|
|
echo "ERROR: $*" >&2
|
|
}
|
|
|
|
TARGET_FILE=$0
|
|
|
|
cd "$(dirname "$TARGET_FILE")" || {
|
|
printerr "Could not change directory to '$TARGET_FILE'"
|
|
exit 1
|
|
}
|
|
TARGET_FILE="$(basename "$TARGET_FILE")"
|
|
|
|
# Iterate down a (possible) chain of symlinks.
|
|
while [ -L "$TARGET_FILE" ]
|
|
do
|
|
TARGET_FILE="$(readlink "$TARGET_FILE")"
|
|
cd "$(dirname "$TARGET_FILE")" || {
|
|
printerr "Could not change directory to '$TARGET_FILE'"
|
|
exit 1
|
|
}
|
|
TARGET_FILE="$(basename "$TARGET_FILE")"
|
|
done
|
|
|
|
# Find the physical path and name of target file.
|
|
DIR=$(pwd -P)
|
|
BIN=$(basename "$0")
|
|
|
|
cd "$DIR" || {
|
|
_errcode=$?
|
|
printerr "Could not change directory to '$DIR'"
|
|
exit $_errcode
|
|
}
|
|
|
|
# If name does not match a binary or is this same script, find the right one
|
|
if [ ! -f "$BIN" ] || [ "$BIN" = "cataclysm-launcher" ]
|
|
then
|
|
BIN=
|
|
for bin in cataclysm-tiles cataclysm
|
|
do
|
|
[ -f "$bin" ] && BIN="$bin" break
|
|
done
|
|
fi
|
|
|
|
if [ "$BIN" ]
|
|
then
|
|
env LD_LIBRARY_PATH="${DIR}/lib:${DIR}:${LD_LIBRARY_PATH}" ./"${BIN}" "$@"
|
|
else
|
|
printerr "Couldn't find cataclysm game binary in '$DIR'/"
|
|
exit 1
|
|
fi
|