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.
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@'
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}" ]
73 echo Error
: Please insert a correct value
for the variable 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.
85 sdk_lo_java_dir
=program
/classes
86 case ${sdk_platform} in
88 programdir
="Contents/MacOS"
90 sdk_lo_java_dir
=Contents
/Resources
/java
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}
104 case ${sdk_platform} in
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
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}" ]
124 OO_SDK_OUT
=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
128 # Set the directory name.
129 case ${sdk_platform} in
131 sdk_proctype
=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
132 if [ "${sdk_proctype}" = "sparc" ]
134 directoryname
=solsparc
135 platform
='Solaris Sparc'
137 directoryname
=solintel
138 platform
='Solaris x86'
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
151 exampleout
=MACOSXexample.out
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
161 exampleout
=LINUXexample.out
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
168 directoryname
=freebsd
171 exampleout
=FREEBSDexample.out
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" ]
178 OSVERSION
=`/sbin/sysctl -n kern.osreldate`
180 OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
182 if [ $OSVERSION -lt 500016 ]
184 PTHREAD_CFLAGS
=-D_THREAD_SAFE
185 PTHREAD_LIBS
=-pthread
186 export PTHREAD_CFLAGS
188 elif [ $OSVERSION -lt 502102 ]
190 PTHREAD_CFLAGS
=-D_THREAD_SAFE
192 export PTHREAD_CFLAGS
195 PTHREAD_LIBS
=-pthread
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}
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}
209 # Add directory of the command make to the path, if necessary.
210 if [ -n "${OO_SDK_MAKE_HOME}" ]
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}" ]
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}" ]
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}" ]
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}" ]
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}" ]
247 PATH
=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
248 # JAVA_HOME=${OO_SDK_JAVA_HOME}
250 export OO_SDK_JAVA_HOME
257 if [ "${platform}" = "MacOSX" ]
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}"
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.
287 echo " ************************************************************************"
289 echo " * SDK environment is prepared for ${platform}"
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"
302 echo " ************************************************************************"
304 echo "\e]2;Shell prepared with the LibreOffice SDK environment\a"