scripts/setenv_local.sh: set environment to run from built source tree
authorPaul Brossier <piem@piem.org>
Tue, 16 Feb 2016 14:42:35 +0000 (15:42 +0100)
committerPaul Brossier <piem@piem.org>
Tue, 16 Feb 2016 14:42:35 +0000 (15:42 +0100)
scripts/setenv_local.sh [new file with mode: 0644]

diff --git a/scripts/setenv_local.sh b/scripts/setenv_local.sh
new file mode 100644 (file)
index 0000000..acf39bf
--- /dev/null
@@ -0,0 +1,32 @@
+#! /usr/bin/env bash
+
+# This script sets the environment to execute aubio binaries and python code
+# directly from build/ python/build/ without installing libaubio on the system
+
+# Usage: $ source ./scripts/setenv_local.sh
+
+# WARNING: this script will *overwrite* existing (DY)LD_LIBRARY_PATH and
+# PYTHONPATH variables.
+
+PYTHON_PLATFORM=`python -c "import pkg_resources, sys; print '%s-%s' % (pkg_resources.get_build_platform(), '.'.join(map(str, sys.version_info[0:2])))"`
+
+AUBIODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
+AUBIOLIB=$AUBIODIR/build/src
+AUBIOPYTHON=$AUBIODIR/python/build/lib.$PYTHON_PLATFORM
+
+if [ "$(dirname $PWD)" == "scripts" ]; then
+  AUBIODIR=$(basename $PWD)
+else
+  AUBIODIR=$(basename $PWD)
+fi
+
+if [ "$(uname)" == "Darwin" ]; then
+  export DYLD_LIBRARY_PATH=$AUBIOLIB
+  echo export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
+else
+  export LD_LIBRARY_PATH=$AUBIOLIB
+  echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+fi
+
+export PYTHONPATH=$AUBIOPYTHON
+echo export PYTHONPATH=$PYTHONPATH