remove debugcommand -- debugrun is superceding it
[LibreOffice.git] / odk / setsdkenv_unix.sh.in
blob5ed1aff311e8a76237f9d7c0c5b2cc984762a7e2
1 #! /bin/sh
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.
7 # The SDK name
8 OO_SDK_NAME=@OO_SDK_NAME@
9 export 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@
36 # Solaris only
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}" ]
54 then
55 echo Error: Please insert a correct value for the variable OO_SDK_HOME.
56 exit 0
59 export OO_SDK_HOME
61 # Check installation path for the office.
62 if [ -z "${OFFICE_HOME}" ] && [ -z "${OO_SDK_URE_HOME}" ]
63 then
64 echo 'Error: Please set either the environment variable OFFICE_HOME or the'
65 echo 'environment variable OO_SDK_URE_HOME.'
66 exit 0
69 # Get the operating system.
70 sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
72 # Set the directory name.
73 programdir=program
74 javadir=bin
75 case ${sdk_platform} in
76 darwin*)
77 programdir="Contents/MacOS"
78 javacdir=Commands
80 esac
82 # Set office program path (only set when using an Office).
83 if [ "${OFFICE_HOME}" ]
84 then
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}" ]
94 then
95 UNO_PATH=${OFFICE_PROGRAM_PATH}
96 export UNO_PATH
99 if [ "${OO_SDK_URE_HOME}" ]
100 then
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
104 else
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}" ]
116 then
117 OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
118 export OO_SDK_OUT
121 # Set the directory name.
122 case ${sdk_platform} in
123 solaris*)
124 sdk_proctype=`${OO_SDK_HOME}/config.guess | cut -d"-" -f1`
125 if [ "${sdk_proctype}" = "sparc" ]
126 then
127 directoryname=solsparc
128 platform='Solaris Sparc'
129 else
130 directoryname=solintel
131 platform='Solaris x86'
133 comid=C52
134 pltfrm=sunpro
135 soext=so
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
141 darwin*)
142 if [ -n "$OO_SDK_CPP_HOME" ]
143 then
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
148 directoryname=macosx
149 comid=gcc3
150 pltfrm=gcc
151 soext=dylib
152 exampleout=MACOSXexample.out
153 platform=MacOSX
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
158 linux-gnu)
159 if [ -n "$OO_SDK_CPP_HOME" ]
160 then
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
165 directoryname=linux
166 comid=gcc3
167 pltfrm=gcc
168 soext=so
169 exampleout=LINUXexample.out
170 platform=Linux
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
175 freebsd*)
176 if [ -n "$OO_SDK_CPP_HOME" ]
177 then
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
183 comid=gcc3
184 pltfrm=gcc
185 soext=so
186 exampleout=FREEBSDexample.out
187 platform=FreeBSD
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" ]
192 then
193 OSVERSION=`/sbin/sysctl -n kern.osreldate`
194 else
195 OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
197 if [ $OSVERSION -lt 500016 ]
198 then
199 PTHREAD_CFLAGS=-D_THREAD_SAFE
200 PTHREAD_LIBS=-pthread
201 export PTHREAD_CFLAGS
202 export PTHREAD_LIBS
203 elif [ $OSVERSION -lt 502102 ]
204 then
205 PTHREAD_CFLAGS=-D_THREAD_SAFE
206 PTHREAD_LIBS=-lc_r
207 export PTHREAD_CFLAGS
208 export PTHREAD_LIBS
209 else
210 PTHREAD_LIBS=-pthread
211 export PTHREAD_LIBS
214 esac
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}
219 # Set the classpath
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}
221 export CLASSPATH
224 # Add directory of the command make to the path, if necessary.
225 if [ -n "${OO_SDK_MAKE_HOME}" ]
226 then
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}" ]
233 then
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}" ]
240 then
241 PATH=${OO_SDK_CPP_HOME}:${PATH}
242 export OO_SDK_CPP_HOME
244 if [ -n "${OO_SDK_CC_55_OR_HIGHER}" ]
245 then
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}" ]
252 then
253 PATH=${OO_SDK_JAVA_HOME}/${javadir}:${PATH}
254 # JAVA_HOME=${OO_SDK_JAVA_HOME}
255 # export JAVA_HOME
256 export OO_SDK_JAVA_HOME
258 export PATH
261 export PATH
263 if [ "${platform}" = "MacOSX" ]
264 then
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}"
276 # prepare links
277 if [ "${OO_SDK_URE_HOME}" ]
278 then
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.
295 echo
296 echo " ************************************************************************"
297 echo " *"
298 echo " * SDK environment is prepared for ${platform}"
299 echo " *"
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"
309 echo " *"
310 echo " ************************************************************************"
312 echo "\e]2;Shell prepared with the SDK environment\a"