#!/bin/sh

if test "x$DEBUG_LAUNCHER" != x; then
    set -x
fi

name=`basename "$0"`
tmp="$0"
tmp=`dirname "$tmp"`
tmp=`dirname "$tmp"`
bundle=`dirname "$tmp"`
bundle=/Applications/FontForge.app
scriptdir=/Applications/FontForge.app/Contents/MacOS/
bundle_contents="$bundle"/Contents
bundle_res="$bundle_contents"/Resources
bundle_fw="$bundle_contents"/Frameworks
bundle_lib="$bundle_res"/opt/local/lib
bundle_bin="$bundle_res"/opt/local/bin
bundle_data="$bundle_res"/opt/local/share
bundle_etc="$bundle_res"/opt/local/etc
bundle_share="$bundle_res"/opt/local/share

#export DYLD_LIBRARY_PATH="$bundle_lib"
export XDG_CONFIG_DIRS="$bundle_etc"/xdg
export XDG_DATA_DIRS="$bundle_data"
export GTK_DATA_PREFIX="$bundle_res"
export GTK_EXE_PREFIX="$bundle_res"
export GTK_PATH="$bundle_res"

export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
export FONTCONFIG_FILE="$bundle_etc/fonts/fonts.conf"

export LANG=en_US.UTF-8
export XLOCALEDIR="$bundle_share/X11/locale"

# setting PYTHONHOME gives the MAXREPEAT error and _socket.so symbol error.
#export PYTHONHOME="$bundle_bin/Python.framework.2.7"
export PYTHONPATH="/Applications/FontForge.app/Contents/MacOS/Even.app/Contents/Resources/lib/"


export PATH="$PATH:$bundle_bin"
echo $bundle_bin/Python.framework.*/bin/python "$@" 
$bundle_bin/Python.framework.*/bin/python "$@" 
