tdf#163956 calculate line height differently in FORMTEXT
[LibreOffice.git] / odk / config / setsdkenv_unix.sh.in
blob28cf2a6c3c3ead509d751ee7c05884555ecd697c
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/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # This script starts a new shell and sets all environment variables, which
21 # are necessary for building the examples of the Office Development Kit.
22 # The Script was developed for the operating systems Solaris, Linux and MacOS.
24 # The SDK name
25 OO_SDK_NAME=@OO_SDK_NAME@
26 export OO_SDK_NAME
28 # Installation directory of the Software Development Kit.
29 # Example: OO_SDK_HOME=/opt/libreoffice/basis3.4/sdk
30 OO_SDK_HOME='@OO_SDK_HOME@'
32 # Office installation directory.
33 # Example: OFFICE_HOME=/opt/libreoffice
34 OFFICE_HOME='@OFFICE_HOME@'
35 export OFFICE_HOME
37 # Directory of the make command.
38 # Example: OO_SDK_MAKE_HOME=/usr/bin
39 OO_SDK_MAKE_HOME=@OO_SDK_MAKE_HOME@
41 # Directory of the zip command.
42 # Example: OO_SDK_ZIP_HOME=/usr/bin
43 OO_SDK_ZIP_HOME=@OO_SDK_ZIP_HOME@
45 # Directory of the cat command.
46 # Example: OO_SDK_CAT_HOME=/usr/bin
47 OO_SDK_CAT_HOME=@OO_SDK_CAT_HOME@
49 # Directory of the sed command.
50 # Example: OO_SDK_SED_HOME=/usr/bin
51 OO_SDK_SED_HOME=@OO_SDK_SED_HOME@
53 # Directory of the C++ compiler.
54 # Example: OO_SDK_CPP_HOME=/usr/bin
55 OO_SDK_CPP_HOME=@OO_SDK_CPP_HOME@
57 # Directory of the .NET SDK.
58 # Example: OO_SDK_DOTNET_ROOT=/usr/lib/dotnet
59 OO_SDK_DOTNET_ROOT=@OO_SDK_DOTNET_ROOT@
61 # Directory of the Java SDK.
62 # Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
63 OO_SDK_JAVA_HOME=@OO_SDK_JAVA_HOME@
65 # Special output directory
66 # Example: OO_SDK_OUTPUT_DIR=$HOME
67 OO_SDK_OUTPUT_DIR=@OO_SDK_OUTPUT_DIR@
69 # Environment variable to enable auto deployment of example components
70 # Example: SDK_AUTO_DEPLOYMENT=YES
71 SDK_AUTO_DEPLOYMENT=@SDK_AUTO_DEPLOYMENT@
72 export SDK_AUTO_DEPLOYMENT
74 # Check installation path for the OpenOffice Development Kit.
75 if [ -z "${OO_SDK_HOME}" ]
76 then
77 echo Error: Please insert a correct value for the variable OO_SDK_HOME.
78 exit 0
81 export OO_SDK_HOME
83 # Get the operating system.
84 sdk_platform=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
86 # Set the directory name.
87 programdir=program
88 sdk_lo_java_dir=program/classes
89 case ${sdk_platform} in
90 darwin*)
91 programdir="Contents/MacOS"
92 sdk_lo_java_dir=Contents/Resources/java
94 esac
96 # Set office program path (only set when using an Office).
97 OFFICE_PROGRAM_PATH=${OFFICE_HOME}/${programdir}
98 export OFFICE_PROGRAM_PATH
100 # Set UNO path, necessary to ensure that the cpp examples using the
101 # new UNO bootstrap mechanism use the configured office installation (only set
102 # when using an Office).
103 UNO_PATH=${OFFICE_PROGRAM_PATH}
104 export UNO_PATH
106 case ${sdk_platform} in
107 darwin*)
108 OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
109 OO_SDK_URE_LIB_DIR=${OFFICE_HOME}/Contents/Frameworks
110 OO_SDK_URE_JAVA_DIR=${OFFICE_HOME}/${sdk_lo_java_dir}
113 OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
114 OO_SDK_URE_LIB_DIR=${OFFICE_PROGRAM_PATH}
115 OO_SDK_URE_JAVA_DIR=${OFFICE_PROGRAM_PATH}/classes
117 esac
118 export OO_SDK_URE_BIN_DIR
119 export OO_SDK_URE_LIB_DIR
120 export OO_SDK_URE_JAVA_DIR
122 OO_SDK_OUT=$OO_SDK_HOME
123 # Prepare appropriate output directory.
124 if [ -n "${OO_SDK_OUTPUT_DIR}" ]
125 then
126 OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
127 export OO_SDK_OUT
130 # Set the directory name.
131 case ${sdk_platform} in
132 solaris*)
133 sdk_proctype=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
134 if [ "${sdk_proctype}" = "sparc" ]
135 then
136 directoryname=solsparc
137 platform='Solaris Sparc'
138 else
139 directoryname=solintel
140 platform='Solaris x86'
142 comid=gcc3
143 soext=so
144 exampleout=SOLARISexample.out
145 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
146 export LD_LIBRARY_PATH
149 darwin*)
150 directoryname=macosx
151 comid=gcc3
152 soext=dylib
153 exampleout=MACOSXexample.out
154 platform=MacOSX
155 DYLD_LIBRARY_PATH=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
156 export DYLD_LIBRARY_PATH
159 linux-gnu*)
160 directoryname=linux
161 comid=gcc3
162 soext=so
163 exampleout=LINUXexample.out
164 platform=Linux
165 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
166 export LD_LIBRARY_PATH
169 freebsd*)
170 directoryname=freebsd
171 comid=gcc3
172 soext=so
173 exampleout=FREEBSDexample.out
174 platform=FreeBSD
175 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
176 export LD_LIBRARY_PATH
178 if [ -e "/sbin/sysctl" ]
179 then
180 OSVERSION=`/sbin/sysctl -n kern.osreldate`
181 else
182 OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
184 if [ $OSVERSION -lt 500016 ]
185 then
186 PTHREAD_CFLAGS=-D_THREAD_SAFE
187 PTHREAD_LIBS=-pthread
188 export PTHREAD_CFLAGS
189 export PTHREAD_LIBS
190 elif [ $OSVERSION -lt 502102 ]
191 then
192 PTHREAD_CFLAGS=-D_THREAD_SAFE
193 PTHREAD_LIBS=-lc_r
194 export PTHREAD_CFLAGS
195 export PTHREAD_LIBS
196 else
197 PTHREAD_LIBS=-pthread
198 export PTHREAD_LIBS
201 esac
203 # Add directory of the SDK tools to the path.
204 PATH=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:${PATH}
206 # Set the classpath
207 CLASSPATH=${OO_SDK_URE_JAVA_DIR}/libreoffice.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${CLASSPATH}
208 export CLASSPATH
211 # Add directory of the command make to the path, if necessary.
212 if [ -n "${OO_SDK_MAKE_HOME}" ]
213 then
214 PATH=${OO_SDK_MAKE_HOME}:${PATH}
215 export OO_SDK_MAKE_HOME
218 # Add directory of the zip tool to the path, if necessary.
219 if [ -n "${OO_SDK_ZIP_HOME}" ]
220 then
221 PATH=${OO_SDK_ZIP_HOME}:${PATH}
222 export OO_SDK_ZIP_HOME
225 # Add directory of the sed tool to the path, if necessary.
226 if [ -n "${OO_SDK_SED_HOME}" ]
227 then
228 PATH=${OO_SDK_SED_HOME}:${PATH}
229 export OO_SDK_SED_HOME
232 # Add directory of the cat tool to the path, if necessary.
233 if [ -n "${OO_SDK_CAT_HOME}" ]
234 then
235 PATH=${OO_SDK_CAT_HOME}:${PATH}
236 export OO_SDK_CAT_HOME
239 # Add directory of the C++ tools to the path, if necessary.
240 if [ -n "${OO_SDK_CPP_HOME}" ]
241 then
242 PATH=${OO_SDK_CPP_HOME}:${PATH}
243 export OO_SDK_CPP_HOME
246 # Add directory of the dotnet command-line tool to the path, if necessary.
247 if [ -n "${OO_SDK_DOTNET_ROOT}" ]
248 then
249 PATH=${OO_SDK_DOTNET_ROOT}:${PATH}
250 export OO_SDK_DOTNET_ROOT
253 # Add directory of the Java tools to the path, if necessary.
254 if [ -n "${OO_SDK_JAVA_HOME}" ]
255 then
256 PATH=${OO_SDK_JAVA_HOME}/bin:${PATH}
257 # JAVA_HOME=${OO_SDK_JAVA_HOME}
258 # export JAVA_HOME
259 export OO_SDK_JAVA_HOME
261 export PATH
264 export PATH
266 if [ "${platform}" = "MacOSX" ]
267 then
268 # For URE, prepare symbolic links for libraries:
269 # Only necessary on MacOSX, on other Unix systems the links are already prepared
270 # in the SDK installation.
272 # cleanup potential old links first
273 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
274 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
275 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
276 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
277 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
279 # prepare links
280 mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
281 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
282 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
283 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
284 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
285 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
286 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
287 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
288 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
289 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
290 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
294 # Prepare shell with all necessary environment variables.
295 echo
296 echo " ************************************************************************"
297 echo " *"
298 echo " * SDK environment is prepared for ${platform}"
299 echo " *"
300 echo " * SDK = $OO_SDK_HOME"
301 echo " * Office = $OFFICE_HOME"
302 echo " * Make = $OO_SDK_MAKE_HOME"
303 echo " * Zip = $OO_SDK_ZIP_HOME"
304 echo " * cat = $OO_SDK_CAT_HOME"
305 echo " * sed = $OO_SDK_SED_HOME"
306 echo " * C++ Compiler = $OO_SDK_CPP_HOME"
307 echo " * Dotnet = $OO_SDK_DOTNET_ROOT"
308 echo " * Java = $OO_SDK_JAVA_HOME"
309 echo " * SDK Output directory = $OO_SDK_OUT"
310 echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
311 echo " *"
312 echo " ************************************************************************"