update dev300-m58
[ooovba.git] / odk / setsdkenv_unix.csh.in
blob82a39e38aba4a6045bacaf103deac066e7247a9b
1 #! /bin/csh
3 # This script sets all enviroment variables, which are necessary for building
4 # 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 setenv OO_SDK_NAME @OO_SDK_NAME@
10 # Installation directory of the Software Development Kit.
11 # Example: setenv OO_SDK_HOME /opt/openoffice.org/basis3.0/sdk
12 setenv OO_SDK_HOME @OO_SDK_HOME@
14 # Office installation directory.
15 # Example: set OFFICE_HOME=/opt/openoffice.org3
16 set OFFICE_HOME=@OFFICE_HOME@
17 OFFICE_BASE_HOME=@OFFICE_BASE_HOME@
19 # URE installation directory.
20 # Example: setenv OO_SDK_URE_HOME /opt/openoffice.org/ure
21 setenv OO_SDK_URE_HOME @OO_SDK_URE_HOME@
23 # Directory of the make command.
24 # Example: setenv OO_SDK_MAKE_HOME /usr/bin
25 setenv OO_SDK_MAKE_HOME @OO_SDK_MAKE_HOME@
27 # Directory of the zip command.
28 # Example: setenv OO_SDK_ZIP_HOME /usr/bin
29 setenv OO_SDK_ZIP_HOME @OO_SDK_ZIP_HOME@
31 # Directory of the C++ compiler.
32 # Example: setenv OO_SDK_CPP_HOME /usr/bin
33 setenv OO_SDK_CPP_HOME @OO_SDK_CPP_HOME@
35 # Solaris only
36 setenv OO_SDK_CC_55_OR_HIGHER @OO_SDK_CC_55_OR_HIGHER@
38 # Directory of the Java SDK.
39 # Example: setenv OO_SDK_JAVA_HOME "/usr/jdk/jdk1.6.0_10"
40 setenv OO_SDK_JAVA_HOME @OO_SDK_JAVA_HOME@
42 # Special output directory
43 # Example: setenv OO_SDK_OUTPUT_DIR "$HOME"
44 setenv OO_SDK_OUTPUT_DIR @OO_SDK_OUTPUT_DIR@
46 # Environment variable to enable auto deployment of example components
47 # Example: set SDK_AUTO_DEPLOYMENT=YES
48 setenv SDK_AUTO_DEPLOYMENT @SDK_AUTO_DEPLOYMENT@
50 # Get the operating system.
51 set sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
53 # Set the directory name.
54 set programdir=program
55 set javadir=bin
56 switch (${sdk_platform})
57 case "darwin*":
58 set programdir="Contents/MacOS"
59 set javacdir=Commands
60 breaksw
61 endsw
64 # Set office program path.
65 if ( "${OFFICE_HOME}" != "" ) then
66 setenv OFFICE_PROGRAM_PATH "${OFFICE_HOME}/${programdir}"
67 endif
69 # Set office base program path.
70 if ( "${OFFICE_BASE_HOME}" != "" ) then
71 setenv OFFICE_BASE_PROGRAM_PATH "${OFFICE_BASE_HOME}/program"
72 endif
75 # Set UNO path, necessary to ensure that the cpp examples using the
76 # new UNO bootstrap mechanism use the configured office installation.
77 if ( ${?OFFICE_PROGRAM_PATH} ) then
78 setenv UNO_PATH "${OFFICE_PROGRAM_PATH}"
79 endif
81 if ( "${OO_SDK_URE_HOME}" != "" ) then
82 setenv OO_SDK_URE_BIN_DIR "${OO_SDK_URE_HOME}/bin"
83 setenv OO_SDK_URE_LIB_DIR "${OO_SDK_URE_HOME}/lib"
84 setenv OO_SDK_URE_JAVA_DIR "${OO_SDK_URE_HOME}/share/java"
85 else
86 setenv OO_SDK_URE_BIN_DIR "${OFFICE_PROGRAM_PATH}"
87 setenv OO_SDK_URE_LIB_DIR "${OFFICE_BASE_PROGRAM_PATH}"
88 setenv OO_SDK_URE_JAVA_DIR "${OFFICE_BASE_PROGRAM_PATH}/classes"
89 endif
91 # Set SDK example output directory
92 setenv OO_SDK_OUT ${OO_SDK_HOME}
93 if ( $?OO_SDK_OUTPUT_DIR ) then
94 setenv OO_SDK_OUT ${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
95 endif
97 # check platform and set appropriate variables
98 switch (`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`)
99 case "solaris*":
100 if ( `${OO_SDK_HOME}/config.guess | cut -d"-" -f1` == "sparc" ) then
101 set directoryname=solsparc
102 set platform=Solaris Sparc
103 else
104 set directoryname=solintel
105 set platform=Solaris Intel
106 endif
107 set comid=C52
108 set pltfrm=sunpro
109 set soext=so
110 set exampleout=SOLARISexample.out
111 set stldebug=_debug
113 # set LD_LIBRARY_PATH
114 if ( $?LD_LIBARY_PATH == 0) then
115 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
116 else
117 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
118 endif
119 breaksw
121 case "linux-gnu":
122 if ( $?OO_SDK_CPP_HOME == 0) then
123 set sdk_gxx_include_path=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
124 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
125 endif
127 set directoryname=linux
128 set comid=gcc3
129 set pltfrm=gcc
130 set soext=so
131 set exampleout=LINUXexample.out
132 set platform=Linux
133 set stldebug=_stldebug
135 # set LD_LIBRARY_PATH
136 if ( $?LD_LIBARY_PATH == 0) then
137 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
138 else
139 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
140 endif
141 breaksw
143 case "darwin*":
144 if ( $?OO_SDK_CPP_HOME == 0) then
145 set sdk_gxx_include_path=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
146 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
147 endif
149 set directoryname=macosx
150 set comid=gcc3
151 set pltfrm=gcc
152 set soext=dylib
153 set exampleout=MACOSXexample.out
154 set platform=MacOSX
155 set stldebug=_stldebug
157 # set DYLD_LIBRARY_PATH
158 if ( $?DYLD_LIBRARY_PATH == 0) then
159 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
160 else
161 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
162 endif
163 breaksw
165 case "freebsd*":
166 if ( $?OO_SDK_CPP_HOME == 0) then
167 set sdk_gxx_include_path=`echo "#include <cstring>" | ${OO_SDK_CPP_HOME}/g++ -E -xc++ - | sed -n '/.*1*"\(.*\)\/cstring".*/s//\1/p' | head -n 1`
168 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
169 endif
171 set directoryname=freebsd
172 set comid=gcc3
173 set pltfrm=gcc
174 set soext=so
175 set exampleout=FREEBSDexample.out
176 set platform=FreeBSD
177 set stldebug=_stldebug
179 # set LD_LIBRARY_PATH
180 if ( $?LD_LIBARY_PATH == 0) then
181 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
182 else
183 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
184 endif
186 if ( -e "/sbin/sysctl" ) then
187 set OSVERSION=`/sbin/sysctl -n kern.osreldate`
188 else
189 set OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
190 endif
192 if ( ${OSVERSION} < 500016 ) then
193 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
194 setenv PTHREAD_LIBS -pthread
195 else if ( ${OSVERSION} < 502102 ) then
196 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
197 setenv PTHREAD_LIBS -lc_r
198 else
199 setenv PTHREAD_LIBS -pthread
200 endif
201 breaksw
202 endsw
204 # set PATH
205 if ( $?PATH == 0) then
206 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.
207 else
208 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.:${PATH}
209 endif
211 # Set CLASSPATH
212 if ( ${?OFFICE_PROGRAM_PATH} ) then
213 if ( ${?CLASSPATH} == 0 ) then
214 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar"
215 else
216 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}"
217 endif
218 endif
219 if ( $?CLASSPATH == 0) then
220 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"
221 else
222 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}"
223 endif
225 if ( $?OO_SDK_CPP_HOME == 0) then
226 setenv PATH ${OO_SDK_CPP_HOME}:${PATH}
227 endif
229 if ( $?OO_SDK_JAVA_HOME == 0) then
230 setenv PATH ${OO_SDK_JAVA_HOME}:${PATH}
231 endif
233 if ( -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${stldebug}.${soext}" ) then
234 setenv STLDEBUG ${stldebug}
235 else
236 setenv STLDEBUG ""
237 endif
240 if [ "${platform}" == "MacOSX" ] then
241 # For URE, prepare symbolic links for libraries:
242 # Only necessary on MacOSX, on other Unix systems the links are already prepared
243 # in the SDK installation.
245 # cleanup potential old links first
246 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
247 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
248 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
249 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
250 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
252 if ( -e "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
253 rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
254 endif
256 if ( "${OO_SDK_URE_HOME}" != "" ) then
257 mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
258 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
259 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
260 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
261 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
262 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
263 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
264 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
265 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
266 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
267 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
269 if ( -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
270 ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
271 "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
272 endif
273 endif
274 endif
277 echo
278 echo " ************************************************************************"
279 echo " *"
280 echo " * SDK environment is prepared for ${platform}"
281 echo " *"
282 echo " * SDK = ${OO_SDK_HOME}"
283 echo " * Office = ${OFFICE_HOME}"
284 echo " * Office Base = ${OFFICE_BASE_HOME}"
285 echo " * URE = ${OO_SDK_URE_HOME}"
286 echo " * Make = ${OO_SDK_MAKE_HOME}"
287 echo " * Zip = ${OO_SDK_ZIP_HOME}"
288 if ( $?OO_SDK_CPP_HOME == 0) then
289 echo " * C++ Compiler = "
290 else
291 echo " * C++ Compiler = ${OO_SDK_CPP_HOME}"
292 endif
293 if ( $?OO_SDK_JAVA_HOME == 0) then
294 echo " * Java = "
295 else
296 echo " * Java = ${OO_SDK_JAVA_HOME}"
297 endif
298 if ( $?OO_SDK_OUTPUT_DIR == 0) then
299 echo " * Special Output directory = "
300 else
301 echo " * SDK Output directory = ${OO_SDK_OUT}"
302 endif
303 echo " * Auto deployment = ${SDK_AUTO_DEPLOYMENT}"
304 echo " *"
305 echo " ************************************************************************"
307 unset sdkdir
308 unset directoryname
309 unset comid
310 unset exampleout
311 unset platform
313 echo "\e]2;Shell prepared with the SDK environment\a"