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 sets all enviroment variables, which are necessary for building
21 # the examples of the Office Development Kit.
22 # The Script was developed for the operating systems Solaris, Linux and MacOS.
25 setenv OO_SDK_NAME @OO_SDK_NAME@
27 # Installation directory of the Software Development Kit.
28 # Example: setenv OO_SDK_HOME /opt/libreoffice/basis3.4/sdk
29 setenv OO_SDK_HOME
'@OO_SDK_HOME@'
31 # Office installation directory.
32 # Example: set OFFICE_HOME=/opt/libreoffice
33 setenv OFFICE_HOME
'@OFFICE_HOME@'
35 # URE installation directory.
36 # Example: setenv OO_SDK_URE_HOME /opt/libreoffice/ure
37 setenv OO_SDK_URE_HOME
'@OO_SDK_URE_HOME@'
39 # Directory of the make command.
40 # Example: setenv OO_SDK_MAKE_HOME /usr/bin
41 setenv OO_SDK_MAKE_HOME @OO_SDK_MAKE_HOME@
43 # Directory of the zip command.
44 # Example: setenv OO_SDK_ZIP_HOME /usr/bin
45 setenv OO_SDK_ZIP_HOME @OO_SDK_ZIP_HOME@
47 # Directory of the C++ compiler.
48 # Example: setenv OO_SDK_CPP_HOME /usr/bin
49 setenv OO_SDK_CPP_HOME @OO_SDK_CPP_HOME@
52 setenv OO_SDK_CC_55_OR_HIGHER @OO_SDK_CC_55_OR_HIGHER@
54 # Directory of the Java SDK.
55 # Example: setenv OO_SDK_JAVA_HOME "/usr/jdk/jdk1.6.0_10"
56 setenv OO_SDK_JAVA_HOME @OO_SDK_JAVA_HOME@
58 # Special output directory
59 # Example: setenv OO_SDK_OUTPUT_DIR "$HOME"
60 setenv OO_SDK_OUTPUT_DIR @OO_SDK_OUTPUT_DIR@
62 # Environment variable to enable auto deployment of example components
63 # Example: set SDK_AUTO_DEPLOYMENT=YES
64 setenv SDK_AUTO_DEPLOYMENT @SDK_AUTO_DEPLOYMENT@
66 # Get the operating system.
67 set sdk_platform
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
69 # Set the directory name.
70 set programdir
=program
72 switch
(${sdk_platform})
74 set programdir
="Contents/MacOS"
80 # Set office program path.
81 if ( "${OFFICE_HOME}" != "" ) then
82 setenv OFFICE_PROGRAM_PATH
"${OFFICE_HOME}/${programdir}"
86 # Set UNO path, necessary to ensure that the cpp examples using the
87 # new UNO bootstrap mechanism use the configured office installation.
88 if ( ${?OFFICE_PROGRAM_PATH} ) then
89 setenv UNO_PATH
"${OFFICE_PROGRAM_PATH}"
92 if ( "${OO_SDK_URE_HOME}" != "" ) then
93 setenv OO_SDK_URE_BIN_DIR
"${OO_SDK_URE_HOME}/bin"
94 setenv OO_SDK_URE_LIB_DIR
"${OO_SDK_URE_HOME}/lib"
95 setenv OO_SDK_URE_JAVA_DIR
"${OO_SDK_URE_HOME}/share/java"
97 setenv OO_SDK_URE_BIN_DIR
"${OFFICE_PROGRAM_PATH}"
98 setenv OO_SDK_URE_LIB_DIR
"${OFFICE_PROGRAM_PATH}"
99 setenv OO_SDK_URE_JAVA_DIR
"${OFFICE_PROGRAM_PATH}/classes"
102 # Set SDK example output directory
103 setenv OO_SDK_OUT
${OO_SDK_HOME}
104 if ( $?OO_SDK_OUTPUT_DIR
) then
105 setenv OO_SDK_OUT
${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
108 # check platform and set appropriate variables
109 switch
(`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`)
111 if ( `${OO_SDK_HOME}/config.guess | cut -d"-" -f1` == "sparc" ) then
112 set directoryname
=solsparc
113 set platform
=Solaris Sparc
115 set directoryname
=solintel
116 set platform
=Solaris Intel
121 set exampleout
=SOLARISexample.out
123 # set LD_LIBRARY_PATH
124 if ( $?LD_LIBRARY_PATH
== 0) then
125 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
127 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
132 set directoryname
=linux
136 set exampleout
=LINUXexample.out
139 # set LD_LIBRARY_PATH
140 if ( $?LD_LIBRARY_PATH
== 0) then
141 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
143 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
148 set directoryname
=macosx
152 set exampleout
=MACOSXexample.out
155 # set DYLD_LIBRARY_PATH
156 if ( $?DYLD_LIBRARY_PATH
== 0) then
157 setenv DYLD_LIBRARY_PATH
${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
159 setenv DYLD_LIBRARY_PATH
${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
164 set directoryname
=freebsd
168 set exampleout
=FREEBSDexample.out
171 # set LD_LIBRARY_PATH
172 if ( $?LD_LIBRARY_PATH
== 0) then
173 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
175 setenv LD_LIBRARY_PATH
${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
178 if ( -e "/sbin/sysctl" ) then
179 set OSVERSION
=`/sbin/sysctl -n kern.osreldate`
181 set OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
184 if ( ${OSVERSION} < 500016 ) then
185 setenv PTHREAD_CFLAGS
-D_THREAD_SAFE
186 setenv PTHREAD_LIBS
-pthread
187 else if ( ${OSVERSION} < 502102 ) then
188 setenv PTHREAD_CFLAGS
-D_THREAD_SAFE
189 setenv PTHREAD_LIBS
-lc_r
191 setenv PTHREAD_LIBS
-pthread
197 if ( $?PATH
== 0) then
198 setenv PATH
${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.
200 setenv PATH
${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.:${PATH}
204 if ( ${?OFFICE_PROGRAM_PATH} ) then
205 if ( ${?CLASSPATH} == 0 ) then
206 setenv CLASSPATH
"${OFFICE_PROGRAM_PATH}/classes/unoil.jar"
208 setenv CLASSPATH
"${OFFICE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}"
211 if ( $?CLASSPATH
== 0) then
212 setenv 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"
214 setenv 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:${CLASSPATH}"
217 if ( $?OO_SDK_CPP_HOME
== 0) then
218 setenv PATH
${OO_SDK_CPP_HOME}:${PATH}
221 if ( $?OO_SDK_JAVA_HOME
== 0) then
222 setenv PATH
${OO_SDK_JAVA_HOME}:${PATH}
226 if ( "${platform}" == "MacOSX" ) then
227 # For URE, prepare symbolic links for libraries:
228 # Only necessary on MacOSX, on other Unix systems the links are already prepared
229 # in the SDK installation.
231 # cleanup potential old links first
232 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
233 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
234 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
235 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
236 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
238 if ( "${OO_SDK_URE_HOME}" != "" ) then
239 mkdir
-p "${OO_SDK_OUT}/${directoryname}/lib"
240 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
241 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
242 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
243 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
244 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
245 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
246 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
247 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
248 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
249 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
255 echo " ************************************************************************"
257 echo " * SDK environment is prepared for ${platform}"
259 echo " * SDK = ${OO_SDK_HOME}"
260 echo " * Office = ${OFFICE_HOME}"
261 echo " * URE = ${OO_SDK_URE_HOME}"
262 echo " * Make = ${OO_SDK_MAKE_HOME}"
263 echo " * Zip = ${OO_SDK_ZIP_HOME}"
264 if ( $?OO_SDK_CPP_HOME
== 0) then
265 echo " * C++ Compiler = "
267 echo " * C++ Compiler = ${OO_SDK_CPP_HOME}"
269 if ( $?OO_SDK_JAVA_HOME
== 0) then
272 echo " * Java = ${OO_SDK_JAVA_HOME}"
274 if ( $?OO_SDK_OUTPUT_DIR
== 0) then
275 echo " * Special Output directory = "
277 echo " * SDK Output directory = ${OO_SDK_OUT}"
279 echo " * Auto deployment = ${SDK_AUTO_DEPLOYMENT}"
281 echo " ************************************************************************"
289 echo "\e]2;Shell prepared with the SDK environment\a"