xref: /trunk/main/desktop/scripts/soffice.sh (revision fce70c9b)
1cdf0e10cSrcweir#!/bin/sh
2*fce70c9bSAndrew Rist#**************************************************************
3*fce70c9bSAndrew Rist#
4*fce70c9bSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
5*fce70c9bSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
6*fce70c9bSAndrew Rist#  distributed with this work for additional information
7*fce70c9bSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
8*fce70c9bSAndrew Rist#  to you under the Apache License, Version 2.0 (the
9*fce70c9bSAndrew Rist#  "License"); you may not use this file except in compliance
10*fce70c9bSAndrew Rist#  with the License.  You may obtain a copy of the License at
11*fce70c9bSAndrew Rist#
12*fce70c9bSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
13*fce70c9bSAndrew Rist#
14*fce70c9bSAndrew Rist#  Unless required by applicable law or agreed to in writing,
15*fce70c9bSAndrew Rist#  software distributed under the License is distributed on an
16*fce70c9bSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*fce70c9bSAndrew Rist#  KIND, either express or implied.  See the License for the
18*fce70c9bSAndrew Rist#  specific language governing permissions and limitations
19*fce70c9bSAndrew Rist#  under the License.
20*fce70c9bSAndrew Rist#
21*fce70c9bSAndrew 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
84cdf0e10cSrcweir"$sd_prog/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
85cdf0e10cSrcweir    ${sd_pagein_args}
86cdf0e10cSrcweir
87cdf0e10cSrcweir# extend the ld_library_path for java: javaldx checks the sofficerc for us
88cdf0e10cSrcweirif [ -x "$sd_prog/../basis-link/ure-link/bin/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)
9230971150SPedro Giffuni	sd_prog1="$sd_prog/../basis-link/program"
9330971150SPedro Giffuni	sd_prog2="$sd_prog/../basis-link/ure-link/lib"
9430971150SPedro Giffuni	LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
9530971150SPedro Giffuni	export LD_LIBRARY_PATH
9630971150SPedro Giffuni	;;
9730971150SPedro Giffuni    esac
98cdf0e10cSrcweir    my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
99cdf0e10cSrcweir        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
100cdf0e10cSrcweir    if [ -n "$my_path" ] ; then
101cdf0e10cSrcweir        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
102cdf0e10cSrcweir        export LD_LIBRARY_PATH
103cdf0e10cSrcweir    fi
104cdf0e10cSrcweirfi
105cdf0e10cSrcweir
106cdf0e10cSrcweirunset XENVIRONMENT
107cdf0e10cSrcweir
108cdf0e10cSrcweir# uncomment line below to disable anti aliasing of fonts
109cdf0e10cSrcweir# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
110cdf0e10cSrcweir
111cdf0e10cSrcweir# uncomment line below if you encounter problems starting soffice on your system
112cdf0e10cSrcweir# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
113cdf0e10cSrcweir
114cdf0e10cSrcweir# read database entries for Adabas D
115cdf0e10cSrcweirif [ -f /etc/adabasrc ]; then
116cdf0e10cSrcweir  . /etc/adabasrc
117cdf0e10cSrcweirfi
118cdf0e10cSrcweir
119cdf0e10cSrcweir# execute soffice binary
120cdf0e10cSrcweir"$sd_prog/$sd_binary" "$@" &
121cdf0e10cSrcweirtrap 'kill -9 $!' TERM
122cdf0e10cSrcweirwait $!
123cdf0e10cSrcweirsd_ret=$?
124cdf0e10cSrcweir
125cdf0e10cSrcweirwhile [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
126cdf0e10cSrcweirdo
127cdf0e10cSrcweir    if [ $sd_ret -eq 79 ]; then
128cdf0e10cSrcweir        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
129cdf0e10cSrcweir    elif [ $sd_ret -eq 81 ]; then
130cdf0e10cSrcweir        "$sd_prog/$sd_binary" "$@" &
131cdf0e10cSrcweir    fi
132cdf0e10cSrcweir
133cdf0e10cSrcweir    wait $!
134cdf0e10cSrcweir    sd_ret=$?
135cdf0e10cSrcweirdone
136cdf0e10cSrcweir
137cdf0e10cSrcweirexit $sd_ret
138