1 #!echo "This is not a shell script" |
|
2 ############################################################################# |
|
3 # |
|
4 # Copyright 2006-2009 Sun Microsystems, Inc. All Rights Reserved. |
|
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
6 # |
|
7 # This code is free software; you can redistribute it and/or modify it |
|
8 # under the terms of the GNU General Public License version 2 only, as |
|
9 # published by the Free Software Foundation. Sun designates this |
|
10 # particular file as subject to the "Classpath" exception as provided |
|
11 # by Sun in the LICENSE file that accompanied this code. |
|
12 # |
|
13 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 # version 2 for more details (a copy is included in the LICENSE file that |
|
17 # accompanied this code). |
|
18 # |
|
19 # You should have received a copy of the GNU General Public License version |
|
20 # 2 along with this work; if not, write to the Free Software Foundation, |
|
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
22 # |
|
23 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
24 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
25 # have any questions. |
|
26 # |
|
27 ############################################################################# |
|
28 # |
|
29 # JPRT shell configuration for building. |
|
30 # |
|
31 # Input environment variables: |
|
32 # ALT_BOOTDIR |
|
33 # ALT_SLASH_JAVA |
|
34 # ALT_JDK_IMPORT_PATH |
|
35 # Windows Only: |
|
36 # PATH |
|
37 # VS71COMNTOOLS |
|
38 # PROCESSOR_IDENTIFIER |
|
39 # ROOTDIR |
|
40 # |
|
41 # Output variable settings: |
|
42 # make Full path to GNU make |
|
43 # compiler_path Path to compiler bin directory |
|
44 # compiler_name Unique name of this compiler |
|
45 # |
|
46 # Output environment variables: |
|
47 # PATH |
|
48 # ALT_COMPILER_PATH |
|
49 # Windows Only: |
|
50 # ALT_MSDEVTOOLS_PATH |
|
51 # ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default) |
|
52 # LIB |
|
53 # INCLUDE |
|
54 # |
|
55 # After JDK6, most settings will be found via ALT_SLASH_JAVA or |
|
56 # by way of other system environment variables. If this was JDK5 |
|
57 # or an older JDK, you might need to export more ALT_* variables. |
|
58 # |
|
59 # On Windows AMD64, if MSSDK is not set, assumes Platform SDK is installed at: |
|
60 # C:/Program Files/Microsoft Platform SDK |
|
61 # |
|
62 ############################################################################# |
|
63 |
|
64 ############################################################################# |
|
65 # Error |
|
66 error() # message |
|
67 { |
|
68 echo "ERROR: $1" |
|
69 exit 6 |
|
70 } |
|
71 # Directory must exist |
|
72 dirMustExist() # dir name |
|
73 { |
|
74 if [ ! -d "$1" ] ; then |
|
75 error "Directory for $2 does not exist: $1" |
|
76 fi |
|
77 } |
|
78 # File must exist |
|
79 fileMustExist() # dir name |
|
80 { |
|
81 if [ ! -f "$1" ] ; then |
|
82 error "File for $2 does not exist: $1" |
|
83 fi |
|
84 } |
|
85 ############################################################################# |
|
86 |
|
87 # Should be set by JPRT as the 3 basic inputs |
|
88 bootdir="${ALT_BOOTDIR}" |
|
89 slashjava="${ALT_SLASH_JAVA}" |
|
90 jdk_import="${ALT_JDK_IMPORT_PATH}" |
|
91 |
|
92 # The /java/devtools items |
|
93 jdk_devtools="${slashjava}/devtools" |
|
94 share="${jdk_devtools}/share" |
|
95 |
|
96 # The 3 bin directories in common to all platforms |
|
97 sharebin="${share}/bin" |
|
98 |
|
99 # Check input |
|
100 dirMustExist "${bootdir}" ALT_BOOTDIR |
|
101 dirMustExist "${slashjava}" ALT_SLASH_JAVA |
|
102 dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH |
|
103 |
|
104 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. |
|
105 osname=`uname -s` |
|
106 if [ "${osname}" = SunOS ] ; then |
|
107 |
|
108 # SOLARIS: Sparc or X86 |
|
109 osarch=`uname -p` |
|
110 if [ "${osarch}" = sparc ] ; then |
|
111 solaris_arch=sparc |
|
112 else |
|
113 solaris_arch=i386 |
|
114 fi |
|
115 |
|
116 # Get the compilers into path (make sure it matches ALT setting) |
|
117 if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then |
|
118 compiler_name=${JPRT_SOLARIS_COMPILER_NAME} |
|
119 else |
|
120 compiler_name=SS12 |
|
121 fi |
|
122 compiler_path=${jdk_devtools}/${solaris_arch}/SUNWspro/${compiler_name}/bin |
|
123 ALT_COMPILER_PATH="${compiler_path}" |
|
124 export ALT_COMPILER_PATH |
|
125 dirMustExist "${compiler_path}" ALT_COMPILER_PATH |
|
126 path4sdk=${compiler_path}:${sharebin} |
|
127 |
|
128 # Add basic solaris system paths |
|
129 path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin |
|
130 |
|
131 # Get the previous JDK to be used to bootstrap the build |
|
132 path4sdk=${bootdir}/bin:${path4sdk} |
|
133 |
|
134 # Find GNU make |
|
135 make=/usr/sfw/bin/gmake |
|
136 if [ ! -f ${make} ] ; then |
|
137 make=/opt/sfw/bin/gmake |
|
138 if [ ! -f ${make} ] ; then |
|
139 make=${jdk_devtools}/${solaris_arch}/bin/gnumake |
|
140 fi |
|
141 fi |
|
142 fileMustExist "${make}" make |
|
143 |
|
144 # File creation mask |
|
145 umask 002 |
|
146 |
|
147 elif [ "${osname}" = Linux ] ; then |
|
148 |
|
149 # LINUX: X86, AMD64 |
|
150 osarch=`uname -m` |
|
151 if [ "${osarch}" = i686 ] ; then |
|
152 linux_arch=i586 |
|
153 elif [ "${osarch}" = x86_64 ] ; then |
|
154 linux_arch=amd64 |
|
155 fi |
|
156 |
|
157 # Get the compilers into path (make sure it matches ALT setting) |
|
158 compiler_path=/usr/bin |
|
159 compiler_name=usr_bin |
|
160 ALT_COMPILER_PATH="${compiler_path}" |
|
161 export ALT_COMPILER_PATH |
|
162 dirMustExist "${compiler_path}" ALT_COMPILER_PATH |
|
163 path4sdk=${compiler_path}:${sharebin} |
|
164 |
|
165 # Add basic paths |
|
166 path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin |
|
167 |
|
168 # Get the previous JDK to be used to bootstrap the build |
|
169 path4sdk=${bootdir}/bin:${path4sdk} |
|
170 |
|
171 # Find GNU make |
|
172 make=/usr/bin/make |
|
173 fileMustExist "${make}" make |
|
174 |
|
175 umask 002 |
|
176 |
|
177 else |
|
178 |
|
179 # Windows: Differs on CYGWIN vs. MKS, and the compiler available. |
|
180 # Also, blanks in pathnames gives GNU make headaches, so anything placed |
|
181 # in any ALT_* variable should be the short windows dosname. |
|
182 |
|
183 # WINDOWS: Install and use MKS or CYGWIN (should have already been done) |
|
184 # Assumption here is that you are in a shell window via MKS or cygwin. |
|
185 # MKS install should have defined the environment variable ROOTDIR. |
|
186 # We also need to figure out which one we have: X86, AMD64 |
|
187 if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then |
|
188 windows_arch=amd64 |
|
189 else |
|
190 windows_arch=i586 |
|
191 fi |
|
192 |
|
193 # We need to determine if we are running a CYGWIN shell or an MKS shell |
|
194 # (if uname isn't available, then it will be unix_toolset=unknown) |
|
195 unix_toolset=unknown |
|
196 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then |
|
197 # We kind of assume ROOTDIR is where MKS is and it's ok |
|
198 unix_toolset=MKS |
|
199 mkshome=`dosname -s "${ROOTDIR}"` |
|
200 # Utility to convert to short pathnames without spaces |
|
201 dosname="${mkshome}/mksnt/dosname -s" |
|
202 # Most unix utilities are in the mksnt directory of ROOTDIR |
|
203 unixcommand_path="${mkshome}/mksnt" |
|
204 path4sdk="${sharebin};${unixcommand_path}" |
|
205 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH |
|
206 devtools_path="${jdk_devtools}/win32/bin" |
|
207 path4sdk="${devtools_path};${path4sdk}" |
|
208 # Normally this need not be set, but on Windows it's default is C:/UTILS |
|
209 ALT_DEVTOOLS_PATH="${devtools_path}" |
|
210 export ALT_DEVTOOLS_PATH |
|
211 dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH |
|
212 # Find GNU make |
|
213 make="${devtools_path}/gnumake.exe" |
|
214 fileMustExist "${make}" make |
|
215 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then |
|
216 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist |
|
217 unix_toolset=CYGWIN |
|
218 # Utility to convert to short pathnames without spaces |
|
219 dosname="/usr/bin/cygpath -a -m -s" |
|
220 # Most unix utilities are in the /usr/bin |
|
221 unixcommand_path="/usr/bin" |
|
222 path4sdk="${sharebin};${unixcommand_path}" |
|
223 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH |
|
224 # Find GNU make |
|
225 make="${unixcommand_path}/make.exe" |
|
226 fileMustExist "${make}" make |
|
227 else |
|
228 echo "WARNING: Cannot figure out if this is MKS or CYGWIN" |
|
229 fi |
|
230 |
|
231 # WINDOWS: Compiler setup (nasty part) |
|
232 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE. |
|
233 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first |
|
234 if [ "${windows_arch}" = i586 ] ; then |
|
235 # 32bit Windows compiler settings |
|
236 # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined) |
|
237 vs_root=`${dosname} "${VS71COMNTOOLS}/../.."` |
|
238 # Fill in PATH, LIB, and INCLUDE (unset all others to make sure) |
|
239 msdev_root="${vs_root}/Common7/Tools" |
|
240 msdevtools_path="${msdev_root}/bin" |
|
241 vc7_root="${vs_root}/Vc7" |
|
242 compiler_path="${vc7_root}/bin" |
|
243 compiler_name=VS2003 |
|
244 platform_sdk="${vc7_root}/PlatformSDK" |
|
245 # LIB and INCLUDE must use ; as a separator |
|
246 include4sdk="${vc7_root}/atlmfc/include" |
|
247 include4sdk="${include4sdk};${vc7_root}/include" |
|
248 include4sdk="${include4sdk};${platform_sdk}/include/prerelease" |
|
249 include4sdk="${include4sdk};${platform_sdk}/include" |
|
250 include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include" |
|
251 lib4sdk="${vc7_root}/atlmfc/lib" |
|
252 lib4sdk="${lib4sdk};${vc7_root}/lib" |
|
253 lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease" |
|
254 lib4sdk="${lib4sdk};${platform_sdk}/lib" |
|
255 lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib" |
|
256 # Search path and DLL locating path |
|
257 # WARNING: CYGWIN has a link.exe too, make sure compilers are first |
|
258 path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}" |
|
259 path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}" |
|
260 path4sdk="${vs_root}/Common7/Tools;${path4sdk}" |
|
261 path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}" |
|
262 path4sdk="${vs_root}/Common7/IDE;${path4sdk}" |
|
263 path4sdk="${compiler_path};${path4sdk}" |
|
264 elif [ "${windows_arch}" = amd64 ] ; then |
|
265 # AMD64 64bit Windows compiler settings |
|
266 if [ "${MSSDK}" != "" ] ; then |
|
267 platform_sdk="${MSSDK}" |
|
268 else |
|
269 platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"` |
|
270 fi |
|
271 compiler_path="${platform_sdk}/Bin/win64/x86/AMD64" |
|
272 compiler_name=VS2005_PSDK |
|
273 msdevtools_path="${platform_sdk}/Bin" |
|
274 # LIB and INCLUDE must use ; as a separator |
|
275 include4sdk="${platform_sdk}/Include" |
|
276 include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys" |
|
277 include4sdk="${include4sdk};${platform_sdk}/Include/mfc" |
|
278 include4sdk="${include4sdk};${platform_sdk}/Include/atl" |
|
279 include4sdk="${include4sdk};${platform_sdk}/Include/crt" |
|
280 lib4sdk="${platform_sdk}/Lib/AMD64" |
|
281 lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc" |
|
282 # Search path and DLL locating path |
|
283 # WARNING: CYGWIN has a link.exe too, make sure compilers are first |
|
284 path4sdk="${platform_sdk}/bin;${path4sdk}" |
|
285 path4sdk="${compiler_path};${path4sdk}" |
|
286 fi |
|
287 # Export LIB and INCLUDE |
|
288 unset lib |
|
289 unset Lib |
|
290 LIB="${lib4sdk}" |
|
291 export LIB |
|
292 unset include |
|
293 unset Include |
|
294 INCLUDE="${include4sdk}" |
|
295 export INCLUDE |
|
296 # Set the ALT variable |
|
297 ALT_COMPILER_PATH=`${dosname} "${compiler_path}"` |
|
298 export ALT_COMPILER_PATH |
|
299 dirMustExist "${compiler_path}" ALT_COMPILER_PATH |
|
300 ALT_MSDEVTOOLS_PATH=`${dosname} "${msdevtools_path}"` |
|
301 export ALT_MSDEVTOOLS_PATH |
|
302 dirMustExist "${msdevtools_path}" ALT_MSDEVTOOLS_PATH |
|
303 |
|
304 # WINDOWS: Get the previous JDK to be used to bootstrap the build |
|
305 path4sdk="${bootdir}/bin;${path4sdk}" |
|
306 |
|
307 # Turn all \\ into /, remove duplicates and trailing / |
|
308 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`" |
|
309 |
|
310 # For windows, it's hard to know where the system is, so we just add this |
|
311 # to PATH. |
|
312 path4sdk="${slash_path};${PATH}" |
|
313 |
|
314 # Convert path4sdk to cygwin style |
|
315 if [ "${unix_toolset}" = CYGWIN ] ; then |
|
316 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" |
|
317 fi |
|
318 |
|
319 fi |
|
320 |
|
321 # Export PATH setting |
|
322 PATH="${path4sdk}" |
|
323 export PATH |
|
324 |
|
325 # Things we need to unset |
|
326 unset LD_LIBRARY_PATH |
|
327 unset LD_LIBRARY_PATH_32 |
|
328 unset LD_LIBRARY_PATH_64 |
|
329 unset JAVA_HOME |
|
330 |
|