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/libreoffice/basis3.4/sdk
13 OO_SDK_HOME
='@OO_SDK_HOME@'
15 # Office installation directory.
16 # Example: OFFICE_HOME=/opt/libreoffice
17 OFFICE_HOME
='@OFFICE_HOME@'
19 # URE installation directory.
20 # Example: OO_SDK_URE_HOME=/opt/libreoffice/ure
21 OO_SDK_URE_HOME
='@OO_SDK_URE_HOME@'
22 export OO_SDK_URE_HOME
24 # Directory of the make command.
25 # Example: OO_SDK_MAKE_HOME=/usr/bin
26 OO_SDK_MAKE_HOME
=@OO_SDK_MAKE_HOME@
28 # Directory of the zip command.
29 # Example: OO_SDK_ZIP_HOME=/usr/bin
30 OO_SDK_ZIP_HOME
=@OO_SDK_ZIP_HOME@
32 # Directory of the C++ compiler.
33 # Example: OO_SDK_CPP_HOME=/usr/bin
34 OO_SDK_CPP_HOME
=@OO_SDK_CPP_HOME@
37 OO_SDK_CC_55_OR_HIGHER
=@OO_SDK_CC_55_OR_HIGHER@
39 # Directory of the Java SDK.
40 # Example: OO_SDK_JAVA_HOME=/usr/jdk/jdk1.6.0_10
41 OO_SDK_JAVA_HOME
=@OO_SDK_JAVA_HOME@
43 # Special output directory
44 # Example: OO_SDK_OUTPUT_DIR=$HOME
45 OO_SDK_OUTPUT_DIR
=@OO_SDK_OUTPUT_DIR@
47 # Environment variable to enable auto deployment of example components
48 # Example: SDK_AUTO_DEPLOYMENT=YES
49 SDK_AUTO_DEPLOYMENT
=@SDK_AUTO_DEPLOYMENT@
50 export SDK_AUTO_DEPLOYMENT
52 # Check installation path for the OpenOffice Development Kit.
53 if [ -z "${OO_SDK_HOME}" ]
55 echo Error
: Please insert a correct value
for the variable OO_SDK_HOME.
61 # Check installation path for the office.
62 if [ -z "${OFFICE_HOME}" ] && [ -z "${OO_SDK_URE_HOME}" ]
64 echo 'Error: Please set either the environment variable OFFICE_HOME or the'
65 echo 'environment variable OO_SDK_URE_HOME.'
69 # Get the operating system.
70 sdk_platform
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
72 # Set the directory name.
75 case ${sdk_platform} in
77 programdir
="Contents/MacOS"
82 # Set office program path (only set when using an Office).
83 if [ "${OFFICE_HOME}" ]
85 OFFICE_PROGRAM_PATH
=${OFFICE_HOME}/${programdir}
86 export OFFICE_PROGRAM_PATH
90 # Set UNO path, necessary to ensure that the cpp examples using the
91 # new UNO bootstrap mechanism use the configured office installation (only set
92 # when using an Office).
93 if [ "${OFFICE_HOME}" ]
95 UNO_PATH
=${OFFICE_PROGRAM_PATH}
99 if [ "${OO_SDK_URE_HOME}" ]
101 OO_SDK_URE_BIN_DIR
=${OO_SDK_URE_HOME}/bin
102 OO_SDK_URE_LIB_DIR
=${OO_SDK_URE_HOME}/lib
103 OO_SDK_URE_JAVA_DIR
=${OO_SDK_URE_HOME}/share
/java
105 OO_SDK_URE_BIN_DIR
=${OFFICE_PROGRAM_PATH}
106 OO_SDK_URE_LIB_DIR
=${OFFICE_PROGRAM_PATH}
107 OO_SDK_URE_JAVA_DIR
=${OFFICE_PROGRAM_PATH}/classes
109 export OO_SDK_URE_BIN_DIR
110 export OO_SDK_URE_LIB_DIR
111 export OO_SDK_URE_JAVA_DIR
113 OO_SDK_OUT
=$OO_SDK_HOME
114 # Prepare appropriate output directory.
115 if [ -n "${OO_SDK_OUTPUT_DIR}" ]
117 OO_SDK_OUT
=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
121 # Set the directory name.
122 case ${sdk_platform} in
124 sdk_proctype
=`${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
125 if [ "${sdk_proctype}" = "sparc" ]
127 directoryname
=solsparc
128 platform
='Solaris Sparc'
130 directoryname
=solintel
131 platform
='Solaris x86'
136 exampleout
=SOLARISexample.out
137 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
138 export LD_LIBRARY_PATH
142 if [ -n "$OO_SDK_CPP_HOME" ]
144 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
145 export SDK_GXX_INCLUDE_PATH
152 exampleout
=MACOSXexample.out
154 DYLD_LIBRARY_PATH
=${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
155 export DYLD_LIBRARY_PATH
159 if [ -n "$OO_SDK_CPP_HOME" ]
161 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
162 export SDK_GXX_INCLUDE_PATH
169 exampleout
=LINUXexample.out
171 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
172 export LD_LIBRARY_PATH
176 if [ -n "$OO_SDK_CPP_HOME" ]
178 SDK_GXX_INCLUDE_PATH
=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
179 export SDK_GXX_INCLUDE_PATH
182 directoryname
=freebsd
186 exampleout
=FREEBSDexample.out
188 LD_LIBRARY_PATH
=${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
189 export LD_LIBRARY_PATH
191 if [ -e "/sbin/sysctl" ]
193 OSVERSION
=`/sbin/sysctl -n kern.osreldate`
195 OSVERSION
=`/usr/sbin/sysctl -n kern.osreldate`
197 if [ $OSVERSION -lt 500016 ]
199 PTHREAD_CFLAGS
=-D_THREAD_SAFE
200 PTHREAD_LIBS
=-pthread
201 export PTHREAD_CFLAGS
203 elif [ $OSVERSION -lt 502102 ]
205 PTHREAD_CFLAGS
=-D_THREAD_SAFE
207 export PTHREAD_CFLAGS
210 PTHREAD_LIBS
=-pthread
216 # Add directory of the SDK tools to the path.
217 PATH
=${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}/bin:${OO_SDK_URE_BIN_DIR}:${OFFICE_PROGRAM_PATH}:.:${PATH}
220 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}
224 # Add directory of the command make to the path, if necessary.
225 if [ -n "${OO_SDK_MAKE_HOME}" ]
227 PATH
=${OO_SDK_MAKE_HOME}:${PATH}
228 export OO_SDK_MAKE_HOME
231 # Add directory of the zip tool to the path, if necessary.
232 if [ -n "${OO_SDK_ZIP_HOME}" ]
234 PATH
=${OO_SDK_ZIP_HOME}:${PATH}
235 export OO_SDK_ZIP_HOME
238 # Add directory of the C++ tools to the path, if necessary.
239 if [ -n "${OO_SDK_CPP_HOME}" ]
241 PATH
=${OO_SDK_CPP_HOME}:${PATH}
242 export OO_SDK_CPP_HOME
244 if [ -n "${OO_SDK_CC_55_OR_HIGHER}" ]
246 export OO_SDK_CC_55_OR_HIGHER
250 # Add directory of the Java tools to the path, if necessary.
251 if [ -n "${OO_SDK_JAVA_HOME}" ]
253 PATH
=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
254 # JAVA_HOME=${OO_SDK_JAVA_HOME}
256 export OO_SDK_JAVA_HOME
263 if [ "${platform}" = "MacOSX" ]
265 # For URE, prepare symbolic links for libraries:
266 # Only necessary on MacOSX, on other Unix systems the links are already prepared
267 # in the SDK installation.
269 # cleanup potential old links first
270 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
271 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
272 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
273 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
274 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
277 if [ "${OO_SDK_URE_HOME}" ]
279 mkdir
-p "${OO_SDK_OUT}/${directoryname}/lib"
280 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
281 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
282 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
283 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
284 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
285 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
286 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
287 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
288 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
289 "${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 " * URE = $OO_SDK_URE_HOME"
303 echo " * Make = $OO_SDK_MAKE_HOME"
304 echo " * Zip = $OO_SDK_ZIP_HOME"
305 echo " * C++ Compiler = $OO_SDK_CPP_HOME"
306 echo " * Java = $OO_SDK_JAVA_HOME"
307 echo " * SDK Output directory = $OO_SDK_OUT"
308 echo " * Auto deployment = $SDK_AUTO_DEPLOYMENT"
310 echo " ************************************************************************"
312 echo "\e]2;Shell prepared with the SDK environment\a"