run 2.1 KB
Newer Older
1
#!/bin/sh
2 3 4 5 6 7 8
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
9 10 11

# simple wrapper script to run non-installed executables from workdir

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
12 13
setdefaults()
{
Miklos Vajna's avatar
Miklos Vajna committed
14
    dir=$(realpath "$(pwd)")
Michael Stahl's avatar
Michael Stahl committed
15

Miklos Vajna's avatar
Miklos Vajna committed
16 17 18 19 20 21 22
    while test ! -d "${dir}/instdir/program" ; do
        if test "${dir}" = "/"; then
            echo "error: cannot find \"program\" dir from \"$(pwd)\""
            exit 1
        fi
        dir=$(realpath "${dir}/..")
    done
Michael Stahl's avatar
Michael Stahl committed
23

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
24 25 26 27 28 29 30 31
    exedir="${dir}"/workdir/LinkTarget/Executable
    export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
}

if uname | grep -i CYGWIN >/dev/null; then

    setdefaults

32
    exedir=$(cygpath -m "${dir}"/workdir/LinkTarget/Executable)
Miklos Vajna's avatar
Miklos Vajna committed
33 34
    export URE_BOOTSTRAP=file:///$(cygpath -m "${dir}")/instdir/program/fundamental.ini
    export PATH=${PATH:+$PATH:}"${dir}"/instdir/program
Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
35
    SEARCH_PATH="${PATH}"
Michael Stahl's avatar
Michael Stahl committed
36 37

elif [ $(uname) = Darwin ]; then
38

Miklos Vajna's avatar
Miklos Vajna committed
39
    dir=$(pwd)
40

Miklos Vajna's avatar
Miklos Vajna committed
41 42
    # Get PRODUCTNAME from config_host.mk, LibreOffice or LibreOfficeDev
    eval `grep 'export PRODUCTNAME=' config_host.mk`
43

Miklos Vajna's avatar
Miklos Vajna committed
44 45 46 47
    if [ ! -d "${dir}/instdir/$PRODUCTNAME.app" ]; then
        echo "error: cannot find \"instdir/$PRODUCTNAME.app\" dir in \"$(pwd)\""
        exit 1
    fi
48

Miklos Vajna's avatar
Miklos Vajna committed
49 50
    export URE_BOOTSTRAP=file://"${dir}"/instdir/$PRODUCTNAME.app/Contents/Resources/fundamentalrc
    export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}"${dir}"/instdir/$PRODUCTNAME.app/Contents/Frameworks
Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
51
    SEARCH_PATH="${DYLD_LIBRARY_PATH}"
52

53 54
elif [ $(uname) = Haiku ]; then

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
55
    setdefaults
56 57

    export LIBRARY_PATH=${LIBRARY_PATH:+$LIBRARY_PATH:}"${dir}"/instdir/program
Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
58
    SEARCH_PATH="${LIBRARY_PATH}"
59

60 61
else

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
62
    setdefaults
63

Miklos Vajna's avatar
Miklos Vajna committed
64
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${dir}"/instdir/program
Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
65
    SEARCH_PATH="${LD_LIBRARY_PATH}"
66

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
67
fi
68

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
69 70 71
# echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
# echo "setting search path to: ${SEARCH_PATH}"
# echo "execing: ${exedir}/$1"
72

Jan-Marek Glogowski's avatar
Jan-Marek Glogowski committed
73
exec ${LO_TRACE} "${exedir}/$@"
Miklos Vajna's avatar
Miklos Vajna committed
74 75

# vi:set shiftwidth=4 expandtab: