build script tweaks for most consistency
[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 while [ $# -gt 0 ] ; do
6         echo "arg = $1"
7         case $1 in
8
9         -d)
10                 DEBUG="T";
11                 shift ;;
12         *)      break;;
13         esac
14 done
15
16 # LD_LIBRARY_PATH needs to be set here so that epa can swap between the original and the bundled version
17 # (the original one will be stored in PREBUNDLE_ENV)
18 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
19 export PREBUNDLE_ENV="$(env)"
20
21 BIN_DIR=$(dirname $(readlink -f $0))
22 INSTALL_DIR=$(dirname $BIN_DIR)
23 LIB_DIR=$INSTALL_DIR/lib
24 ETC_DIR=$INSTALL_DIR/etc
25 USER_ARDOUR_DIR=$HOME/.config/ardour3
26
27 if [ ! -d $USER_ARDOUR_DIR ] ; then
28     mkdir -p $USER_ARDOUR_DIR || exit 1
29 fi
30
31 # this triggers code in main() that will reset runtime environment variables
32 # to point to directories inside the ardour package
33
34 export ARDOUR_BUNDLED=true
35
36 # this is edited by the build script to include relevant environment variables
37
38 %ENV%
39
40 # Disable extra modules from being loaded by gtk (example, libcanberra-gtk-module.so)
41 export GTK_MODULES=""
42 # Set this so that the executable will find all the right libraries inside the bundle
43 export LD_LIBRARY_PATH=$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
44
45 # create install-location-dependent config files for Pango and GDK image loaders
46 # We have to do this every time because its possible that LIB_DIR has changed
47
48 sed "s?@ROOTDIR@/modules?$LIB_DIR/modules?" < $ETC_DIR/pango.modules.in > $USER_ARDOUR_DIR/pango.modules
49 sed "s?@ROOTDIR@/loaders?$LIB_DIR/loaders?" < $ETC_DIR/gdk-pixbuf.loaders.in > $USER_ARDOUR_DIR/gdk-pixbuf.loaders
50
51 if [ "T" = "$DEBUG" ]; then
52         export ARDOUR_INSIDE_GDB=1
53         exec gdb $INSTALL_DIR/bin/ardour-3.0 "$@"
54 else
55         exec $INSTALL_DIR/bin/ardour-3.0 "$@"
56 fi
57
58
59