3 # This script starts a new shell and sets all enviroment variables, which
4 # are necessary for building the examples of the Office Development Kit.
5 # The Script was developed for the operating systems Solaris, Linux and MacOS.
8 OO_SDK_NAME
=@OO_SDK_NAME@
11 # Installation directory of the Software Development Kit.
12 # Example: OO_SDK_HOME=/opt/openoffice.org/basis3.0/sdk
13 OO_SDK_HOME
=@OO_SDK_HOME@
15 # Office installation directory.
16 # Example: OFFICE_HOME=/opt/openoffice.org3
17 OFFICE_HOME
=@OFFICE_HOME@
18 OFFICE_BASE_HOME
=@OFFICE_BASE_HOME@
20 # URE installation directory.
21 # Example: OO_SDK_URE_HOME=/opt/openoffice.org/ure
22 OO_SDK_URE_HOME
=@OO_SDK_URE_HOME@
23 export OO_SDK_URE_HOME
25 # Directory of the make command.
26 # Example: OO_SDK_MAKE_HOME=/usr/bin
27 OO_SDK_MAKE_HOME
=@OO_SDK_MAKE_HOME@
29 # Directory of the zip command.
30 # Example: OO_SDK_ZIP_HOME=/usr/bin
31 OO_SDK_ZIP_HOME
=@OO_SDK_ZIP_HOME@
33 # Directory of the C++ compiler.
34 # Example: OO_SDK_CPP_HOME=/usr/bin
35 OO_SDK_CPP_HOME
=@OO_SDK_CPP_HOME@
38 OO_SDK_CC_55_OR_HIGHER
=@OO_SDK_CC_55_OR_HIGHER@
40 # Directory of the Java SDK.
41 # Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
42 OO_SDK_JAVA_HOME
=@OO_SDK_JAVA_HOME@
44 # Special output directory
45 # Example: OO_SDK_OUTPUT_DIR=$HOME
46 OO_SDK_OUTPUT_DIR
=@OO_SDK_OUTPUT_DIR@
48 # Environment variable to enable auto deployment of example components
49 # Example: SDK_AUTO_DEPLOYMENT=YES
50 SDK_AUTO_DEPLOYMENT
=@SDK_AUTO_DEPLOYMENT@
51 export SDK_AUTO_DEPLOYMENT
53 # Check installation path for the OpenOffice Development Kit.
54 if [ -z "${OO_SDK_HOME}" ]
56 echo Error
: Please insert a correct value
for the variable OO_SDK_HOME.
62 # Check installation path for the office.
63 if [ -z "${OFFICE_HOME}" ] && [ -z "${OO_SDK_URE_HOME}" ]
65 echo 'Error: Please set either the environment variable OFFICE_HOME or the'
66 echo 'environment variable OO_SDK_URE_HOME.'
70 # Get the operating system.
71 sdk_platform
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
73 # Set the directory name.
76 case ${sdk_platform} in
78 programdir
="Contents/MacOS"
83 # Set office program path (only set when using an Office).
84 if [ "${OFFICE_HOME}" ]
86 OFFICE_PROGRAM_PATH
=${OFFICE_HOME}/${programdir}
87 export OFFICE_PROGRAM_PATH
90 # Set office program path (only set when using an Office).
91 if [ "${OFFICE_BASE_HOME}" ]
93 OFFICE_BASE_PROGRAM_PATH
=${OFFICE_BASE_HOME}/program
94 export OFFICE_BASE_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 if [ "${OFFICE_HOME}" ]
103 UNO_PATH
=${OFFICE_PROGRAM_PATH}
107 if [ "${OO_SDK_URE_HOME}" ]
109 OO_SDK_URE_BIN_DIR
=${OO_SDK_URE_HOME}/bin
110 OO_SDK_URE_LIB_DIR
=${OO_SDK_URE_HOME}/lib
111 OO_SDK_URE_JAVA_DIR
=${OO_SDK_URE_HOME}/share
/java
113 OO_SDK_URE_BIN_DIR
=${OFFICE_PROGRAM_PATH}
114 OO_SDK_URE_LIB_DIR
=${OFFICE_BASE_PROGRAM_PATH}
115 OO_SDK_URE_JAVA_DIR
=${OFFICE_BASE_PROGRAM_PATH}/classes
117 export OO_SDK_URE_BIN_DIR
118 export OO_SDK_URE_LIB_DIR
119 export OO_SDK_URE_JAVA_DIR
121 OO_SDK_OUT
=$OO_SDK_HOME
122 # Prepare appropriate output directory.
123 if [ -n "${OO_SDK_OUTPUT_DIR}" ]
125 OO_SDK_OUT
=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
129 # Set the directory name.
130 case ${sdk_platform} in
132 sdk_proctype
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
133 if [ "${sdk_proctype}" = "sparc" ]
135 directoryname
=solsparc
136 platform
='Solaris Sparc'
138 directoryname
=solintel
139 platform
='Solaris x86'
144 exampleout
=SOLARISexample.out
146 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
147 export LD_LIBRARY_PATH
151 if [ -n "$OO_SDK_CPP_HOME" ]
153 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
154 export SDK_GXX_INCLUDE_PATH
161 exampleout
=MACOSXexample.out
164 DYLD_LIBRARY_PATH
=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
165 export DYLD_LIBRARY_PATH
169 if [ -n "$OO_SDK_CPP_HOME" ]
171 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
172 export SDK_GXX_INCLUDE_PATH
179 exampleout
=LINUXexample.out
182 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
183 export LD_LIBRARY_PATH
187 if [ -n "$OO_SDK_CPP_HOME" ]
189 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
190 export SDK_GXX_INCLUDE_PATH
193 directoryname
=freebsd
197 exampleout
=FREEBSDexample.out
200 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
201 export LD_LIBRARY_PATH
203 if [ -e "/sbin/sysctl" ]
205 OSVERSION
=`/sbin/sysctl -n kern.osreldate`
207 OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
209 if [ $OSVERSION -lt 500016 ]
211 PTHREAD_CFLAGS
=-D_THREAD_SAFE
212 PTHREAD_LIBS
=-pthread
213 export PTHREAD_CFLAGS
215 elif [ $OSVERSION -lt 502102 ]
217 PTHREAD_CFLAGS
=-D_THREAD_SAFE
219 export PTHREAD_CFLAGS
222 PTHREAD_LIBS
=-pthread
228 # Add directory of the SDK tools to the path.
229 PATH
=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:.:${PATH}
232 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_BASE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}
236 # Add directory of the command make to the path, if necessary.
237 if [ -n "${OO_SDK_MAKE_HOME}" ]
239 PATH
=${OO_SDK_MAKE_HOME}:${PATH}
240 export OO_SDK_MAKE_HOME
243 # Add directory of the zip tool to the path, if necessary.
244 if [ -n "${OO_SDK_ZIP_HOME}" ]
246 PATH
=${OO_SDK_ZIP_HOME}:${PATH}
247 export OO_SDK_ZIP_HOME
250 # Add directory of the C++ tools to the path, if necessary.
251 if [ -n "${OO_SDK_CPP_HOME}" ]
253 PATH
=${OO_SDK_CPP_HOME}:${PATH}
254 export OO_SDK_CPP_HOME
256 if [ -n "${OO_SDK_CC_55_OR_HIGHER}" ]
258 export OO_SDK_CC_55_OR_HIGHER
262 # Add directory of the Java tools to the path, if necessary.
263 if [ -n "${OO_SDK_JAVA_HOME}" ]
265 PATH
=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
266 # JAVA_HOME=${OO_SDK_JAVA_HOME}
268 export OO_SDK_JAVA_HOME
275 if [ -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${stldebug}.${soext}" ]
281 if [ "${platform}" = "MacOSX" ]
283 # For URE, prepare symbolic links for libraries:
284 # Only necessary on MacOSX, on other Unix systems the links are already prepared
285 # in the SDK installation.
287 # cleanup potential old links first
288 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
289 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
290 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
291 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
292 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
294 if [ -L "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
296 rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
300 if [ "${OO_SDK_URE_HOME}" ]
302 mkdir
-p "${OO_SDK_OUT}/${directoryname}/lib"
303 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
304 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
305 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
306 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
307 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
308 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
309 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
310 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
311 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
312 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
314 if [ -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
316 ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
317 "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
323 # Prepare shell with all necessary environment variables.
325 echo " ************************************************************************"
327 echo " * SDK environment is prepared for ${platform}"
329 echo " * SDK = $OO_SDK_HOME"
330 echo " * Office = $OFFICE_HOME"
331 echo " * Office Base = $OFFICE_BASE_HOME"
332 echo " * URE = $OO_SDK_URE_HOME"
333 echo " * Make = $OO_SDK_MAKE_HOME"
334 echo " * Zip = $OO_SDK_ZIP_HOME"
335 echo " * C++ Compiler = $OO_SDK_CPP_HOME"
336 echo " * Java = $OO_SDK_JAVA_HOME"
337 echo " * SDK Output directory = $OO_SDK_OUT"
338 echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
340 echo " ************************************************************************"
342 echo "\e]2;Shell prepared with the SDK environment\a"