Code

* packaging/macosx/Resources/script,
[inkscape.git] / packaging / macosx / Resources / bin / inkscape
1 #!/bin/sh
2 #
3 # Author: Aaron Voisine <aaron@voisine.org>
4 # Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net>
6 CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo $PWD)`"
7 TOP="`dirname \"$CWD\"`"
9 export DYLD_LIBRARY_PATH="$TOP/lib"
10 export PATH="$CWD:$PATH"
11 export PANGO_RC_FILE="$HOME/.inkscape-etc/pangorc"
12 export FONTCONFIG_PATH="$TOP/etc/fonts"
13 export GTK_IM_MODULE_FILE="$HOME/.inkscape-etc/gtk.immodules"
14 export GDK_PIXBUF_MODULE_FILE="$HOME/.inkscape-etc/gdk-pixbuf.loaders"
15 export GTK_DATA_PREFIX="$TOP"
16 export GTK_EXE_PREFIX="$TOP"
17 export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules"
18 export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules"
20 export INKSCAPE_SHAREDIR="$TOP"
21 export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape"
22 export INKSCAPE_LOCALEDIR="$TOP/locale"
24 # TODO: Have to add ".UTF-8" to the LANG since ommiting causes Inkscape
25 #       to crash on startup in locale_from_utf8().
26 export LANG="`grep \"\`defaults read .GlobalPreferences AppleCollationOrder \
27         2>&1\`_\" /usr/share/locale/locale.alias | tail -n1 | sed 's/\./ /' | \
28         awk '{print $2}'`.UTF-8"
30 # Handle the case where the directory storing Inkscape has a '#' in the name.
31 # This '#' needs to be escaped in pango.modules for Pango to work properly.
32 ESCAPEDTOP=`echo $TOP | sed 's/#/\\\\\\\\#/'`
34 mkdir -p ~/.inkscape-etc
35 sed 's|${HOME}|'"$HOME|g" "$TOP/etc/pango/pangorc" > ~/.inkscape-etc/pangorc
36 sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \
37     > ~/.inkscape-etc/pango.modules
38 cp -f "$TOP/etc/pango/pangox.aliases" ~/.inkscape-etc/
39 sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gtk.immodules" \
40     > ~/.inkscape-etc/gtk.immodules
41 sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gdk-pixbuf.loaders" \
42     > ~/.inkscape-etc/gdk-pixbuf.loaders
44 exec "$CWD/inkscape-bin" "$@"