Fix for launching on case-sensitive systems
[xboard.git] / osxapp / XBoard.gtklauncher
1 #!/bin/bash
2
3 # Inherited from gtk-mac-bundler example launcher script
4 # Where we get the paths from
5 name=$(basename "$0")
6 echo $name
7
8 dirn=$(dirname "$0")
9 echo $dirn
10
11 bundle=$(cd "$dirn/../../" && pwd)
12 bundle_contents="$bundle"/Contents
13 bundle_res="$bundle_contents"/Resources
14 bundle_lib="$bundle_res"/lib
15 bundle_bin="$bundle_res"/bin
16 bundle_data="$bundle_res"/share
17 bundle_etc="$bundle_res"/etc
18
19 export PATH="$bundle_bin:$PATH"
20
21 export PATH="$bundle_contents/MacOS/:$PATH"
22
23 chmod -R +x $bundle_bin
24
25 # Use fallback instead of normal dlyd path, may not be required
26 export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib:$DYLD_FALLBACK_LIBRARY_PATH"
27
28 # Help fontconfig find its configuration file
29 export FONTCONFIG_FILE="$bundle_etc/fonts/fonts.conf"
30
31 # Help gdk find its loader modules
32 export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
33
34 # Fix for the theme engine paths
35 export GTK_PATH="$bundle_lib/gtk-2.0/2.10.0"
36
37 # GTK path no longer required
38  export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
39
40 # Pango path no longer required
41 export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
42 export PANGO_SYSCONFDIR="$bundle_etc"
43 export PANGO_LIBDIR="$bundle_lib"
44
45 # Fix the gegl path issue
46 export GEGL_PATH="$bundle_lib/gegl-0.2"
47
48 # Define gtkrc file
49 export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
50
51 # set as absolute directory to find GTK resources internally, thanks GIMP.
52 LNDIR=/tmp/skl/XBoard.app
53 if [ ! -e "$LNDIR/Contents/Resources/launcher_rc" ]; then
54 rm -f "$LNDIR"
55 mkdir -p /tmp/skl
56 chmod a+w /tmp/skl
57 ln -s "$bundle" "$LNDIR"
58 fi
59
60 # set the working directory to users home
61 cd ~/ > /dev/null
62
63
64 # Strip out arguments added by the OS
65 if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
66         shift 1
67 fi
68
69 if [ "x$GTK_DEBUG_SHELL" != "x" ]; then
70         exec bash
71
72 else
73         $EXEC "$bundle_contents/MacOS/xboard-bin" "$@"
74 fi
75
76