#!/bin/sh
# Points GWYDDION_LIBDIR at the bundled modules, replacing the build-time
# path compiled into libgwyddion. See bundle-linux.sh for the full story.
here="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
export GWYDDION_LIBDIR="$here/lib"
# Needed for the loadable modules' own dependencies, such as libxml2. An
# executable's library search path does not apply to libraries required by
# a module it loads at run time, so without this only libraries already in
# the process (the core Gwyddion and GTK ones) would resolve.
export LD_LIBRARY_PATH="$here/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Keep stderr for real diagnostics. Otherwise GTK loads its accessibility
# modules and GdkPixbuf hunts for a loader cache at a path baked in by the
# build container, warning on every run including successful ones. Neither
# is needed: gwyconvert draws nothing and the bundle ships no pixmap
# module. Clearing both leaves the format list and every conversion
# unchanged.
export GTK_MODULES=""
export GDK_PIXBUF_MODULE_FILE=/dev/null
exec "$here/lib/gwyconvert.real" "$@"
