summaryrefslogtreecommitdiff
path: root/desktop/scripts/soffice.sh
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/scripts/soffice.sh')
-rw-r--r--desktop/scripts/soffice.sh62
1 files changed, 56 insertions, 6 deletions
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index a268536181..85108530bf 100644
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -54,7 +54,36 @@ cd "`dirname "$sd_res"`"
sd_prog=`pwd`
cd "$sd_cwd"
-sd_binary=`basename "$0"`.bin
+# linked build needs additional settings
+if [ -e $sd_prog/ooenv ] ; then
+ . $sd_prog/ooenv
+fi
+
+if [ "$VALGRIND" != "" ]; then
+ VALGRINDCHECK="valgrind --tool=$VALGRIND --error-exitcode=101"
+ export VALGRINDCHECK
+ G_SLICE=always-malloc
+ export G_SLICE
+fi
+
+sd_binary=`basename "$0" | sed 's/libreoffice/soffice/g'`.bin
+
+case "`uname -s`" in
+NetBSD|OpenBSD) # this is a temporary hack until we can live with the default search paths
+ sd_prog1="$sd_prog/../basis-link/program"
+ sd_prog2="$sd_prog/../basis-link/ure-link/lib"
+ LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+ JAVA_HOME=$(javaPathHelper -h libreoffice-java 2> /dev/null)
+ export LD_LIBRARY_PATH
+ if [ -n "${JAVA_HOME}" ]; then
+ export JAVA_HOME
+ fi
+ ;;
+AIX)
+ LIBPATH=$sd_prog:$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LIBPATH:+:$LIBPATH}
+ export LIBPATH
+ ;;
+esac
#collect all bootstrap variables specified on the command line
#so that they can be passed as arguments to javaldx later on
@@ -65,23 +94,44 @@ do
esac
done
+# test for availability of the fast external splash
+for arg in $@; do
+ case "$arg" in
+ --nologo|-nologo|--no-oosplash|-no-oosplash|--version|-version|--help|-help|-h|-\?)
+ no_oosplash=y
+ ;;
+ esac
+done
+
+# Setup our app as oosplash, but try to avoid executing pagein,
+# and other expensive environment setup pieces wherever possible
+# for a second started office
+if [ "$sd_binary" = "soffice.bin" -a -x "$sd_prog/oosplash.bin" ] && [ "$no_oosplash" != "y" ] ; then
+ sd_binary="oosplash.bin"
+
+ # try to connect to a running instance early
+ if $VALGRINDCHECK "$sd_prog/$sd_binary" -qsend-and-report "$@" ; then
+ exit 0
+ fi
+fi
+
# pagein
sd_pagein_args=@pagein-common
for sd_arg in "$@"; do
case ${sd_arg} in
- -calc)
+ --calc|-calc)
sd_pagein_args="${sd_pagein_args} @pagein-calc"
break;
;;
- -draw)
+ --draw|-draw)
sd_pagein_args="${sd_pagein_args} @pagein-draw"
break;
;;
- -impress)
+ --impress|-impress)
sd_pagein_args="${sd_pagein_args} @pagein-impress"
break;
;;
- -writer)
+ --writer|-writer)
sd_pagein_args="${sd_pagein_args} @pagein-writer"
break;
;;
@@ -114,7 +164,7 @@ if [ -f /etc/adabasrc ]; then
fi
# execute soffice binary
-"$sd_prog/$sd_binary" "$@" &
+$VALGRINDCHECK "$sd_prog/$sd_binary" "$@" &
trap 'kill -9 $!' TERM
wait $!
sd_ret=$?