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 line below to disable anti aliasing of fonts
35 # SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
37 # uncomment line below if you encounter problems starting soffice on your system
38 # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
40 #@JITC_PROCESSOR_TYPE_EXPORT@
42 # resolve installation directory
45 while [ -h "$sd_res" ] ; do
46 sd_dirname
=$
(dirname "$sd_res")
47 cd "$sd_dirname" ||
exit $?
48 sd_basename
=$
(basename "$sd_res")
49 sd_res
=$
(ls -l "$sd_basename" |
sed "s/.*$sd_basename -> //g")
51 sd_dirname
=$
(dirname "$sd_res")
52 cd "$sd_dirname" ||
exit $?
54 cd "$sd_cwd" ||
exit $?
56 # linked build needs additional settings
57 if [ -e "${sd_prog}/ooenv" ] ; then
58 # shellcheck source=../../instsetoo_native/ooenv
62 # try to get some debug output?
68 # count number of selected checks; only one is allowed
71 # force the --valgrind option if the VALGRIND variable is set
72 test -n "$VALGRIND" && EXTRAOPT
="--valgrind"
74 # force the --record option if the RR variable is set
75 test -n "$RR" && EXTRAOPT
="--record"
77 for arg
in "$@" $EXTRAOPT ; do
80 if which rr
>/dev
/null
2>&1 ; then
84 echo "Error: Can't find the tool \"rr\", --record option will be ignored."
89 if which gdb
>/dev
/null
2>&1 ; then
90 GDBTRACECHECK
="gdb -nx --command=$sd_prog/gdbtrace --args"
93 echo "Error: Can't find the tool \"gdb\", --backtrace option will be ignored."
98 if which strace
>/dev
/null
2>&1 ; then
99 STRACECHECK
="strace -o strace.log -f -tt -s 256"
102 echo "Error: Can't find the tool \"strace\", --strace option will be ignored."
107 test -n "$VALGRINDCHECK" && continue;
108 if which valgrind
>/dev
/null
2>&1 ; then
109 # another valgrind tool might be forced via the environment variable
110 test -z "$VALGRIND" && VALGRIND
="memcheck"
111 # --trace-children-skip is pretty useful but supported only with valgrind >= 3.6.0
112 valgrind_ver
=$
(valgrind
--version |
sed -e "s/valgrind-//")
113 valgrind_ver_maj
=$
(echo "$valgrind_ver" |
awk -F.
'{ print $1 }')
114 valgrind_ver_min
=$
(echo "$valgrind_ver" |
awk -F.
'{ print $2 }')
116 if [ "$valgrind_ver_maj" -gt 3 ] ||
( [ "$valgrind_ver_maj" -eq 3 ] && [ "$valgrind_ver_min" -ge 6 ] ) ; then
117 valgrind_skip
='--trace-children-skip=*/java,*/gij'
119 # finally set the valgrind check
120 VALGRINDCHECK
="valgrind --tool=$VALGRIND --trace-children=yes $valgrind_skip --num-callers=50 --error-limit=no"
121 echo "use kill -SIGUSR2 pid to dump traces of active allocations"
124 helgrind|memcheck|massif|exp-dhat
)
125 export G_SLICE
=always-malloc
126 export GLIBCXX_FORCE_NEW
=1
130 echo "Error: Can't find the tool \"valgrind\", --valgrind option will be ignored"
137 if echo "$checks" |
grep -q "cc" ; then
138 echo "Error: The debug options --record, --backtrace, --strace, and --valgrind cannot be used together."
139 echo " Please, use them one by one."
143 case "$(uname -s)" in
144 NetBSD|OpenBSD|DragonFly
)
145 # this is a temporary hack until we can live with the default search paths
146 LD_LIBRARY_PATH
="$sd_prog${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
147 JAVA_HOME
=$
(javaPathHelper
-h libreoffice-java
2> /dev
/null
)
148 export LD_LIBRARY_PATH
149 if [ -n "${JAVA_HOME}" ]; then
154 LIBPATH
="$sd_prog${LIBPATH:+:$LIBPATH}"
159 # restore locale setting
160 LC_ALL
="$LO_SAVE_LC_ALL"
162 # run soffice.bin directly when you want to get the backtrace
163 if [ -n "$GDBTRACECHECK" ] ; then
164 exec $GDBTRACECHECK "$sd_prog/soffice.bin" "$@"
167 # valgrind --log-file=valgrind.log does not work well with --trace-children=yes
168 if [ -n "$VALGRINDCHECK" ] && [ -z "$VALGRIND" ] ; then
169 echo "redirecting the standard and the error output to valgrind.log"
170 exec > valgrind.log
2>&1
173 # oosplash does the rest: forcing pages in, javaldx etc. are
174 exec $RRCHECK $VALGRINDCHECK $STRACECHECK "$sd_prog/oosplash" "$@"