diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-09-02 22:07:52 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-09-02 22:07:52 +0000 |
| commit | ae2c67ac8b6c0a03457042abb8e4cab728aae8a5 (patch) | |
| tree | deec660daa87eadeb55e00f3cdcfa7630101f89e | |
| parent | osx-build.sh: don't attempt to update a bound branch (diff) | |
| download | inkscape-ae2c67ac8b6c0a03457042abb8e4cab728aae8a5.tar.gz inkscape-ae2c67ac8b6c0a03457042abb8e4cab728aae8a5.zip | |
Simplify nested structure of launcher scripts (needs testing)
(bzr r13506.1.55)
| -rwxr-xr-x | packaging/macosx/Resources/bin/inkscape | 154 | ||||
| l---------[-rwxr-xr-x] | packaging/macosx/Resources/openDoc | 14 | ||||
| -rwxr-xr-x | packaging/macosx/Resources/script | 161 | ||||
| -rwxr-xr-x | packaging/macosx/osx-app.sh | 12 |
4 files changed, 160 insertions, 181 deletions
diff --git a/packaging/macosx/Resources/bin/inkscape b/packaging/macosx/Resources/bin/inkscape deleted file mode 100755 index 0b7e85ce8..000000000 --- a/packaging/macosx/Resources/bin/inkscape +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/sh -# -# Author: Aaron Voisine <aaron@voisine.org> -# Inkscape Modifications: -# Michael Wybrow <mjwybrow@users.sourceforge.net> -# Jean-Olivier Irisson <jo.irisson@gmail.com> -# ~suv <suv-sf@users.sourceforge.net> -# - -if test "x$GTK_DEBUG_LAUNCHER" != x; then - set -x -fi - -if test "x$GTK_DEBUG_GDB" != x; then - EXEC="gdb --args" -elif test "x$GTK_DEBUG_LLDB" != x; then - EXEC="lldb -- " -elif test "x$GTK_DEBUG_DTRUSS" != x; then - EXEC="dtruss" -else - EXEC=exec -fi - -CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo \"$PWD\")`" -# e.g. /Applications/Inkscape.app/Contents/Resources/bin -TOP="`dirname \"$CWD\"`" -# e.g. /Applications/Inkscape.app/Contents/Resources - - -# Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway. -# People should really use ~/.macosx/environment.plist to set environment variables as explained by Apple: -# http://developer.apple.com/qa/qa2001/qa1067.html -# but since no one does, we correct this by making the 'classic' PATH additions here: -# /usr/local/bin which, though standard, doesn't seem to be in the PATH -# newer python as recommended by MacPython http://www.python.org/download/mac/ -# Fink -# MacPorts (former DarwinPorts) -# LaTeX distribution for Mac OS X -export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH" - -# Put /usr/bin at beginning of path so we make sure we use Apple's python -# over one that may be installed be Macports, Fink or some other means. -export PATH="/usr/bin:$PATH" - -# Setup PYTHONPATH to use python modules shipped with Inkscape -OSXMINORNO="$(/usr/bin/sw_vers -productVersion | cut -d. -f2)" -build_arch=__build_arch__ -if [ $OSXMINORNO -gt "5" ]; then - if [ $OSXMINORNO -eq "6" ]; then - export VERSIONER_PYTHON_VERSION=2.6 - else # if [ $OSXMINORNO -ge "7" ]; then - export VERSIONER_PYTHON_VERSION=2.7 - fi - if [ $build_arch = "i386" ]; then - export VERSIONER_PYTHON_PREFER_32_BIT=yes - else # build & runtime arch x86_64 - export VERSIONER_PYTHON_PREFER_32_BIT=no - fi -fi -PYTHON_VERS="$(python -V 2>&1 | cut -c 8-10)" -export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/" - -# fallback for missing $INK_CACHE_DIR -if [ -z "$INK_CACHE_DIR" ]; then - INK_CACHE_DIR="${HOME}/.cache/inkscape" - mkdir -p "$INK_CACHE_DIR" - [ $_DEBUG ] && echo "INK_CACHE_DIR: falling back to $INK_CACHE_DIR" -fi - -export FONTCONFIG_PATH="$TOP/etc/fonts" -export PANGO_RC_FILE="${INK_CACHE_DIR}/pangorc" -export GTK_IM_MODULE_FILE="${INK_CACHE_DIR}/immodules.cache" -export GDK_PIXBUF_MODULE_FILE="${INK_CACHE_DIR}/loaders.cache" -export GTK_DATA_PREFIX="$TOP" -export GTK_EXE_PREFIX="$TOP" -export GTK_PATH="$TOP" -export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules" -export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules" -export XDG_DATA_DIRS="$TOP/share" -export ASPELL_CONF="prefix $TOP;" -export POPPLER_DATADIR="$TOP/share/poppler" - -# Note: This requires the path with the exact ImageMagic version number. -# Also, that ImageMagick will only work if it does not find a -# version installed into the same PREFIX as it was originally -# installed. Luckily, this is very unlikely given the extra long -# and strangely named install prefix we use. -# The actual version is inserted by the packaging script. -export MAGICK_CONFIGURE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/config:$TOP/share/ImageMagick-IMAGEMAGICKVER_MAJOR/config" -export MAGICK_CODER_FILTER_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/filters" -export MAGICK_CODER_MODULE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/coders" - -export INKSCAPE_SHAREDIR="$TOP/share/inkscape" -export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" -export INKSCAPE_LOCALEDIR="$TOP/share/locale" - -# Handle the case where the directory storing Inkscape has special characters -# ('#', '&', '|') in the name. These need to be escaped to work properly for -# various configuration files. -ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'` - -# Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) -if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then - export GTK2_RC_FILES="$ESCAPEDTOP/etc/gtk-2.0/gtkrc" -fi - -# If the AppleCollationOrder preference doesn't exist, we fall back to using -# the AppleLocale preference. -LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` -if [ "x$LANGSTR" == "x" -o "x$LANGSTR" == "xroot" ] -then - LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \ - sed 's/_.*//'` - [ $_DEBUG ] && echo "Setting LANGSTR from AppleLocale: $LANGSTR" 1>&2 -else - [ $_DEBUG ] && echo "Setting LANGSTR from AppleCollationOrder: $LANGSTR" 1>&2 -fi - -# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Inkscape -# to crash on startup in locale_from_utf8(). -if [ "x$LANGSTR" == "x" ] -then - # override broken script - [ $_DEBUG ] && echo "Overriding empty LANGSTR" 1>&2 - export LANG="en_US.UTF-8" -else - tmpLANG="`grep \"\`echo $LANGSTR\`_\" /usr/share/locale/locale.alias | \ - tail -n1 | sed 's/\./ /' | awk '{print $2}'`" - if [ "x$tmpLANG" == "x" ] - then - # override broken script - [ $_DEBUG ] && echo "Overriding empty LANG from /usr/share/locale/locale.alias" 1>&2 - export LANG="en_US.UTF-8" - else - [ $_DEBUG ] && echo "Setting LANG from /usr/share/locale/locale.alias" 1>&2 - export LANG="$tmpLANG.UTF-8" - fi -fi -[ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 -export LC_ALL="$LANG" - -sed 's|${INK_CACHE_DIR}|'"$INK_CACHE_DIR|g" "$TOP/etc/pango/pangorc" > "${INK_CACHE_DIR}/pangorc" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \ - > "${INK_CACHE_DIR}/pango.modules" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gtk-2.0/__gtk_version__/immodules.cache" \ - > "${INK_CACHE_DIR}/immodules.cache" -sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gdk-pixbuf-2.0/__gdk_pixbuf_version__/loaders.cache" \ - > "${INK_CACHE_DIR}/loaders.cache" - -if [ "x$GTK_DEBUG_SHELL" != "x" ]; then - exec bash -else - $EXEC "$CWD/inkscape-bin" "$@" -fi diff --git a/packaging/macosx/Resources/openDoc b/packaging/macosx/Resources/openDoc index 63e803540..2b804bee2 100755..120000 --- a/packaging/macosx/Resources/openDoc +++ b/packaging/macosx/Resources/openDoc @@ -1,13 +1 @@ -#!/bin/bash -# -# Author: Aaron Voisine <aaron@voisine.org> -# Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net> -# Inkscape Modifications: ~suv <suv-sf@users.sourceforge.net> - -CWD="$(cd "$(dirname "$0")" && pwd)" - -source "${CWD}/xdg_setup.sh" - -BASE="$(echo "$0" | sed -e 's/\/Contents\/Resources\/openDoc/\//')" -cd "$BASE" -exec "$CWD/bin/inkscape" "$@" +script
\ No newline at end of file diff --git a/packaging/macosx/Resources/script b/packaging/macosx/Resources/script index de839484d..9951922ab 100755 --- a/packaging/macosx/Resources/script +++ b/packaging/macosx/Resources/script @@ -4,19 +4,164 @@ # Inkscape Modifications: Michael Wybrow <mjwybrow@users.sourceforge.net> # Inkscape Modifications: ~suv <suv-sf@users.sourceforge.net> -#export _DEBUG=true +if test "x$GTK_DEBUG_LAUNCHER" != x; then + set -x +fi +if test "x$GTK_DEBUG_GDB" != x; then + EXEC="gdb --args" +elif test "x$GTK_DEBUG_LLDB" != x; then + EXEC="lldb -- " +elif test "x$GTK_DEBUG_DTRUSS" != x; then + EXEC="dtruss" +else + EXEC=exec +fi + +# store absolute path to current script CWD="$(cd "$(dirname "$0")" && pwd)" +# read xdg user configuration source "${CWD}/xdg_setup.sh" -source "${CWD}/alert_fccache.sh" -BASE="$(echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//')" +# if this is the main script, check if this is the first run for current user +if [ $(basename "$0") == "script" ]; then + source "${CWD}/alert_fccache.sh" +fi + +# set prefix for bundled libs and resources +TOP="$CWD" + +# change into path prefix (top-level app dir) for osxapp-enabled binary +BASE="$(echo "$CWD" | sed -e 's/\/Contents\/Resources/\//')" cd "$BASE" -# TODO examine whether it would be wisest to move the code from inkscape shell -# script and getdisplay.sh to here and only keep the real binary in bin. This -# may make things easier on Leopard and may also help using Inkscape on the -# command line. +# Brutally add many things to the PATH. If the directories do not exist, they won't be used anyway. +# the 'classic' PATH additions: +# /usr/local/bin which, though standard, doesn't seem to be in the PATH +# Fink +# MacPorts (former DarwinPorts) +# LaTeX distribution for Mac OS X +export PATH="/usr/texbin:/opt/local/bin:/sw/bin/:/usr/local/bin:$PATH" + +# Put /usr/bin at beginning of path so we make sure we use Apple's python +# over one that may be installed be Macports, Fink or some other means. +export PATH="/usr/bin:$PATH" + +# Put $CWD/bin at beginning of path so we make sure that recursive calls +# to inkscape don't pull in other inkscape binaries with different setup +# also allows to override system python with custom wrapper script +export PATH="$CWD/bin:$PATH" + +# Set up PYTHONPATH to use python modules bundled with Inkscape +OSXMINORNO="$(/usr/bin/sw_vers -productVersion | cut -d. -f2)" +build_arch=__build_arch__ +if [ $OSXMINORNO -gt "5" ]; then + if [ $OSXMINORNO -eq "6" ]; then + export VERSIONER_PYTHON_VERSION=2.6 + else # if [ $OSXMINORNO -ge "7" ]; then + export VERSIONER_PYTHON_VERSION=2.7 + fi + if [ $build_arch = "i386" ]; then + export VERSIONER_PYTHON_PREFER_32_BIT=yes + else # build & runtime arch x86_64 + export VERSIONER_PYTHON_PREFER_32_BIT=no + fi +fi +PYTHON_VERS="$(python -V 2>&1 | cut -c 8-10)" +export PYTHONPATH="$TOP/lib/python$PYTHON_VERS/site-packages/" + +# fallback for missing $INK_CACHE_DIR +if [ -z "$INK_CACHE_DIR" ]; then + INK_CACHE_DIR="${HOME}/.cache/inkscape" + mkdir -p "$INK_CACHE_DIR" + [ $_DEBUG ] && echo "INK_CACHE_DIR: falling back to $INK_CACHE_DIR" +fi + +export FONTCONFIG_PATH="$TOP/etc/fonts" +export PANGO_RC_FILE="${INK_CACHE_DIR}/pangorc" +export GTK_IM_MODULE_FILE="${INK_CACHE_DIR}/immodules.cache" +export GDK_PIXBUF_MODULE_FILE="${INK_CACHE_DIR}/loaders.cache" +export GTK_DATA_PREFIX="$TOP" +export GTK_EXE_PREFIX="$TOP" +export GTK_PATH="$TOP" +export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules" +export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules" +export XDG_DATA_DIRS="$TOP/share" +export ASPELL_CONF="prefix $TOP;" +export POPPLER_DATADIR="$TOP/share/poppler" + +# Note: This requires the path with the exact ImageMagic version number. +# Also, that ImageMagick will only work if it does not find a +# version installed into the same PREFIX as it was originally +# installed. Luckily, this is very unlikely given the extra long +# and strangely named install prefix we use. +# The actual version is inserted by the packaging script. +export MAGICK_CONFIGURE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/config:$TOP/share/ImageMagick-IMAGEMAGICKVER_MAJOR/config" +export MAGICK_CODER_FILTER_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/filters" +export MAGICK_CODER_MODULE_PATH="$TOP/lib/ImageMagick-IMAGEMAGICKVER/modules-Q16/coders" + +export INKSCAPE_SHAREDIR="$TOP/share/inkscape" +export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" +export INKSCAPE_LOCALEDIR="$TOP/share/locale" + +# Handle the case where the directory storing Inkscape has special characters +# ('#', '&', '|') in the name. These need to be escaped to work properly for +# various configuration files. +ESCAPEDTOP=`echo "$TOP" | sed 's/#/\\\\\\\\#/' | sed 's/&/\\\\\\&/g' | sed 's/|/\\\\\\|/g'` + +# Set GTK theme (only if there is no .gtkrc-2.0 in the user's home) +if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then + export GTK2_RC_FILES="$ESCAPEDTOP/etc/gtk-2.0/gtkrc" +fi + +# If the AppleCollationOrder preference doesn't exist, we fall back to using +# the AppleLocale preference. +LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null` +if [ "x$LANGSTR" == "x" -o "x$LANGSTR" == "xroot" ] +then + LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \ + sed 's/_.*//'` + [ $_DEBUG ] && echo "Setting LANGSTR from AppleLocale: $LANGSTR" 1>&2 +else + [ $_DEBUG ] && echo "Setting LANGSTR from AppleCollationOrder: $LANGSTR" 1>&2 +fi + +# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Inkscape +# to crash on startup in locale_from_utf8(). +if [ "x$LANGSTR" == "x" ] +then + # override broken script + [ $_DEBUG ] && echo "Overriding empty LANGSTR" 1>&2 + export LANG="en_US.UTF-8" +else + tmpLANG="`grep \"\`echo $LANGSTR\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" + if [ "x$tmpLANG" == "x" ] + then + # override broken script + [ $_DEBUG ] && echo "Overriding empty LANG from /usr/share/locale/locale.alias" 1>&2 + export LANG="en_US.UTF-8" + else + [ $_DEBUG ] && echo "Setting LANG from /usr/share/locale/locale.alias" 1>&2 + export LANG="$tmpLANG.UTF-8" + fi +fi +[ $_DEBUG ] && echo "Setting Language: $LANG" 1>&2 +export LC_ALL="$LANG" + +sed 's|${INK_CACHE_DIR}|'"$INK_CACHE_DIR|g" "$TOP/etc/pango/pangorc" > "${INK_CACHE_DIR}/pangorc" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \ + > "${INK_CACHE_DIR}/pango.modules" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gtk-2.0/__gtk_version__/immodules.cache" \ + > "${INK_CACHE_DIR}/immodules.cache" +sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/lib/gdk-pixbuf-2.0/__gdk_pixbuf_version__/loaders.cache" \ + > "${INK_CACHE_DIR}/loaders.cache" + +if [ "x$GTK_DEBUG_SHELL" != "x" ]; then + exec bash +else + $EXEC "$CWD/bin/inkscape" "$@" +fi -exec "$CWD/bin/inkscape" "$@" +# eof diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index 6d6d2a87e..833161a97 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -299,7 +299,7 @@ binary_name=`basename "$binary"` binary_dir=`dirname "$binary"` # Inkscape's binary -binpath="$pkgbin/inkscape-bin" +binpath="$pkgbin/inkscape" cp -v "$binary" "$binpath" # TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not @@ -387,7 +387,7 @@ if [ ${add_python} = "true" ]; then cp -rvf "$python_dir"/* "$pkglib" fi fi -sed -e "s,__build_arch__,$ARCH,g" -i "" $pkgbin/inkscape +sed -e "s,__build_arch__,$ARCH,g" -i "" "$pkgresources/script" # PkgInfo must match bundle type and creator code from Info.plist echo "APPLInks" > $package/Contents/PkgInfo @@ -433,8 +433,8 @@ gdk_pixbuf_version=`pkg-config --variable=gdk_pixbuf_binary_version gdk-pixbuf-2 mkdir -p $pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders cp $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders/*.so $pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders/ -sed -e "s,__gtk_version__,$gtk_version,g" -i "" $pkgbin/inkscape -sed -e "s,__gdk_pixbuf_version__,$gdk_pixbuf_version,g" -i "" $pkgbin/inkscape +sed -e "s,__gtk_version__,$gtk_version,g" -i "" "$pkgresources/script" +sed -e "s,__gdk_pixbuf_version__,$gdk_pixbuf_version,g" -i "" "$pkgresources/script" sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/lib/gtk-2.0/$gtk_version/immodules.cache > $pkglib/gtk-2.0/$gtk_version/immodules.cache sed -e "s,$LIBPREFIX,\${CWD},g" $LIBPREFIX/lib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders.cache > $pkglib/gdk-pixbuf-2.0/$gdk_pixbuf_version/loaders.cache @@ -461,8 +461,8 @@ done for la_file in "$pkglib/ImageMagick-$IMAGEMAGICKVER/modules-Q16/filters"/*.la; do sed -e "s,$LIBPREFIX/lib/ImageMagick-$IMAGEMAGICKVER/modules-Q16/filters,,g" -i "" "$la_file" done -sed -e "s,IMAGEMAGICKVER,$IMAGEMAGICKVER,g" -i "" $pkgbin/inkscape -sed -e "s,IMAGEMAGICKVER_MAJOR,$IMAGEMAGICKVER_MAJOR,g" -i "" $pkgbin/inkscape +sed -e "s,IMAGEMAGICKVER,$IMAGEMAGICKVER,g" -i "" "$pkgresources/script" +sed -e "s,IMAGEMAGICKVER_MAJOR,$IMAGEMAGICKVER_MAJOR,g" -i "" "$pkgresources/script" # Copy aspell dictionary files: cp -r "$LIBPREFIX/share/aspell" "$pkgresources/share/" |
