summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2014-08-21 10:26:09 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-08-21 10:26:09 +0000
commitb0641984cc0670a084bc5945e28100b154f57178 (patch)
tree79959735bb78c71bc9afc1f2f25b07272bf0e4c5 /packaging
parentbuild scripts: refactor tests based on OS X version (diff)
downloadinkscape-b0641984cc0670a084bc5945e28100b154f57178.tar.gz
inkscape-b0641984cc0670a084bc5945e28100b154f57178.zip
launcher scripts: move fc-cache alert to script, define xdg setup in single location and source it from script and openDoc
(bzr r13506.1.36)
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/macosx/Resources/alert_fccache.sh24
-rwxr-xr-xpackaging/macosx/Resources/bin/inkscape17
-rwxr-xr-xpackaging/macosx/Resources/openDoc3
-rwxr-xr-xpackaging/macosx/Resources/script14
-rwxr-xr-xpackaging/macosx/Resources/xdg_setup.sh13
-rw-r--r--packaging/macosx/ScriptExec/main.c2
6 files changed, 54 insertions, 19 deletions
diff --git a/packaging/macosx/Resources/alert_fccache.sh b/packaging/macosx/Resources/alert_fccache.sh
new file mode 100755
index 000000000..110c89940
--- /dev/null
+++ b/packaging/macosx/Resources/alert_fccache.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+ALERT_SCRIPT="$(cat << EOM
+try
+ tell application "SystemUIServer"
+ display dialog "While Inkscape is open, its windows can be displayed or hidden by displaying or hiding the X11 application.
+
+The first time this version of Inkscape is run it may take several minutes before the main window is displayed while font caches are built." buttons {"OK"} default button 1 with icon 2
+ end tell
+end try
+EOM)"
+
+if [ -z "$INK_CACHE_DIR" ]; then
+ export INK_CACHE_DIR="${HOME}/.cache/inkscape"
+ mkdir -p "$INK_CACHE_DIR"
+ [ $_DEBUG ] && echo "INK_CACHE_DIR: falling back to $INK_CACHE_DIR"
+fi
+
+# Warn the user about time-consuming generation of fontconfig caches.
+if [ ! -f "${INK_CACHE_DIR}/.fccache-new" ]; then
+ alert_result=$(osascript -e "$ALERT_SCRIPT")
+ mkdir -p "$INK_CACHE_DIR"
+ touch "${INK_CACHE_DIR}/.fccache-new"
+fi
diff --git a/packaging/macosx/Resources/bin/inkscape b/packaging/macosx/Resources/bin/inkscape
index 8dd41a03b..59d6f0953 100755
--- a/packaging/macosx/Resources/bin/inkscape
+++ b/packaging/macosx/Resources/bin/inkscape
@@ -39,17 +39,12 @@ PYTHON_VERS=`python -V 2>&1 | cut -c 8-10`
export PYTHONPATH="$TOP/python/site-packages/$ARCH/$PYTHON_VERS"
# 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
-export XDG_CACHE_HOME="${HOME}/.cache"
-export XDG_CONFIG_HOME="${HOME}/.config"
-export XDG_DATA_HOME="${HOME}/.local/share"
-
-mkdir -p "$XDG_CACHE_HOME"
-mkdir -p "$XDG_CONFIG_HOME"
-mkdir -p "$XDG_DATA_HOME"
-
-# TODO: keep in sync with ScriptExec and Resources/script
-INK_CACHE_DIR="${XDG_CACHE_HOME}/inkscape"
-mkdir -p "$INK_CACHE_DIR"
+# fallback
+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"
diff --git a/packaging/macosx/Resources/openDoc b/packaging/macosx/Resources/openDoc
index fde8276b1..63e803540 100755
--- a/packaging/macosx/Resources/openDoc
+++ b/packaging/macosx/Resources/openDoc
@@ -2,9 +2,12 @@
#
# 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" "$@"
diff --git a/packaging/macosx/Resources/script b/packaging/macosx/Resources/script
index a418cca45..de839484d 100755
--- a/packaging/macosx/Resources/script
+++ b/packaging/macosx/Resources/script
@@ -2,21 +2,21 @@
#
# 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)"
-
-# Warn the user about time-consuming generation of fontconfig caches.
-# TODO: Somehow keep in sync with ScriptExec and bin/inkscape.
-# Ideally refer to $XDG_CACHE_HOME/inkscape everywhere, but how?
-test -f "${HOME}/.cache/inkscape/.fccache-new" || exit 12
+#export _DEBUG=true
+CWD="$(cd "$(dirname "$0")" && pwd)"
+source "${CWD}/xdg_setup.sh"
+source "${CWD}/alert_fccache.sh"
BASE="$(echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//')"
cd "$BASE"
-exec "$CWD/bin/inkscape" "$@"
+
# 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.
+exec "$CWD/bin/inkscape" "$@"
diff --git a/packaging/macosx/Resources/xdg_setup.sh b/packaging/macosx/Resources/xdg_setup.sh
new file mode 100755
index 000000000..ec7fca648
--- /dev/null
+++ b/packaging/macosx/Resources/xdg_setup.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+export XDG_CACHE_HOME="${HOME}/.cache"
+export XDG_CONFIG_HOME="${HOME}/.config"
+export XDG_DATA_HOME="${HOME}/.local/share"
+
+mkdir -p "$XDG_CACHE_HOME"
+mkdir -p "$XDG_CONFIG_HOME"
+mkdir -p "$XDG_DATA_HOME"
+
+export INK_CACHE_DIR="${XDG_CACHE_HOME}/inkscape"
+mkdir -p "$INK_CACHE_DIR"
+
diff --git a/packaging/macosx/ScriptExec/main.c b/packaging/macosx/ScriptExec/main.c
index 37b3a4ff3..e3f066d70 100644
--- a/packaging/macosx/ScriptExec/main.c
+++ b/packaging/macosx/ScriptExec/main.c
@@ -227,6 +227,7 @@ static void ShowFirstStartWarningDialog(void)
//////////////////////////////////
// Handler for when fontconfig caches need to be generated
+// TODO: remove (alert and touch moved to launcher script)
//////////////////////////////////
static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall,
EventRef theEvent, void *userData)
@@ -241,7 +242,6 @@ static OSStatus FCCacheFailedHandler(EventHandlerCallRef theHandlerCall,
ShowFirstStartWarningDialog();
// Note that we've seen the warning.
- // TODO: somehow make this aware of $XDG_CACHE_HOME as set in the launcher
system("test -d \"$HOME/.cache/inkscape\" || mkdir -p \"$HOME/.cache/inkscape\"; "
"touch \"$HOME/.cache/inkscape/.fccache-new\"");
// Rerun now.