Bump for 4.0-11
[LibreOffice.git] / odk / setsdkenv_unix.csh.in
blobc7394146a5a4d9f9496c8c344718cf8100fcb4db
1 #! /bin/csh
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # This script sets all enviroment variables, which are necessary for building
21 # the examples of the Office Development Kit.
22 # The Script was developed for the operating systems Solaris, Linux and MacOS.
24 # The SDK name
25 setenv OO_SDK_NAME @OO_SDK_NAME@
27 # Installation directory of the Software Development Kit.
28 # Example: setenv OO_SDK_HOME /opt/libreoffice/basis3.4/sdk
29 setenv OO_SDK_HOME '@OO_SDK_HOME@'
31 # Office installation directory.
32 # Example: set OFFICE_HOME=/opt/libreoffice
33 setenv OFFICE_HOME '@OFFICE_HOME@'
35 # URE installation directory.
36 # Example: setenv OO_SDK_URE_HOME /opt/libreoffice/ure
37 setenv OO_SDK_URE_HOME '@OO_SDK_URE_HOME@'
39 # Directory of the make command.
40 # Example: setenv OO_SDK_MAKE_HOME /usr/bin
41 setenv OO_SDK_MAKE_HOME @OO_SDK_MAKE_HOME@
43 # Directory of the zip command.
44 # Example: setenv OO_SDK_ZIP_HOME /usr/bin
45 setenv OO_SDK_ZIP_HOME @OO_SDK_ZIP_HOME@
47 # Directory of the C++ compiler.
48 # Example: setenv OO_SDK_CPP_HOME /usr/bin
49 setenv OO_SDK_CPP_HOME @OO_SDK_CPP_HOME@
51 # Solaris only
52 setenv OO_SDK_CC_55_OR_HIGHER @OO_SDK_CC_55_OR_HIGHER@
54 # Directory of the Java SDK.
55 # Example: setenv OO_SDK_JAVA_HOME "/usr/jdk/jdk1.6.0_10"
56 setenv OO_SDK_JAVA_HOME @OO_SDK_JAVA_HOME@
58 # Special output directory
59 # Example: setenv OO_SDK_OUTPUT_DIR "$HOME"
60 setenv OO_SDK_OUTPUT_DIR @OO_SDK_OUTPUT_DIR@
62 # Environment variable to enable auto deployment of example components
63 # Example: set SDK_AUTO_DEPLOYMENT=YES
64 setenv SDK_AUTO_DEPLOYMENT @SDK_AUTO_DEPLOYMENT@
66 # Get the operating system.
67 set sdk_platform=`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`
69 # Set the directory name.
70 set programdir=program
71 set javadir=bin
72 switch (${sdk_platform})
73 case "darwin*":
74 set programdir="Contents/MacOS"
75 set javacdir=Commands
76 breaksw
77 endsw
80 # Set office program path.
81 if ( "${OFFICE_HOME}" != "" ) then
82 setenv OFFICE_PROGRAM_PATH "${OFFICE_HOME}/${programdir}"
83 endif
86 # Set UNO path, necessary to ensure that the cpp examples using the
87 # new UNO bootstrap mechanism use the configured office installation.
88 if ( ${?OFFICE_PROGRAM_PATH} ) then
89 setenv UNO_PATH "${OFFICE_PROGRAM_PATH}"
90 endif
92 if ( "${OO_SDK_URE_HOME}" != "" ) then
93 setenv OO_SDK_URE_BIN_DIR "${OO_SDK_URE_HOME}/bin"
94 setenv OO_SDK_URE_LIB_DIR "${OO_SDK_URE_HOME}/lib"
95 setenv OO_SDK_URE_JAVA_DIR "${OO_SDK_URE_HOME}/share/java"
96 else
97 setenv OO_SDK_URE_BIN_DIR "${OFFICE_PROGRAM_PATH}"
98 setenv OO_SDK_URE_LIB_DIR "${OFFICE_PROGRAM_PATH}"
99 setenv OO_SDK_URE_JAVA_DIR "${OFFICE_PROGRAM_PATH}/classes"
100 endif
102 # Set SDK example output directory
103 setenv OO_SDK_OUT ${OO_SDK_HOME}
104 if ( $?OO_SDK_OUTPUT_DIR ) then
105 setenv OO_SDK_OUT ${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
106 endif
108 # check platform and set appropriate variables
109 switch (`${OO_SDK_HOME}/config.guess | cut -d"-" -f3,4`)
110 case "solaris*":
111 if ( `${OO_SDK_HOME}/config.guess | cut -d"-" -f1` == "sparc" ) then
112 set directoryname=solsparc
113 set platform=Solaris Sparc
114 else
115 set directoryname=solintel
116 set platform=Solaris Intel
117 endif
118 set comid=C52
119 set pltfrm=sunpro
120 set soext=so
121 set exampleout=SOLARISexample.out
123 # set LD_LIBRARY_PATH
124 if ( $?LD_LIBRARY_PATH == 0) then
125 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
126 else
127 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
128 endif
129 breaksw
131 case "linux-gnu":
132 set directoryname=linux
133 set comid=gcc3
134 set pltfrm=gcc
135 set soext=so
136 set exampleout=LINUXexample.out
137 set platform=Linux
139 # set LD_LIBRARY_PATH
140 if ( $?LD_LIBRARY_PATH == 0) then
141 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
142 else
143 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
144 endif
145 breaksw
147 case "darwin*":
148 set directoryname=macosx
149 set comid=gcc3
150 set pltfrm=gcc
151 set soext=dylib
152 set exampleout=MACOSXexample.out
153 set platform=MacOSX
155 # set DYLD_LIBRARY_PATH
156 if ( $?DYLD_LIBRARY_PATH == 0) then
157 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
158 else
159 setenv DYLD_LIBRARY_PATH ${OO_SDK_OUT}/${directoryname}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${DYLD_LIBRARY_PATH}
160 endif
161 breaksw
163 case "freebsd*":
164 set directoryname=freebsd
165 set comid=gcc3
166 set pltfrm=gcc
167 set soext=so
168 set exampleout=FREEBSDexample.out
169 set platform=FreeBSD
171 # set LD_LIBRARY_PATH
172 if ( $?LD_LIBRARY_PATH == 0) then
173 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.
174 else
175 setenv LD_LIBRARY_PATH ${OO_SDK_HOME}/lib:${OO_SDK_OUT}/${exampleout}/lib:${OO_SDK_URE_LIB_DIR}:.:${LD_LIBRARY_PATH}
176 endif
178 if ( -e "/sbin/sysctl" ) then
179 set OSVERSION=`/sbin/sysctl -n kern.osreldate`
180 else
181 set OSVERSION=`/usr/sbin/sysctl -n kern.osreldate`
182 endif
184 if ( ${OSVERSION} < 500016 ) then
185 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
186 setenv PTHREAD_LIBS -pthread
187 else if ( ${OSVERSION} < 502102 ) then
188 setenv PTHREAD_CFLAGS -D_THREAD_SAFE
189 setenv PTHREAD_LIBS -lc_r
190 else
191 setenv PTHREAD_LIBS -pthread
192 endif
193 breaksw
194 endsw
196 # set PATH
197 if ( $?PATH == 0) then
198 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.
199 else
200 setenv PATH ${OO_SDK_ZIP_HOME}:${OO_SDK_MAKE_HOME}:${OO_SDK_HOME}/bin:${OO_SDK_OUT}/${exampleout}:${OO_SDK_URE_BIN_DIR}:.:${PATH}
201 endif
203 # Set CLASSPATH
204 if ( ${?OFFICE_PROGRAM_PATH} ) then
205 if ( ${?CLASSPATH} == 0 ) then
206 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar"
207 else
208 setenv CLASSPATH "${OFFICE_PROGRAM_PATH}/classes/unoil.jar:${CLASSPATH}"
209 endif
210 endif
211 if ( $?CLASSPATH == 0) then
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"
213 else
214 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}"
215 endif
217 if ( $?OO_SDK_CPP_HOME == 0) then
218 setenv PATH ${OO_SDK_CPP_HOME}:${PATH}
219 endif
221 if ( $?OO_SDK_JAVA_HOME == 0) then
222 setenv PATH ${OO_SDK_JAVA_HOME}:${PATH}
223 endif
226 if ( "${platform}" == "MacOSX" ) then
227 # For URE, prepare symbolic links for libraries:
228 # Only necessary on MacOSX, on other Unix systems the links are already prepared
229 # in the SDK installation.
231 # cleanup potential old links first
232 rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
233 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
234 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
235 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}" \
236 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
238 if ( "${OO_SDK_URE_HOME}" != "" ) then
239 mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
240 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
241 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
242 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
243 "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
244 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
245 "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
246 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
247 "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
248 ln -s "${OO_SDK_URE_LIB_DIR}/libuno_purpenvhelper${comid}.${soext}.3" \
249 "${OO_SDK_OUT}/${directoryname}/lib/libuno_purpenvhelper${comid}.${soext}"
250 endif
251 endif
254 echo
255 echo " ************************************************************************"
256 echo " *"
257 echo " * SDK environment is prepared for ${platform}"
258 echo " *"
259 echo " * SDK = ${OO_SDK_HOME}"
260 echo " * Office = ${OFFICE_HOME}"
261 echo " * URE = ${OO_SDK_URE_HOME}"
262 echo " * Make = ${OO_SDK_MAKE_HOME}"
263 echo " * Zip = ${OO_SDK_ZIP_HOME}"
264 if ( $?OO_SDK_CPP_HOME == 0) then
265 echo " * C++ Compiler = "
266 else
267 echo " * C++ Compiler = ${OO_SDK_CPP_HOME}"
268 endif
269 if ( $?OO_SDK_JAVA_HOME == 0) then
270 echo " * Java = "
271 else
272 echo " * Java = ${OO_SDK_JAVA_HOME}"
273 endif
274 if ( $?OO_SDK_OUTPUT_DIR == 0) then
275 echo " * Special Output directory = "
276 else
277 echo " * SDK Output directory = ${OO_SDK_OUT}"
278 endif
279 echo " * Auto deployment = ${SDK_AUTO_DEPLOYMENT}"
280 echo " *"
281 echo " ************************************************************************"
283 unset sdkdir
284 unset directoryname
285 unset comid
286 unset exampleout
287 unset platform
289 echo "\e]2;Shell prepared with the SDK environment\a"