diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-09-05 13:32:34 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-09-05 13:32:34 +0000 |
| commit | 5f24f004b4d7cb638041fa136225d603c807f0f2 (patch) | |
| tree | ef5831de2f9a5f3a9737305ad8ceed1dd2a4d0e4 | |
| parent | launcher script: add a few checks for recursive calls (diff) | |
| download | inkscape-5f24f004b4d7cb638041fa136225d603c807f0f2.tar.gz inkscape-5f24f004b4d7cb638041fa136225d603c807f0f2.zip | |
add wrapper script for gimp (supports GIMP.app) and python (not activated)
(bzr r13506.1.60)
| -rw-r--r-- | packaging/macosx/Resources/bin/gimp-wrapper.sh | 96 | ||||
| -rw-r--r-- | packaging/macosx/Resources/bin/python-wrapper.sh | 79 | ||||
| -rwxr-xr-x | packaging/macosx/osx-app.sh | 7 |
3 files changed, 182 insertions, 0 deletions
diff --git a/packaging/macosx/Resources/bin/gimp-wrapper.sh b/packaging/macosx/Resources/bin/gimp-wrapper.sh new file mode 100644 index 000000000..4cddfcc3a --- /dev/null +++ b/packaging/macosx/Resources/bin/gimp-wrapper.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# simple gimp wrapper script for Inkscape.app +# + +#_DEBUG=true + +# --- defaults for GIMP.app + +app_id="org.gnome.gimp" +app_exec_default="GIMP" + + +# --- defaults for gimp in $PATH + +# path for local gimp install +PATH_local="/opt/local/bin" +# launch a specific gimp version? (e.g. gimp-2.9) +gimp_name="gimp" + + +# --- unset environment inherited from Inkscape.app + +unset XDG_CONFIG_HOME XDG_DATA_HOME XDG_CACHE_HOME +unset XDG_CONFIG_DIRS XDG_DATA_DIRS +unset GTK_PATH GTK_DATA_PREFIX GTK_EXE_PREFIX GTK_IM_MODULE_FILE GTK2_RC_FILES +unset FONTCONFIG_FILE FONTCONFIG_PATH HB_SHAPER_LIST PANGO_RC_FILE PANGO_SYSCONFDIR +unset GDK_PIXBUF_MODULE_FILE GSETTINGS_SCHEMA_DIR +unset DBUS_SESSION_BUS_PID DBUS_LAUNCHD_SESSION_BUS_SOCKET DBUS_SESSION_BUS_ADDRESS +unset GNOME_VFS_MODULE_CONFIG_PATH GNOME_VFS_MODULE_PATH +unset GIO_MODULE_DIR GVFS_MOUNTABLE_DIR +unset ASPELL_CONF +unset POPPLER_DATADIR +unset VERSIONER_PYTHON_VERSION VERSIONER_PYTHON_PREFER_32_BIT PYTHONPATH +unset MAGICK_HOME MAGICK_CONFIGURE_PATH MAGICK_CODER_FILTER_PATH MAGICK_CODER_MODULE_PATH +unset GS_LIB GS_ICC_PROFILES GS_RESOURCE_DIR GS_LIB GS_FONTPATH GS + + +# --- detect installed GIMP.app + +unset GIMP_APP + +APPLESCRIPT1="$(cat << EOM +try + tell application "Finder" + set theApp to application file id "$app_id" as string + set theApp_path to POSIX path of theApp as string + return theApp_path + end tell +end try +EOM)" + +GIMP_APP="$(osascript -e "$APPLESCRIPT1")" + + +# --- pass command line arguments to GIMP.app or gimp or exit + +if [ ! -z "$GIMP_APP" ]; then + + app_exec="$(defaults read "${GIMP_APP}/Contents/Info.plist" CFBundleExecutable)" + [[ $? -ne 0 ]] && app_exec="$app_exec_default" + + GIMP_APP_EXEC="${GIMP_APP}/Contents/MacOS/${app_exec}" + + [ $_DEBUG ] && echo "GIMP.app found as: $GIMP_APP" 1>&2 + [ $_DEBUG ] && echo "Command line arguments: $@" 1>&2 + if [ $# -eq 1 ]; then + [ $_DEBUG ] && echo "open -a $GIMP_APP $@" 1>&2 + open -a "$GIMP_APP" "$@" + else + [ $_DEBUG ] && echo "exec $GIMP_APP_EXEC $@" 1>&2 + exec "$GIMP_APP_EXEC" "$@" + fi + +else # --- test for gimp installed in PATH + + # remove CWD from path (we don't want to recursively call this script) + [ $_DEBUG ] && echo "orig PATH: $PATH" 1>&2 + PATH_cleaned="$(echo $PATH | sed 's|'"$(cd "$(dirname "$0")" && pwd)"':||g')" || exit 1 + [ $_DEBUG ] && echo "clean PATH: $PATH_cleaned" 1>&2 + export PATH="$PATH_local:$PATH_cleaned" + [ $_DEBUG ] && echo "final PATH: $PATH" 1>&2 + + type -p "$gimp_name" + + if [ $? -eq 0 ]; then + [ $_DEBUG ] && echo "gimp found in \$PATH: $PATH" 1>&2 + [ $_DEBUG ] && echo "Command line arguments: $@" 1>&2 + exec "$gimp_name" -n "$@" + else + echo "Giving up - couldn't find GIMP.app nor gimp." 1>&2 + fi + +fi + +# eof diff --git a/packaging/macosx/Resources/bin/python-wrapper.sh b/packaging/macosx/Resources/bin/python-wrapper.sh new file mode 100644 index 000000000..35c3739bb --- /dev/null +++ b/packaging/macosx/Resources/bin/python-wrapper.sh @@ -0,0 +1,79 @@ +#!/bin/sh + + +# --------------------------------------------------------------------- +# a) to use py-gtk (for Sozi or inksmoto) from MacPorts +# --------------------------------------------------------------------- + +# # unset env used in Inkscape.app +# unset PYTHONHOME +# unset DYLD_LIBRARY_PATH +# unset XDG_CONFIG_HOME XDG_DATA_HOME XDG_CACHE_HOME +# unset XDG_CONFIG_DIRS XDG_DATA_DIRS +# unset GTK_PATH GTK_DATA_PREFIX GTK_EXE_PREFIX GTK_IM_MODULE_FILE GTK2_RC_FILES +# unset FONTCONFIG_FILE FONTCONFIG_PATH HB_SHAPER_LIST PANGO_RC_FILE PANGO_SYSCONFDIR +# unset GDK_PIXBUF_MODULE_FILE GSETTINGS_SCHEMA_DIR +# unset DBUS_SESSION_BUS_PID DBUS_LAUNCHD_SESSION_BUS_SOCKET DBUS_SESSION_BUS_ADDRESS +# unset GNOME_VFS_MODULE_CONFIG_PATH GNOME_VFS_MODULE_PATH +# unset GIO_MODULE_DIR GVFS_MOUNTABLE_DIR +# unset ASPELL_CONF +# unset POPPLER_DATADIR +# unset VERSIONER_PYTHON_VERSION VERSIONER_PYTHON_PREFER_32_BIT PYTHONPATH +# unset MAGICK_HOME MAGICK_CONFIGURE_PATH MAGICK_CODER_FILTER_PATH MAGICK_CODER_MODULE_PATH +# unset GS_LIB GS_ICC_PROFILES GS_RESOURCE_DIR GS_LIB GS_FONTPATH GS + +# +# # set locale (language) explicitly +# # (not needed with 0.48.5 package) +# #export LANG="en_US.UTF-8" +# +# # set MacPorts prefix +# LIBPREFIX="/opt/local" +# +# exec "$LIBPREFIX/bin/python" "$@" + + +# --------------------------------------------------------------------- +# b) to test different 32bit or 64bit system-provided Python versions +# (available on Mac OS X 10.6 Snow Leopard and later versions) +# --------------------------------------------------------------------- + +# # Python 2.5 (system) - Lion: 2.5.6 +# #exec /usr/bin/python2.5 "$@" +# export VERSIONER_PYTHON_VERSION=2.5 +# export VERSIONER_PYTHON_PREFER_32_BIT=yes +# exec /usr/bin/python "$@" + +# # Python 2.6 (system) - Lion: 2.6.7 +# #exec arch -i386 /usr/bin/python2.6 "$@" +# export VERSIONER_PYTHON_VERSION=2.6 +# export VERSIONER_PYTHON_PREFER_32_BIT=yes +# #export VERSIONER_PYTHON_PREFER_32_BIT=no +# exec /usr/bin/python "$@" + +# # Python 2.7 (system) - Lion: 2.7.1 +# #exec arch -i386 /usr/bin/python2.7 "$@" +# export VERSIONER_PYTHON_VERSION=2.7 +# export VERSIONER_PYTHON_PREFER_32_BIT=yes +# #export VERSIONER_PYTHON_PREFER_32_BIT=no +# exec /usr/bin/python "$@" + + +# --------------------------------------------------------------------- +# c) to test different 32bit or 64bit MacPorts-provided Python versions +# (define $LIBPREFIX locally) +# --------------------------------------------------------------------- + +# LIBPREFIX="/opt/local-x11" +# exec "$LIBPREFIX/bin/python2.5" "$@" +# #exec "$LIBPREFIX/bin/python2.6" "@" +# #exec "$LIBPREFIX/bin/python2.7" "@" + + +# --------------------------------------------------------------------- +# d) ... otherwise run default python +# --------------------------------------------------------------------- + +exec /usr/bin/python "$@" + +# eof diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index 6d6d2a87e..2371bc617 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -37,6 +37,7 @@ # Defaults strip=false +add_wrapper=true add_python=true python_dir="" @@ -332,6 +333,12 @@ done # Icons and the rest of the script framework rsync -av --exclude ".svn" "$resdir"/Resources/* "$pkgresources/" +# activate wrapper scripts for python and gimp (optional) +if [ $add_wrapper = "true" ]; then + mv "$pkgbin/gimp-wrapper.sh" "$pkgbin/gimp" + #mv "$pkgbin/python-wrapper.sh" "$pkgbin/python" +fi + # Add python modules if requested if [ ${add_python} = "true" ]; then function install_py_modules () |
