fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / odk / config / setsdkenv_unix.sh.in
blob4f9b8798d5cb613cb3e563f20dfee15de54c581e
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 Java SDK.
58 # Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
59 OO_SDK_JAVA_HOME=@OO_SDK_JAVA_HOME@
61 # Special output directory
62 # Example: OO_SDK_OUTPUT_DIR=$HOME
63 OO_SDK_OUTPUT_DIR=@OO_SDK_OUTPUT_DIR@
65 # Environment variable to enable auto deployment of example components
66 # Example: SDK_AUTO_DEPLOYMENT=YES
67 SDK_AUTO_DEPLOYMENT=@SDK_AUTO_DEPLOYMENT@
68 export SDK_AUTO_DEPLOYMENT
70 # Check installation path for the OpenOffice Development Kit.
71 if [ -z "${OO_SDK_HOME}" ]
72 then
73 echo Error: Please insert a correct value for the variable OO_SDK_HOME.
74 exit 0
77 export OO_SDK_HOME
79 # Get the operating system.
80 sdk_platform=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
82 # Set the directory name.
83 programdir=program
84 javadir=bin
85 sdk_lo_java_dir=program/classes
86 case ${sdk_platform} in
87 darwin*)
88 programdir="Contents/MacOS"
89 javadir=Commands
90 sdk_lo_java_dir=Contents/Resources/java
92 esac
94 # Set office program path (only set when using an Office).
95 OFFICE_PROGRAM_PATH=${OFFICE_HOME}/${programdir}
96 export OFFICE_PROGRAM_PATH
98 # Set UNO path, necessary to ensure that the cpp examples using the
99 # new UNO bootstrap mechanism use the configured office installation (only set
100 # when using an Office).
101 UNO_PATH=${OFFICE_PROGRAM_PATH}
102 export UNO_PATH
104 case ${sdk_platform} in
105 darwin*)
106 OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
107 OO_SDK_URE_LIB_DIR=${OFFICE_HOME}/Contents/Frameworks
108 OO_SDK_URE_JAVA_DIR=${OFFICE_HOME}/${sdk_lo_java_dir}
111 OO_SDK_URE_BIN_DIR=${OFFICE_PROGRAM_PATH}
112 OO_SDK_URE_LIB_DIR=${OFFICE_PROGRAM_PATH}
113 OO_SDK_URE_JAVA_DIR=${OFFICE_PROGRAM_PATH}/classes
115 esac
116 export OO_SDK_URE_BIN_DIR
117 export OO_SDK_URE_LIB_DIR
118 export OO_SDK_URE_JAVA_DIR
120 OO_SDK_OUT=$OO_SDK_HOME
121 # Prepare appropriate output directory.
122 if [ -n "${OO_SDK_OUTPUT_DIR}" ]
123 then
124 OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
125 export OO_SDK_OUT
128 # Set the directory name.
129 case ${sdk_platform} in
130 solaris*)
131 sdk_proctype=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
132 if [ "${sdk_proctype}" = "sparc" ]
133 then
134 directoryname=solsparc
135 platform='Solaris Sparc'
136 else
137 directoryname=solintel
138 platform='Solaris x86'
140 comid=gcc3
141 soext=so
142 exampleout=SOLARISexample.out
143 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
144 export LD_LIBRARY_PATH
147 darwin*)
148 directoryname=macosx
149 comid=gcc3
150 soext=dylib
151 exampleout=MACOSXexample.out
152 platform=MacOSX
153 DYLD_LIBRARY_PATH=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
154 export DYLD_LIBRARY_PATH
157 linux-gnu)
158 directoryname=linux
159 comid=gcc3
160 soext=so
161 exampleout=LINUXexample.out
162 platform=Linux
163 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
164 export LD_LIBRARY_PATH
167 freebsd*)
168 directoryname=freebsd
169 comid=gcc3
170 soext=so
171 exampleout=FREEBSDexample.out
172 platform=FreeBSD
173 LD_LIBRARY_PATH=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
174 export LD_LIBRARY_PATH
176 if [ -e "/sbin/sysctl" ]
177 then
178 OSVERSION=`/sbin/sysctl -n kern.osreldate`
179 else
180 OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
182 if [ $OSVERSION -lt 500016 ]
183 then
184 PTHREAD_CFLAGS=-D_THREAD_SAFE
185 PTHREAD_LIBS=-pthread
186 export PTHREAD_CFLAGS
187 export PTHREAD_LIBS
188 elif [ $OSVERSION -lt 502102 ]
189 then
190 PTHREAD_CFLAGS=-D_THREAD_SAFE
191 PTHREAD_LIBS=-lc_r
192 export PTHREAD_CFLAGS
193 export PTHREAD_LIBS
194 else
195 PTHREAD_LIBS=-pthread
196 export PTHREAD_LIBS
199 esac
201 # Add directory of the SDK tools to the path.
202 PATH=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:${PATH}
204 # Set the classpath
205 CLASSPATH=${OO_SDK_URE_JAVA_DIR}/juh.jar:${OO_SDK_URE_JAVA_DIR}/jurt.jar:${OO_SDK_URE_JAVA_DIR}/ridl.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${OFFICE_HOME}/$sdk_lo_java_dir/unoil.jar:${CLASSPATH}
206 export CLASSPATH
209 # Add directory of the command make to the path, if necessary.
210 if [ -n "${OO_SDK_MAKE_HOME}" ]
211 then
212 PATH=${OO_SDK_MAKE_HOME}:${PATH}
213 export OO_SDK_MAKE_HOME
216 # Add directory of the zip tool to the path, if necessary.
217 if [ -n "${OO_SDK_ZIP_HOME}" ]
218 then
219 PATH=${OO_SDK_ZIP_HOME}:${PATH}
220 export OO_SDK_ZIP_HOME
223 # Add directory of the sed tool to the path, if necessary.
224 if [ -n "${OO_SDK_SED_HOME}" ]
225 then
226 PATH=${OO_SDK_SED_HOME}:${PATH}
227 export OO_SDK_SED_HOME
230 # Add directory of the cat tool to the path, if necessary.
231 if [ -n "${OO_SDK_CAT_HOME}" ]
232 then
233 PATH=${OO_SDK_CAT_HOME}:${PATH}
234 export OO_SDK_CAT_HOME
237 # Add directory of the C++ tools to the path, if necessary.
238 if [ -n "${OO_SDK_CPP_HOME}" ]
239 then
240 PATH=${OO_SDK_CPP_HOME}:${PATH}
241 export OO_SDK_CPP_HOME
244 # Add directory of the Java tools to the path, if necessary.
245 if [ -n "${OO_SDK_JAVA_HOME}" ]
246 then
247 PATH=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
248 # JAVA_HOME=${OO_SDK_JAVA_HOME}
249 # export JAVA_HOME
250 export OO_SDK_JAVA_HOME
252 export PATH
255 export PATH
257 if [ "${platform}" = "MacOSX" ]
258 then
259 # For URE, prepare symbolic links for libraries:
260 # Only necessary on MacOSX, on other Unix systems the links are already prepared
261 # in the SDK installation.
263 # cleanup potential old links first
264 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
265 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
266 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
267 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
268 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
270 # prepare links
271 mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
272 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
273 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
274 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
275 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
276 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
277 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
278 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
279 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
280 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
281 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
285 # Prepare shell with all necessary environment variables.
286 echo
287 echo " ************************************************************************"
288 echo " *"
289 echo " * SDK environment is prepared for ${platform}"
290 echo " *"
291 echo " * SDK = $OO_SDK_HOME"
292 echo " * Office = $OFFICE_HOME"
293 echo " * Make = $OO_SDK_MAKE_HOME"
294 echo " * Zip = $OO_SDK_ZIP_HOME"
295 echo " * cat = $OO_SDK_CAT_HOME"
296 echo " * sed = $OO_SDK_SED_HOME"
297 echo " * C++ Compiler = $OO_SDK_CPP_HOME"
298 echo " * Java = $OO_SDK_JAVA_HOME"
299 echo " * SDK Output directory = $OO_SDK_OUT"
300 echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
301 echo " *"
302 echo " ************************************************************************"
304 echo "\e]2;Shell prepared with the LibreOffice SDK environment\a"