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 enviroment 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.
25 OO_SDK_NAME
=@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@'
36 # URE installation directory.
37 # Example: OO_SDK_URE_HOME=/opt/libreoffice/ure
38 OO_SDK_URE_HOME
='@OO_SDK_URE_HOME@'
39 export OO_SDK_URE_HOME
41 # Directory of the make command.
42 # Example: OO_SDK_MAKE_HOME=/usr/bin
43 OO_SDK_MAKE_HOME
=@OO_SDK_MAKE_HOME@
45 # Directory of the zip command.
46 # Example: OO_SDK_ZIP_HOME=/usr/bin
47 OO_SDK_ZIP_HOME
=@OO_SDK_ZIP_HOME@
49 # Directory of the C++ compiler.
50 # Example: OO_SDK_CPP_HOME=/usr/bin
51 OO_SDK_CPP_HOME
=@OO_SDK_CPP_HOME@
54 OO_SDK_CC_55_OR_HIGHER
=@OO_SDK_CC_55_OR_HIGHER@
56 # Directory of the Java SDK.
57 # Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
58 OO_SDK_JAVA_HOME
=@OO_SDK_JAVA_HOME@
60 # Special output directory
61 # Example: OO_SDK_OUTPUT_DIR=$HOME
62 OO_SDK_OUTPUT_DIR
=@OO_SDK_OUTPUT_DIR@
64 # Environment variable to enable auto deployment of example components
65 # Example: SDK_AUTO_DEPLOYMENT=YES
66 SDK_AUTO_DEPLOYMENT
=@SDK_AUTO_DEPLOYMENT@
67 export SDK_AUTO_DEPLOYMENT
69 # Check installation path for the OpenOffice Development Kit.
70 if [ -z "${OO_SDK_HOME}" ]
72 echo Error
: Please insert a correct value
for the variable OO_SDK_HOME.
78 # Check installation path for the office.
79 if [ -z "${OFFICE_HOME}" ] && [ -z "${OO_SDK_URE_HOME}" ]
81 echo 'Error: Please set either the environment variable OFFICE_HOME or the'
82 echo 'environment variable OO_SDK_URE_HOME.'
86 # Get the operating system.
87 sdk_platform
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
89 # Set the directory name.
92 case ${sdk_platform} in
94 programdir
="Contents/MacOS"
99 # Set office program path (only set when using an Office).
100 if [ "${OFFICE_HOME}" ]
102 OFFICE_PROGRAM_PATH
=${OFFICE_HOME}/${programdir}
103 export OFFICE_PROGRAM_PATH
107 # Set UNO path, necessary to ensure that the cpp examples using the
108 # new UNO bootstrap mechanism use the configured office installation (only set
109 # when using an Office).
110 if [ "${OFFICE_HOME}" ]
112 UNO_PATH
=${OFFICE_PROGRAM_PATH}
116 if [ "${OO_SDK_URE_HOME}" ]
118 OO_SDK_URE_BIN_DIR
=${OO_SDK_URE_HOME}/bin
119 OO_SDK_URE_LIB_DIR
=${OO_SDK_URE_HOME}/lib
120 OO_SDK_URE_JAVA_DIR
=${OO_SDK_URE_HOME}/share
/java
122 OO_SDK_URE_BIN_DIR
=${OFFICE_PROGRAM_PATH}
123 OO_SDK_URE_LIB_DIR
=${OFFICE_PROGRAM_PATH}
124 OO_SDK_URE_JAVA_DIR
=${OFFICE_PROGRAM_PATH}/classes
126 export OO_SDK_URE_BIN_DIR
127 export OO_SDK_URE_LIB_DIR
128 export OO_SDK_URE_JAVA_DIR
130 OO_SDK_OUT
=$OO_SDK_HOME
131 # Prepare appropriate output directory.
132 if [ -n "${OO_SDK_OUTPUT_DIR}" ]
134 OO_SDK_OUT
=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
138 # Set the directory name.
139 case ${sdk_platform} in
141 sdk_proctype
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
142 if [ "${sdk_proctype}" = "sparc" ]
144 directoryname
=solsparc
145 platform
='Solaris Sparc'
147 directoryname
=solintel
148 platform
='Solaris x86'
153 exampleout
=SOLARISexample.out
154 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
155 export LD_LIBRARY_PATH
163 exampleout
=MACOSXexample.out
165 DYLD_LIBRARY_PATH
=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
166 export DYLD_LIBRARY_PATH
174 exampleout
=LINUXexample.out
176 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
177 export LD_LIBRARY_PATH
181 directoryname
=freebsd
185 exampleout
=FREEBSDexample.out
187 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
188 export LD_LIBRARY_PATH
190 if [ -e "/sbin/sysctl" ]
192 OSVERSION
=`/sbin/sysctl -n kern.osreldate`
194 OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
196 if [ $OSVERSION -lt 500016 ]
198 PTHREAD_CFLAGS
=-D_THREAD_SAFE
199 PTHREAD_LIBS
=-pthread
200 export PTHREAD_CFLAGS
202 elif [ $OSVERSION -lt 502102 ]
204 PTHREAD_CFLAGS
=-D_THREAD_SAFE
206 export PTHREAD_CFLAGS
209 PTHREAD_LIBS
=-pthread
215 # Add directory of the SDK tools to the path.
216 PATH
=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:.:${PATH}
219 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_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}
223 # Add directory of the command make to the path, if necessary.
224 if [ -n "${OO_SDK_MAKE_HOME}" ]
226 PATH
=${OO_SDK_MAKE_HOME}:${PATH}
227 export OO_SDK_MAKE_HOME
230 # Add directory of the zip tool to the path, if necessary.
231 if [ -n "${OO_SDK_ZIP_HOME}" ]
233 PATH
=${OO_SDK_ZIP_HOME}:${PATH}
234 export OO_SDK_ZIP_HOME
237 # Add directory of the C++ tools to the path, if necessary.
238 if [ -n "${OO_SDK_CPP_HOME}" ]
240 PATH
=${OO_SDK_CPP_HOME}:${PATH}
241 export OO_SDK_CPP_HOME
243 if [ -n "${OO_SDK_CC_55_OR_HIGHER}" ]
245 export OO_SDK_CC_55_OR_HIGHER
249 # Add directory of the Java tools to the path, if necessary.
250 if [ -n "${OO_SDK_JAVA_HOME}" ]
252 PATH
=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
253 # JAVA_HOME=${OO_SDK_JAVA_HOME}
255 export OO_SDK_JAVA_HOME
262 if [ "${platform}" = "MacOSX" ]
264 # For URE, prepare symbolic links for libraries:
265 # Only necessary on MacOSX, on other Unix systems the links are already prepared
266 # in the SDK installation.
268 # cleanup potential old links first
269 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
270 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
271 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
272 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
273 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
276 if [ "${OO_SDK_URE_HOME}" ]
278 mkdir
-p "${OO_SDK_OUT}/${directoryname}/lib"
279 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
280 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
281 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
282 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
283 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
284 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
285 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
286 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
287 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
288 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
293 # Prepare shell with all necessary environment variables.
295 echo " ************************************************************************"
297 echo " * SDK environment is prepared for ${platform}"
299 echo " * SDK = $OO_SDK_HOME"
300 echo " * Office = $OFFICE_HOME"
301 echo " * URE = $OO_SDK_URE_HOME"
302 echo " * Make = $OO_SDK_MAKE_HOME"
303 echo " * Zip = $OO_SDK_ZIP_HOME"
304 echo " * C++ Compiler = $OO_SDK_CPP_HOME"
305 echo " * Java = $OO_SDK_JAVA_HOME"
306 echo " * SDK Output directory = $OO_SDK_OUT"
307 echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
309 echo " ************************************************************************"
311 echo "\e]2;Shell prepared with the SDK environment\a"