Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++

Linux package: OpenSceneGraph's plugins in it, so the game reads its images on any distribution

Alan Saunders573f611ea86a
diff --git a/isowind/linux/isowind.sh b/isowind/linux/isowind.sh
index 17f1804..8f8dda6 100755
--- a/isowind/linux/isowind.sh
+++ b/isowind/linux/isowind.sh
@@ -183,6 +183,9 @@ play() {
# Xbox controllers through the kernel's driver, not SDL's own: SDL's skips one it can't open (a Bluetooth one,
# whose hidraw only root reads) when it has another with the same ids (Sunshine's virtual one, left after a stream)
export SDL_JOYSTICK_HIDAPI_XBOX=${SDL_JOYSTICK_HIDAPI_XBOX:-0}
+ # OpenSceneGraph's plugins (images, fonts, models) from the package's osgPlugins folder, before any the system has:
+ # another OSG's plugins load that OSG too, and the engine gets no image readers
+ export OSG_LIBRARY_PATH="$ROOT/engine/usr/lib${OSG_LIBRARY_PATH:+:$OSG_LIBRARY_PATH}"
# shellcheck disable=SC2086
exec "$ENGINE/openmw" --config "$ROOT/profiles/$LOOK" $CONNECT $SKIP_MENU ${SAVE:+"--load-savegame=$SAVE"} ${CHARACTER:+"--character=$CHARACTER"} ${SERVER_CHARACTER:+"--server-character=$SERVER_CHARACTER"}
}
diff --git a/isowind/linux/package.sh b/isowind/linux/package.sh
index 06f045d..f7833e1 100755
--- a/isowind/linux/package.sh
+++ b/isowind/linux/package.sh
@@ -87,8 +87,30 @@ if [ -d "$OUT/server/CoreScripts" ]; then
find "$OUT/server/CoreScripts" -mindepth 1 -maxdepth 1 ! -name data -exec rm -rf {} +
fi
-# Engine: engine/usr/bin with its config, settings defaults and resources beside it, libraries in engine/usr/lib
-linuxdeploy --appdir "$OUT/engine" -e "$BUILD/openmw" -e "$BUILD/tes3mp-server" -e "$BUILD/openmw-iniimporter"
+# OpenSceneGraph's plugins the engine reads its images, fonts and models with (USED_OSG_PLUGINS in CMakeLists.txt).
+# OSG loads them at run time, so linuxdeploy doesn't see them: they come from beside the libosgDB the engine runs
+# with, as CMake finds them, into engine/usr/lib/osgPlugins-<version>, where isowind.sh points OSG. Without them OSG
+# would look in the build machine's folder for them, and on another distribution find none, or its own OSG's, which
+# load that OSG beside the bundled one and give the engine no image readers
+OSGDB=$(ldd "$BUILD/openmw" | awk '/libosgDB\.so/ { print $3; exit }')
+OSG_PLUGINS=
+for d in "${OSGDB%/*}"/osgPlugins-*; do if [ -d "$d" ]; then OSG_PLUGINS=$d; break; fi; done
+[ -n "$OSG_PLUGINS" ] || { echo "error: no osgPlugins folder beside $OSGDB" >&2; exit 1; }
+mkdir -p "$OUT/engine/usr/lib/${OSG_PLUGINS##*/}"
+for plugin in $(sed -n '/^set(USED_OSG_PLUGINS/,/)/p' "$SRC/CMakeLists.txt" | grep -o 'osgdb_[a-z_]*'); do
+ # (one whose libraries this machine hasn't, such as Collada's for osgdb_dae on Arch, can't load here either)
+ if ldd "$OSG_PLUGINS/$plugin.so" | grep -q 'not found'; then
+ echo "warning: $plugin left out, as this machine hasn't all its libraries:" \
+ "$(ldd "$OSG_PLUGINS/$plugin.so" | awk '/not found/ { printf "%s ", $1 }')" >&2
+ continue
+ fi
+ cp "$OSG_PLUGINS/$plugin.so" "$OUT/engine/usr/lib/${OSG_PLUGINS##*/}/"
+done
+
+# Engine: engine/usr/bin with its config, settings defaults and resources beside it, libraries in engine/usr/lib (the
+# plugins' too)
+linuxdeploy --appdir "$OUT/engine" -e "$BUILD/openmw" -e "$BUILD/tes3mp-server" -e "$BUILD/openmw-iniimporter" \
+ --deploy-deps-only "$OUT/engine/usr/lib/${OSG_PLUGINS##*/}"
cp -r "$BUILD/resources" "$BUILD/openmw.cfg" "$BUILD/defaults.bin" "$BUILD/gamecontrollerdb.txt" "$OUT/engine/usr/bin/"
cp -r "$I/mod" "$I/pixelart" "$OUT/"