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