Fix multi-leg promotions
[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 # Fix the gegl path issue
41 export GEGL_PATH="$bundle_lib/gegl-0.2"
42
43 # Define gtkrc file
44 export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
45
46 # set as absolute directory to find GTK resources internally, thanks GIMP.
47 LNDIR=/tmp/skl/XBoard.app
48 if [ ! -e "$LNDIR/Contents/Resources/launcher_rc" ]; then
49 rm -f "$LNDIR"
50 mkdir -p /tmp/skl
51 chmod a+w /tmp/skl
52 ln -s "$bundle" "$LNDIR"
53 fi
54
55 # set the working directory to users home
56 cd ~/ > /dev/null
57
58
59 # Strip out arguments added by the OS
60 if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
61         shift 1
62 fi
63
64 if [ "x$GTK_DEBUG_SHELL" != "x" ]; then
65         exec bash
66
67 else
68         $EXEC "$bundle_contents/MacOS/xboard-bin" "$@"
69 fi
70
71