3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # use POSIX locale for well-defined tool output
21 LO_SAVE_LC_ALL
="$LC_ALL"
26 # STAR_PROFILE_LOCKING_DISABLED=1
27 # export STAR_PROFILE_LOCKING_DISABLED
30 # file locking now enabled by default
31 SAL_ENABLE_FILE_LOCKING
=1
32 export SAL_ENABLE_FILE_LOCKING
34 # Uncomment the line below if you suspect that OpenGL is not
35 # working on your system.
36 # SAL_NOOPENGL=true; export SAL_NOOPENGL
38 # uncomment line below to disable anti aliasing of fonts
39 # SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
41 # uncomment line below if you encounter problems starting soffice on your system
42 # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
44 #@JITC_PROCESSOR_TYPE_EXPORT@
46 # resolve installation directory
49 while [ -h "$sd_res" ] ; do
50 cd "`dirname "$sd_res"`"
51 sd_basename
=`basename "$sd_res"`
52 sd_res
=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
54 cd "`dirname "$sd_res"`"
58 # linked build needs additional settings
59 if [ -e "${sd_prog}/ooenv" ] ; then
63 # try to get some debug output?
68 # count number of selected checks; only one is allowed
70 # force the --valgrind option if the VALGRIND variable is set
71 test -n "$VALGRIND" && VALGRINDOPT
="--valgrind" || VALGRINDOPT
=
73 for arg
in $@
$VALGRINDOPT ; do
76 if which gdb
>/dev
/null
2>&1 ; then
77 GDBTRACECHECK
="gdb -nx --command=$sd_prog/gdbtrace --args"
80 echo "Error: Can't find the tool \"gdb\", --backtrace option will be ignored."
85 if which strace
>/dev
/null
2>&1 ; then
86 STRACECHECK
="strace -o strace.log -f -tt -s 256"
89 echo "Error: Can't find the tool \"strace\", --strace option will be ignored."
94 test -n "$VALGRINDCHECK" && continue;
95 if which valgrind
>/dev
/null
2>&1 ; then
96 # another valgrind tool might be forced via the environment variable
97 test -z "$VALGRIND" && VALGRIND
="memcheck"
98 # --trace-children-skip is pretty useful but supported only with valgrind >= 3.6.0
99 valgrind_ver
=`valgrind --version | sed -e "s/valgrind-//"`
100 valgrind_ver_maj
=`echo $valgrind_ver | awk -F. '{ print \$1 }'`
101 valgrind_ver_min
=`echo $valgrind_ver | awk -F. '{ print \$2 }'`
103 if [ "$valgrind_ver_maj" -gt 3 -o \
( "$valgrind_ver_maj" -eq 3 -a "$valgrind_ver_min" -ge 6 \
) ] ; then
104 valgrind_skip
='--trace-children-skip=*/java,*/gij'
106 # finally set the valgrind check
107 VALGRINDCHECK
="valgrind --tool=$VALGRIND --trace-children=yes $valgrind_skip --num-callers=50 --error-limit=no"
108 echo "use kill -SIGUSR2 pid to dump traces of active allocations"
112 export G_SLICE
=always-malloc
113 export GLIBCXX_FORCE_NEW
=1
117 echo "Error: Can't find the tool \"valgrind\", --valgrind option will be ignored"
124 if echo "$checks" |
grep -q "cc" ; then
125 echo "Error: The debug options --backtrace, --strace, and --valgrind cannot be used together."
126 echo " Please, use them one by one."
131 NetBSD|OpenBSD|FreeBSD|DragonFly
)
132 # this is a temporary hack until we can live with the default search paths
133 LD_LIBRARY_PATH
="$sd_prog${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
134 JAVA_HOME
=$
(javaPathHelper
-h libreoffice-java
2> /dev
/null
)
135 export LD_LIBRARY_PATH
136 if [ -n "${JAVA_HOME}" ]; then
141 LIBPATH
="$sd_prog${LIBPATH:+:$LIBPATH}"
146 # restore locale setting
147 LC_ALL
="$LO_SAVE_LC_ALL"
149 # run soffice.bin directly when you want to get the backtrace
150 if [ -n "$GDBTRACECHECK" ] ; then
151 exec $GDBTRACECHECK "$sd_prog/soffice.bin" "$@"
154 # valgrind --log-file=valgrind.log does not work well with --trace-children=yes
155 if [ -n "$VALGRINDCHECK" -a -z "$VALGRIND" ] ; then
156 echo "redirecting the standard and the error output to valgrind.log"
157 exec > valgrind.log
2>&1
160 # oosplash does the rest: forcing pages in, javaldx etc. are
161 exec $VALGRINDCHECK $STRACECHECK "$sd_prog/oosplash" "$@"