summaryrefslogtreecommitdiff
path: root/distribution/osx/bundle/xtrackcad-startup
blob: e82d444b21eb76a4888db2ee7ad982a0780a9c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# Author: Aaron Voisine <aaron@voisine.org>
# Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net>
# XTrackCAD Modifications: Timothy M. Shead <tshead@k-3d.com>

XTRKCAD_BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/XTrackCAD//'`"
XTRKCAD_RESOURCES="$XTRKCAD_BUNDLE/Contents/Resources"
XTRKCAD_TEMP="/tmp/xtrkcad/$UID"
XTRKCAD_ETC="$XTRKCAD_TEMP/etc"
XTRKCAD_GDK_PIXBUF_MODULE_FILE="$XTRKCAD_ETC/gtk-2.0/gdk-pixbuf.loaders"
XTRKCAD_GTK_IM_MODULE_FILE="$XTRKCAD_ETC/gtk-2.0/gtk.immodules"
XTRKCAD_PANGO_RC_FILE="$XTRKCAD_ETC/pango/pangorc"

echo "XTrackCAD: Starting $0"
echo "XTrackCAD: XTRKCAD_BUNDLE: $XTRKCAD_BUNDLE"

# Setup temporary runtime files
rm -rf "$XTRKCAD_TEMP"

# Because the bundle could be located anywhere at runtime, we have to
# create temporary copies of the Pango configuration files that
# reflect our current location
mkdir -p "$XTRKCAD_ETC/gtk-2.0"
sed -e 's|/opt/local|'"$XTRKCAD_RESOURCES|g" "$XTRKCAD_RESOURCES/etc/gtk-2.0/gdk-pixbuf.loaders" > "$XTRKCAD_GDK_PIXBUF_MODULE_FILE"
sed -e 's|/opt/local|'"$XTRKCAD_RESOURCES|g" "$XTRKCAD_RESOURCES/etc/gtk-2.0/gtk.immodules" > "$XTRKCAD_GTK_IM_MODULE_FILE"
mkdir -p "$XTRKCAD_ETC/pango"
sed -e 's|/opt/local/etc|'"$XTRKCAD_ETC|g" "$XTRKCAD_RESOURCES/etc/pango/pangorc" > "$XTRKCAD_ETC/pango/pangorc"
sed -e 's|/opt/local|\"'"$XTRKCAD_RESOURCES|g" -e "s/\.so/.so\"/g" "$XTRKCAD_RESOURCES/etc/pango/pango.modules" > "$XTRKCAD_ETC/pango/pango.modules"

export "DYLD_LIBRARY_PATH=$XTRKCAD_RESOURCES/lib"
export "FONTCONFIG_PATH=$XTRKCAD_RESOURCES/etc/fonts"
export "GDK_PIXBUF_MODULE_FILE=$XTRKCAD_GDK_PIXBUF_MODULE_FILE"
export "GTK_IM_MODULE_FILE=$XTRKCAD_GTK_IM_MODULE_FILE"
export "PANGO_RC_FILE=$XTRKCAD_PANGO_RC_FILE"
export "PATH=$XTRKCAD_RESOURCES/bin:$PATH"
export "XTRKCADLIB=$XTRKCAD_RESOURCES/share/xtrkcad"

export
exec "$XTRKCAD_RESOURCES/bin/xtrkcad"

echo "XTrackCAD: Finishing $0"