Code

updated spanish.nsh and inkscape.nsi to reflect latest file-changes
[inkscape.git] / trunk / packaging / macosx / Resources / bin / inkscape
1 #!/bin/sh
2 #
3 # Author: Aaron Voisine <aaron@voisine.org>
4 # Inkscape Modifications:
5 #       Michael Wybrow <mjwybrow@users.sourceforge.net>
6 #       Jean-Olivier Irisson <jo.irisson@gmail.com>
7 #
9 CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo $PWD)`"
10 # e.g. /Applications/Inkscape.app/Contents/Resources/bin
11 TOP="`dirname \"$CWD\"`"
12 # e.g. /Applications/Inkscape.app/Contents/Resources
15 # Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway. 
16 # People should really use ~/.macosx/environment.plist to set environment variables as explained by Apple:
17 #       http://developer.apple.com/qa/qa2001/qa1067.html
18 # but since no one does, we correct this by making the 'classic' PATH additions here:
19 #       /usr/local/bin which, though standard, doesn't seem to be in the PATH
20 #       newer python as recommended by MacPython http://www.python.org/download/mac/
21 #       Fink
22 #       MacPorts (former DarwinPorts)
23 export PATH="/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
25 # Setup PYTHONPATH to use python modules shipped with Inkscape
26 ARCH=`arch`
27 PYTHON_VERS=`python -V 2>&1 | cut -c 8-10`
28 export PYTHONPATH="$TOP/python/site-packages/$ARCH/$PYTHON_VERS"
29 # NB: we are only preprending some stuff to the default python path so if the directory does not exist it should not harm the rest
31 export DYLD_LIBRARY_PATH="$TOP/lib"
33 export FONTCONFIG_PATH="$TOP/etc/fonts"
34 export PANGO_RC_FILE="$HOME/.inkscape-etc/pangorc"
35 export GTK_IM_MODULE_FILE="$HOME/.inkscape-etc/gtk.immodules"
36 export GDK_PIXBUF_MODULE_FILE="$HOME/.inkscape-etc/gdk-pixbuf.loaders"
37 export GTK_DATA_PREFIX="$TOP"
38 export GTK_EXE_PREFIX="$TOP"
39 export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules"
40 export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules"
42 export INKSCAPE_SHAREDIR="$TOP"
43 # TODO: move the share directory to a its own folder to make things a bit cleaner in the app bundle
44 export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape"
45 export INKSCAPE_LOCALEDIR="$TOP/locale"
47 # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home)
48 if [[ ! -e $HOME/.gtkrc-2.0 ]]; then
49         # prepare the theme depending on OS X appearance settings
50         (
51                 cd "$INKSCAPE_SHAREDIR/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/"
52                 ./sync_osx_look.sh
53                 # TODO: make this more robust, probably by integrating this script directly inline here
54         )
55         export GTK2_RC_FILES="$INKSCAPE_SHAREDIR/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/gtkrc"
56 fi
58 # TODO: Have to add ".UTF-8" to the LANG since ommiting causes Inkscape
59 #       to crash on startup in locale_from_utf8().
60 export LANG="`grep \"\`defaults read .GlobalPreferences AppleCollationOrder \
61         2>&1\`_\" /usr/share/locale/locale.alias | tail -n1 | sed 's/\./ /' | \
62         awk '{print $2}'`.UTF-8"
64 # Handle the case where the directory storing Inkscape has a '#' in the name.
65 # This '#' needs to be escaped in pango.modules for Pango to work properly.
66 ESCAPEDTOP=`echo $TOP | sed 's/#/\\\\\\\\#/'`
68 mkdir -p ${HOME}/.inkscape-etc
69 sed 's|${HOME}|'"$HOME|g" "$TOP/etc/pango/pangorc" > ${HOME}/.inkscape-etc/pangorc
70 sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \
71     > ${HOME}/.inkscape-etc/pango.modules
72 cp -f "$TOP/etc/pango/pangox.aliases" ${HOME}/.inkscape-etc/
73 sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gtk.immodules" \
74     > ${HOME}/.inkscape-etc/gtk.immodules
75 sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gdk-pixbuf.loaders" \
76     > ${HOME}/.inkscape-etc/gdk-pixbuf.loaders
78 exec "$CWD/inkscape-bin" "$@"