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 .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}" ]
77 echo Error
: Please insert a correct value
for the variable 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.
88 sdk_lo_java_dir
=program
/classes
89 case ${sdk_platform} in
91 programdir
="Contents/MacOS"
92 sdk_lo_java_dir
=Contents
/Resources
/java
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}
106 case ${sdk_platform} in
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
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}" ]
126 OO_SDK_OUT
=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
130 # Set the directory name.
131 case ${sdk_platform} in
133 sdk_proctype
=`/bin/sh ${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
134 if [ "${sdk_proctype}" = "sparc" ]
136 directoryname
=solsparc
137 platform
='Solaris Sparc'
139 directoryname
=solintel
140 platform
='Solaris x86'
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
153 exampleout
=MACOSXexample.out
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
163 exampleout
=LINUXexample.out
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
170 directoryname
=freebsd
173 exampleout
=FREEBSDexample.out
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" ]
180 OSVERSION
=`/sbin/sysctl -n kern.osreldate`
182 OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
184 if [ $OSVERSION -lt 500016 ]
186 PTHREAD_CFLAGS
=-D_THREAD_SAFE
187 PTHREAD_LIBS
=-pthread
188 export PTHREAD_CFLAGS
190 elif [ $OSVERSION -lt 502102 ]
192 PTHREAD_CFLAGS
=-D_THREAD_SAFE
194 export PTHREAD_CFLAGS
197 PTHREAD_LIBS
=-pthread
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}
207 CLASSPATH
=${OO_SDK_URE_JAVA_DIR}/libreoffice.jar:${OO_SDK_URE_JAVA_DIR}/unoloader.jar:${CLASSPATH}
211 # Add directory of the command make to the path, if necessary.
212 if [ -n "${OO_SDK_MAKE_HOME}" ]
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}" ]
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}" ]
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}" ]
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}" ]
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}" ]
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}" ]
256 PATH
=${OO_SDK_JAVA_HOME}/bin
:${PATH}
257 # JAVA_HOME=${OO_SDK_JAVA_HOME}
259 export OO_SDK_JAVA_HOME
266 if [ "${platform}" = "MacOSX" ]
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}"
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.
296 echo " ************************************************************************"
298 echo " * SDK environment is prepared for ${platform}"
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"
312 echo " ************************************************************************"