Bump for 3.6-28
[LibreOffice.git] / odk / setsdkenv_unix.csh.in
blobf5a2cdcc154e2d205400485ccc12505a2969c8f0
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/libreoffice/basis3.4/sdk
12 setenv OO_SDK_HOME '@OO_SDK_HOME@'
14 # Office installation directory.
15 # Example: set OFFICE_HOME=/opt/libreoffice
16 setenv OFFICE_HOME '@OFFICE_HOME@'
18 # URE installation directory.
19 # Example: setenv OO_SDK_URE_HOME /opt/libreoffice/ure
20 setenv OO_SDK_URE_HOME '@OO_SDK_URE_HOME@'
22 # Directory of the make command.
23 # Example: setenv OO_SDK_MAKE_HOME /usr/bin
24 setenv OO_SDK_MAKE_HOME @OO_SDK_MAKE_HOME@
26 # Directory of the zip command.
27 # Example: setenv OO_SDK_ZIP_HOME /usr/bin
28 setenv OO_SDK_ZIP_HOME @OO_SDK_ZIP_HOME@
30 # Directory of the C++ compiler.
31 # Example: setenv OO_SDK_CPP_HOME /usr/bin
32 setenv OO_SDK_CPP_HOME @OO_SDK_CPP_HOME@
34 # Solaris only
35 setenv OO_SDK_CC_55_OR_HIGHER @OO_SDK_CC_55_OR_HIGHER@
37 # Directory of the Java SDK.
38 # Example: setenv OO_SDK_JAVA_HOME "/usr/jdk/jdk1.6.0_10"
39 setenv OO_SDK_JAVA_HOME @OO_SDK_JAVA_HOME@
41 # Special output directory
42 # Example: setenv OO_SDK_OUTPUT_DIR "$HOME"
43 setenv OO_SDK_OUTPUT_DIR @OO_SDK_OUTPUT_DIR@
45 # Environment variable to enable auto deployment of example components
46 # Example: set SDK_AUTO_DEPLOYMENT=YES
47 setenv SDK_AUTO_DEPLOYMENT @SDK_AUTO_DEPLOYMENT@
49 # Get the operating system.
50 set sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
52 # Set the directory name.
53 set programdir=program
54 set javadir=bin
55 switch (${sdk_platform})
56 case "darwin*":
57 set programdir="Contents/MacOS"
58 set javacdir=Commands
59 breaksw
60 endsw
63 # Set office program path.
64 if ( "${OFFICE_HOME}" != "" ) then
65 setenv OFFICE_PROGRAM_PATH "${OFFICE_HOME}/${programdir}"
66 endif
69 # Set UNO path, necessary to ensure that the cpp examples using the
70 # new UNO bootstrap mechanism use the configured office installation.
71 if ( ${?OFFICE_PROGRAM_PATH} ) then
72 setenv UNO_PATH "${OFFICE_PROGRAM_PATH}"
73 endif
75 if ( "${OO_SDK_URE_HOME}" != "" ) then
76 setenv OO_SDK_URE_BIN_DIR "${OO_SDK_URE_HOME}/bin"
77 setenv OO_SDK_URE_LIB_DIR "${OO_SDK_URE_HOME}/lib"
78 setenv OO_SDK_URE_JAVA_DIR "${OO_SDK_URE_HOME}/share/java"
79 else
80 setenv OO_SDK_URE_BIN_DIR "${OFFICE_PROGRAM_PATH}"
81 setenv OO_SDK_URE_LIB_DIR "${OFFICE_PROGRAM_PATH}"
82 setenv OO_SDK_URE_JAVA_DIR "${OFFICE_PROGRAM_PATH}/classes"
83 endif
85 # Set SDK example output directory
86 setenv OO_SDK_OUT ${OO_SDK_HOME}
87 if ( $?OO_SDK_OUTPUT_DIR ) then
88 setenv OO_SDK_OUT ${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
89 endif
91 # check platform and set appropriate variables
92 switch (`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`)
93 case "solaris*":
94 if ( `${OO_SDK_HOME}/config.guess | cut -d"-" -f1` == "sparc" ) then
95 set directoryname=solsparc
96 set platform=Solaris Sparc
97 else
98 set directoryname=solintel
99 set platform=Solaris Intel
100 endif
101 set comid=C52
102 set pltfrm=sunpro
103 set soext=so
104 set exampleout=SOLARISexample.out
106 # set LD_LIBRARY_PATH
107 if ( $?LD_LIBARY_PATH == 0) then
108 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
109 else
110 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
111 endif
112 breaksw
114 case "linux-gnu":
115 if ( $?OO_SDK_CPP_HOME == 0) then
116 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`
117 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
118 endif
120 set directoryname=linux
121 set comid=gcc3
122 set pltfrm=gcc
123 set soext=so
124 set exampleout=LINUXexample.out
125 set platform=Linux
127 # set LD_LIBRARY_PATH
128 if ( $?LD_LIBARY_PATH == 0) then
129 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
130 else
131 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
132 endif
133 breaksw
135 case "darwin*":
136 if ( $?OO_SDK_CPP_HOME == 0) then
137 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`
138 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
139 endif
141 set directoryname=macosx
142 set comid=gcc3
143 set pltfrm=gcc
144 set soext=dylib
145 set exampleout=MACOSXexample.out
146 set platform=MacOSX
148 # set DYLD_LIBRARY_PATH
149 if ( $?DYLD_LIBRARY_PATH == 0) then
150 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
151 else
152 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
153 endif
154 breaksw
156 case "freebsd*":
157 if ( $?OO_SDK_CPP_HOME == 0) then
158 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`
159 setenv SDK_GXX_INCLUDE_PATH ${sdk_gxx_include_path}
160 endif
162 set directoryname=freebsd
163 set comid=gcc3
164 set pltfrm=gcc
165 set soext=so
166 set exampleout=FREEBSDexample.out
167 set platform=FreeBSD
169 # set LD_LIBRARY_PATH
170 if ( $?LD_LIBARY_PATH == 0) then
171 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
172 else
173 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
174 endif
176 if ( -e "/sbin/sysctl" ) then
177 set OSVERSION=`/sbin/sysctl -n kern.osreldate`
178 else
179 set OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
180 endif
182 if ( ${OSVERSION} < 500016 ) then
183 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
184 setenv PTHREAD_LIBS -pthread
185 else if ( ${OSVERSION} < 502102 ) then
186 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
187 setenv PTHREAD_LIBS -lc_r
188 else
189 setenv PTHREAD_LIBS -pthread
190 endif
191 breaksw
192 endsw
194 # set PATH
195 if ( $?PATH == 0) then
196 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.
197 else
198 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.:${PATH}
199 endif
201 # Set CLASSPATH
202 if ( ${?OFFICE_PROGRAM_PATH} ) then
203 if ( ${?CLASSPATH} == 0 ) then
204 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar"
205 else
206 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}"
207 endif
208 endif
209 if ( $?CLASSPATH == 0) then
210 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"
211 else
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:${CLASSPATH}"
213 endif
215 if ( $?OO_SDK_CPP_HOME == 0) then
216 setenv PATH ${OO_SDK_CPP_HOME}:${PATH}
217 endif
219 if ( $?OO_SDK_JAVA_HOME == 0) then
220 setenv PATH ${OO_SDK_JAVA_HOME}:${PATH}
221 endif
224 if ( "${platform}" == "MacOSX" ) then
225 # For URE, prepare symbolic links for libraries:
226 # Only necessary on MacOSX, on other Unix systems the links are already prepared
227 # in the SDK installation.
229 # cleanup potential old links first
230 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
231 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
232 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
233 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
234 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
236 if ( "${OO_SDK_URE_HOME}" != "" ) then
237 mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
238 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
239 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
240 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
241 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
242 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
243 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
244 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
245 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
246 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
247 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
248 endif
249 endif
252 echo
253 echo " ************************************************************************"
254 echo " *"
255 echo " * SDK environment is prepared for ${platform}"
256 echo " *"
257 echo " * SDK = ${OO_SDK_HOME}"
258 echo " * Office = ${OFFICE_HOME}"
259 echo " * URE = ${OO_SDK_URE_HOME}"
260 echo " * Make = ${OO_SDK_MAKE_HOME}"
261 echo " * Zip = ${OO_SDK_ZIP_HOME}"
262 if ( $?OO_SDK_CPP_HOME == 0) then
263 echo " * C++ Compiler = "
264 else
265 echo " * C++ Compiler = ${OO_SDK_CPP_HOME}"
266 endif
267 if ( $?OO_SDK_JAVA_HOME == 0) then
268 echo " * Java = "
269 else
270 echo " * Java = ${OO_SDK_JAVA_HOME}"
271 endif
272 if ( $?OO_SDK_OUTPUT_DIR == 0) then
273 echo " * Special Output directory = "
274 else
275 echo " * SDK Output directory = ${OO_SDK_OUT}"
276 endif
277 echo " * Auto deployment = ${SDK_AUTO_DEPLOYMENT}"
278 echo " *"
279 echo " ************************************************************************"
281 unset sdkdir
282 unset directoryname
283 unset comid
284 unset exampleout
285 unset platform
287 echo "\e]2;Shell prepared with the SDK environment\a"