update startup scripts for NSM
[ardour.git] / tools / linux_packaging / ardour.sh.in
1 #!/bin/sh
2
3 # This is Linux-specific startup script for a bundled version of Ardour
4
5 ARGS=""
6
7 while [ $# -gt 0 ] ; do
8         case $1 in
9
10         --debug)
11                 DEBUG="T";
12                 shift ;;
13         *)
14                 ARGS=$ARGS$1" ";
15                 shift; ;;
16         esac
17 done
18
19 # LD_LIBRARY_PATH needs to be set here so that epa can swap between the original and the bundled version
20 # (the original one will be stored in PREBUNDLE_ENV)
21 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
22 export PREBUNDLE_ENV="$(env)"
23
24 BIN_DIR=$(dirname $(readlink -f $0))
25 INSTALL_DIR=$(dirname $BIN_DIR)
26 LIB_DIR=$INSTALL_DIR/lib
27 ETC_DIR=$INSTALL_DIR/etc
28 USER_ARDOUR_DIR=$HOME/.config/ardour3
29
30 if [ ! -d $USER_ARDOUR_DIR ] ; then
31     mkdir -p $USER_ARDOUR_DIR || exit 1
32 fi
33
34 # this triggers code in main() that will reset runtime environment variables
35 # to point to directories inside the ardour package
36
37 export ARDOUR_BUNDLED=true
38
39 # NSM needs a path to this script
40 export ARDOUR_SELF="$0"
41
42
43 # this is edited by the build script to include relevant environment variables
44
45 %ENV%
46
47 # Disable extra modules from being loaded by gtk (example, libcanberra-gtk-module.so)
48 export GTK_MODULES=""
49 # Set this so that the executable will find all the right libraries inside the bundle
50 export LD_LIBRARY_PATH=$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
51
52 if [ "T" = "$DEBUG" ]; then
53         export ARDOUR_INSIDE_GDB=1
54         exec gdb $INSTALL_DIR/bin/ardour-%VER%
55 else
56         exec $INSTALL_DIR/bin/ardour-%VER% $ARGS
57 fi
58
59
60