lok: avoid expensive fetching of a property.
[LibreOffice.git] / bin / run
blob523da3c0e17897e8d368e44e019af96768430500
1 #!/bin/sh
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/.
10 # simple wrapper script to run non-installed executables from workdir
12 setdefaults()
14 dir=$(realpath "$(pwd)")
16 while test ! -d "${dir}/instdir/program" ; do
17 if test "${dir}" = "/"; then
18 echo "error: cannot find \"program\" dir from \"$(pwd)\""
19 exit 1
21 dir=$(realpath "${dir}/..")
22 done
24 exedir="${dir}"/workdir/LinkTarget/Executable
25 export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
28 if uname | grep -i CYGWIN >/dev/null; then
30 setdefaults
32 exedir=$(cygpath -m "${dir}"/workdir/LinkTarget/Executable)
33 export URE_BOOTSTRAP=file:///$(cygpath -m "${dir}")/instdir/program/fundamental.ini
34 export PATH=${PATH:+$PATH:}"${dir}"/instdir/program
35 SEARCH_PATH="${PATH}"
37 elif [ $(uname) = Darwin ]; then
39 dir=$(pwd)
41 # Get PRODUCTNAME from config_host.mk, LibreOffice or LibreOfficeDev
42 eval `grep 'export PRODUCTNAME=' config_host.mk`
44 if [ ! -d "${dir}/instdir/$PRODUCTNAME.app" ]; then
45 echo "error: cannot find \"instdir/$PRODUCTNAME.app\" dir in \"$(pwd)\""
46 exit 1
49 exedir="$dir"/workdir/LinkTarget/Executable
50 export URE_BOOTSTRAP=file://"${dir}"/instdir/$PRODUCTNAME.app/Contents/Resources/fundamentalrc
51 export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}"${dir}"/instdir/$PRODUCTNAME.app/Contents/Frameworks
52 SEARCH_PATH="${DYLD_LIBRARY_PATH}"
54 elif [ $(uname) = Haiku ]; then
56 setdefaults
58 export LIBRARY_PATH=${LIBRARY_PATH:+$LIBRARY_PATH:}"${dir}"/instdir/program
59 SEARCH_PATH="${LIBRARY_PATH}"
61 else
63 setdefaults
65 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${dir}"/instdir/program
66 SEARCH_PATH="${LD_LIBRARY_PATH}"
70 # echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
71 # echo "setting search path to: ${SEARCH_PATH}"
72 # echo "execing: ${exedir}/$1"
74 exec ${LO_TRACE} "${exedir}/$@"
76 # vi:set shiftwidth=4 expandtab: