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