#!/bin/sh

# Usage: gnucash-env any-cmd [ args ... ]
# runs any-cmd in an environment appropriate for gnucash.
# we'll also add a gnucash-build-env later for running from the install tree.

GNC_MODULE_PATH="/usr/lib/gnucash:${GNC_MODULE_PATH}"

EXTRA_PATH="${EXTRA_PATH}:/usr/share/gnucash/scm"

GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"

EXTRA_LIBS="${GNC_MODULE_PATH}"
EXTRA_LIBS="${EXTRA_LIBS}:/usr/lib"
EXTRA_LIBS="${EXTRA_LIBS}:/usr/lib/gnucash"

LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${EXTRA_LIBS}:${DYLD_LIBRARY_PATH}"

PYTHONPATH="${PYTHONPATH}:"

export GNC_MODULE_PATH
export GUILE_LOAD_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
export PYTHONPATH

exec "$@"
