WaE: C6011 Dereferencing NULL pointer warnings
[LibreOffice.git] / bin / run
blobbe78c38d55e6f3334b4a9b030621d7402df52bc4
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 print_usage()
14 echo "This utility can be used to run the executables in this folder:"
15 echo
16 echo " workdir/LinkTarget/Executable"
17 echo
18 echo "Usage:"
19 echo
20 echo " ./bin/run application [parameters]|--list|--help"
21 echo
22 echo "Use --list (same as -list or -l) to get the list of executables"
23 echo "Use --help (same as -help or -h) to get this help"
26 list_executables()
28 echo "Listing executables inside workdir/LinkTarget/Executable folder:"
29 if uname | grep -i CYGWIN >/dev/null
30 then
31 echo
32 find workdir/LinkTarget/Executable -iname "*.bat" -printf "%P\n"
33 find workdir/LinkTarget/Executable -iname "*.exe" -printf "%P\n"
34 else
35 find workdir/LinkTarget/Executable -executable -printf "%P\n"
39 print_executable_name()
41 echo "Setting env variables and running workdir/LinkTarget/Executable/$1"
44 setdefaults()
46 dir=$(realpath "$(pwd)")
48 while test ! -d "${dir}/instdir/program" ; do
49 if test "${dir}" = "/"; then
50 echo "error: cannot find \"program\" dir from \"$(pwd)\""
51 exit 1
53 dir=$(realpath "${dir}/..")
54 done
56 exedir="${dir}"/workdir/LinkTarget/Executable
57 export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
60 case "$1" in
61 ""|"-h"|"-help"|"--help")
62 print_usage; exit 1;;
63 "-l"|"-list"|"--list")
64 list_executables; exit 0;;
65 *) print_executable_name $1;;
66 esac
68 if uname | grep -i CYGWIN >/dev/null; then
70 setdefaults
72 exedir=$(cygpath -m "${dir}"/workdir/LinkTarget/Executable)
73 export URE_BOOTSTRAP=file:///$(cygpath -m "${dir}")/instdir/program/fundamental.ini
74 export PATH="${dir}/instdir/program${PATH:+:$PATH}"
75 SEARCH_PATH="${PATH}"
77 elif [ $(uname) = Darwin ]; then
79 dir=$(pwd)
81 # Get PRODUCTNAME from config_host.mk, LibreOffice or LibreOfficeDev
82 eval `grep 'export PRODUCTNAME=' config_host.mk`
84 if [ ! -d "${dir}/instdir/$PRODUCTNAME.app" ]; then
85 echo "error: cannot find \"instdir/$PRODUCTNAME.app\" dir in \"$(pwd)\""
86 exit 1
89 exedir="$dir"/workdir/LinkTarget/Executable
90 export URE_BOOTSTRAP=file://"${dir}"/instdir/$PRODUCTNAME.app/Contents/Resources/fundamentalrc
91 export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}"${dir}"/instdir/$PRODUCTNAME.app/Contents/Frameworks
92 SEARCH_PATH="${DYLD_LIBRARY_PATH}"
94 elif [ $(uname) = Haiku ]; then
96 setdefaults
98 export LIBRARY_PATH=${LIBRARY_PATH:+$LIBRARY_PATH:}"${dir}"/instdir/program
99 SEARCH_PATH="${LIBRARY_PATH}"
101 else
103 setdefaults
105 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${dir}"/instdir/program
106 SEARCH_PATH="${LD_LIBRARY_PATH}"
110 # echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
111 # echo "setting search path to: ${SEARCH_PATH}"
112 # echo "execing: ${exedir}/$1"
114 exec ${LO_TRACE} "${exedir}/$@"
116 # vi:set shiftwidth=4 expandtab: