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
14 echo "This utility can be used to run the executables in this folder:"
16 echo " workdir/LinkTarget/Executable"
20 echo " ./bin/run application [parameters]|--list|--help"
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"
28 echo "Listing executables inside workdir/LinkTarget/Executable folder:"
29 if uname |
grep -i CYGWIN
>/dev
/null
32 find workdir
/LinkTarget
/Executable
-iname "*.bat" -printf "%P\n"
33 find workdir
/LinkTarget
/Executable
-iname "*.exe" -printf "%P\n"
35 find workdir
/LinkTarget
/Executable
-executable -printf "%P\n"
39 print_executable_name
()
41 echo "Setting env variables and running workdir/LinkTarget/Executable/$1"
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)\""
53 dir
=$
(realpath
"${dir}/..")
56 exedir
="${dir}"/workdir
/LinkTarget
/Executable
57 export URE_BOOTSTRAP
=file://"${dir}"/instdir
/program
/fundamentalrc
61 ""|
"-h"|
"-help"|
"--help")
63 "-l"|
"-list"|
"--list")
64 list_executables
; exit 0;;
65 *) print_executable_name
$1;;
68 if uname |
grep -i CYGWIN
>/dev
/null
; then
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}"
77 elif [ $
(uname
) = Darwin
]; then
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)\""
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
98 export LIBRARY_PATH
=${LIBRARY_PATH:+$LIBRARY_PATH:}"${dir}"/instdir
/program
99 SEARCH_PATH
="${LIBRARY_PATH}"
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: