Add build script to configure for a XBoard.app for OS X
[xboard.git] / osxapp / XBoard.gtklauncher
diff --git a/osxapp/XBoard.gtklauncher b/osxapp/XBoard.gtklauncher
new file mode 100755 (executable)
index 0000000..d448c4e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+# Inherited from gtk-mac-bundler example launcher script
+# Where we get the paths from
+name=$(basename "$0")
+echo $name
+
+dirn=$(dirname "$0")
+echo $dirn
+
+bundle=$(cd "$dirn/../../" && pwd)
+bundle_contents="$bundle"/Contents
+bundle_res="$bundle_contents"/Resources
+bundle_lib="$bundle_res"/lib
+bundle_bin="$bundle_res"/bin
+bundle_data="$bundle_res"/share
+bundle_etc="$bundle_res"/etc
+
+export PATH="$bundle_bin:$PATH"
+
+export PATH="$bundle_contents/MacOS/:$PATH"
+
+chmod -R +x $bundle_bin
+
+# Use fallback instead of normal dlyd path, may not be required
+export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib:$DYLD_FALLBACK_LIBRARY_PATH"
+
+# Help fontconfig find its configuration file
+export FONTCONFIG_FILE="$bundle_etc/fonts/fonts.conf"
+
+# Help gdk find its loader modules
+export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
+
+# Fix for the theme engine paths
+export GTK_PATH="$bundle_lib/gtk-2.0/2.10.0"
+
+# GTK path no longer required
+ export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
+
+# Pango path no longer required
+ export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
+
+# Fix the gegl path issue
+export GEGL_PATH="$bundle_lib/gegl-0.2"
+
+# Define gtkrc file
+export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
+
+# set as absolute directory to find GTK resources internally, thanks GIMP.
+LNDIR=/tmp/skl/XBoard.app
+if [ ! -e "$LNDIR/Contents/Resources/launcher_rc" ]; then
+rm -f "$LNDIR"
+mkdir -p /tmp/skl
+chmod a+w /tmp/skl
+ln -s "$bundle" "$LNDIR"
+fi
+
+# set the working directory to users home
+cd ~/ > /dev/null
+
+
+# Strip out arguments added by the OS
+if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
+       shift 1
+fi
+
+if [ "x$GTK_DEBUG_SHELL" != "x" ]; then
+       exec bash
+
+else
+       $EXEC "$bundle_contents/MacOS/$name-bin" "$@"
+fi
+
+