xref: /trunk/main/desktop/scripts/soffice.sh (revision 910823ae)
1cdf0e10cSrcweir#!/bin/sh
2fce70c9bSAndrew Rist#**************************************************************
3fce70c9bSAndrew Rist#
4fce70c9bSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5fce70c9bSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6fce70c9bSAndrew Rist#  distributed with this work for additional information
7fce70c9bSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8fce70c9bSAndrew Rist#  to you under the Apache License, Version 2.0 (the
9fce70c9bSAndrew Rist#  "License"); you may not use this file except in compliance
10fce70c9bSAndrew Rist#  with the License.  You may obtain a copy of the License at
11fce70c9bSAndrew Rist#
12fce70c9bSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13fce70c9bSAndrew Rist#
14fce70c9bSAndrew Rist#  Unless required by applicable law or agreed to in writing,
15fce70c9bSAndrew Rist#  software distributed under the License is distributed on an
16fce70c9bSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17fce70c9bSAndrew Rist#  KIND, either express or implied.  See the License for the
18fce70c9bSAndrew Rist#  specific language governing permissions and limitations
19fce70c9bSAndrew Rist#  under the License.
20fce70c9bSAndrew Rist#
21fce70c9bSAndrew Rist#**************************************************************
22cdf0e10cSrcweir
23cdf0e10cSrcweir#
24cdf0e10cSrcweir# STAR_PROFILE_LOCKING_DISABLED=1
25cdf0e10cSrcweir# export STAR_PROFILE_LOCKING_DISABLED
26cdf0e10cSrcweir#
27cdf0e10cSrcweir
28cdf0e10cSrcweir# file locking now enabled by default
29cdf0e10cSrcweirSAL_ENABLE_FILE_LOCKING=1
30cdf0e10cSrcweirexport SAL_ENABLE_FILE_LOCKING
31cdf0e10cSrcweir
32cdf0e10cSrcweir# Uncomment the line below if you suspect that OpenGL is not
33cdf0e10cSrcweir# working on your system.
34cdf0e10cSrcweir# SAL_NOOPENGL=true; export SAL_NOOPENGL
35cdf0e10cSrcweir
36cdf0e10cSrcweir# The following is needed on Linux PPC with IBM j2sdk142:
37cdf0e10cSrcweir#@# export JITC_PROCESSOR_TYPE=6
38cdf0e10cSrcweir
39cdf0e10cSrcweir# resolve installation directory
40cdf0e10cSrcweirsd_cwd=`pwd`
41cdf0e10cSrcweirsd_res=$0
42cdf0e10cSrcweirwhile [ -h "$sd_res" ] ; do
43cdf0e10cSrcweir    cd "`dirname "$sd_res"`"
44cdf0e10cSrcweir    sd_basename=`basename "$sd_res"`
45cdf0e10cSrcweir    sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
46cdf0e10cSrcweirdone
47cdf0e10cSrcweircd "`dirname "$sd_res"`"
48cdf0e10cSrcweirsd_prog=`pwd`
49cdf0e10cSrcweircd "$sd_cwd"
50cdf0e10cSrcweir
51cdf0e10cSrcweirsd_binary=`basename "$0"`.bin
52cdf0e10cSrcweir
53cdf0e10cSrcweir#collect all bootstrap variables specified on the command line
54cdf0e10cSrcweir#so that they can be passed as arguments to javaldx later on
55cdf0e10cSrcweirfor arg in $@
56cdf0e10cSrcweirdo
57cdf0e10cSrcweir  case "$arg" in
58cdf0e10cSrcweir       -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
59cdf0e10cSrcweir  esac
60cdf0e10cSrcweirdone
61cdf0e10cSrcweir
62cdf0e10cSrcweir# pagein
63cdf0e10cSrcweirsd_pagein_args=@pagein-common
64cdf0e10cSrcweirfor sd_arg in "$@"; do
65cdf0e10cSrcweir    case ${sd_arg} in
66cdf0e10cSrcweir    -calc)
67cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-calc"
68cdf0e10cSrcweir        break;
69cdf0e10cSrcweir        ;;
70cdf0e10cSrcweir    -draw)
71cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-draw"
72cdf0e10cSrcweir        break;
73cdf0e10cSrcweir        ;;
74cdf0e10cSrcweir    -impress)
75cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-impress"
76cdf0e10cSrcweir        break;
77cdf0e10cSrcweir        ;;
78cdf0e10cSrcweir    -writer)
79cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-writer"
80cdf0e10cSrcweir        break;
81cdf0e10cSrcweir        ;;
82cdf0e10cSrcweir    esac
83cdf0e10cSrcweirdone
84*910823aeSJürgen Schmidt"$sd_prog/pagein" -L"$sd_prog" \
85cdf0e10cSrcweir    ${sd_pagein_args}
86cdf0e10cSrcweir
87cdf0e10cSrcweir# extend the ld_library_path for java: javaldx checks the sofficerc for us
88*910823aeSJürgen Schmidtif [ -x "$sd_prog/javaldx" ] ; then
8930971150SPedro Giffuni    # this is a temporary hack until we can live with the default search paths
9030971150SPedro Giffuni    case "`uname -s`" in
9130971150SPedro Giffuni    FreeBSD)
92*910823aeSJürgen Schmidt	sd_prog1="$sd_prog"
93*910823aeSJürgen Schmidt	LD_LIBRARY_PATH=$sd_prog1:${LD_LIBRARY_PATH}}
9430971150SPedro Giffuni	export LD_LIBRARY_PATH
9530971150SPedro Giffuni	;;
9630971150SPedro Giffuni    esac
97*910823aeSJürgen Schmidt    my_path=`"$sd_prog/javaldx" $BOOTSTRAPVARS \
98cdf0e10cSrcweir        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
99cdf0e10cSrcweir    if [ -n "$my_path" ] ; then
100cdf0e10cSrcweir        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
101cdf0e10cSrcweir        export LD_LIBRARY_PATH
102cdf0e10cSrcweir    fi
103cdf0e10cSrcweirfi
104cdf0e10cSrcweir
105cdf0e10cSrcweirunset XENVIRONMENT
106cdf0e10cSrcweir
107cdf0e10cSrcweir# uncomment line below to disable anti aliasing of fonts
108cdf0e10cSrcweir# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
109cdf0e10cSrcweir
110cdf0e10cSrcweir# uncomment line below if you encounter problems starting soffice on your system
111cdf0e10cSrcweir# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
112cdf0e10cSrcweir
113cdf0e10cSrcweir# read database entries for Adabas D
114cdf0e10cSrcweirif [ -f /etc/adabasrc ]; then
115cdf0e10cSrcweir  . /etc/adabasrc
116cdf0e10cSrcweirfi
117cdf0e10cSrcweir
118cdf0e10cSrcweir# execute soffice binary
119cdf0e10cSrcweir"$sd_prog/$sd_binary" "$@" &
120cdf0e10cSrcweirtrap 'kill -9 $!' TERM
121cdf0e10cSrcweirwait $!
122cdf0e10cSrcweirsd_ret=$?
123cdf0e10cSrcweir
124cdf0e10cSrcweirwhile [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
125cdf0e10cSrcweirdo
126cdf0e10cSrcweir    if [ $sd_ret -eq 79 ]; then
127cdf0e10cSrcweir        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
128cdf0e10cSrcweir    elif [ $sd_ret -eq 81 ]; then
129cdf0e10cSrcweir        "$sd_prog/$sd_binary" "$@" &
130cdf0e10cSrcweir    fi
131cdf0e10cSrcweir
132cdf0e10cSrcweir    wait $!
133cdf0e10cSrcweir    sd_ret=$?
134cdf0e10cSrcweirdone
135cdf0e10cSrcweir
136cdf0e10cSrcweirexit $sd_ret
137