Tue, 10 Jun 2008 10:17:35 -0700
Added tag jdk7-b28 for changeset 27509b7d21ed
1 #!echo "This is not a shell script"
2 #############################################################################
3 #
4 # Copyright 2006-2007 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 #############################################################################
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 #############################################################################
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}"
92 # The /java/devtools items
93 jdk_devtools="${slashjava}/devtools"
94 share="${jdk_devtools}/share"
96 # Needed for langtools, maybe other parts of the build
97 ANT_HOME="${share}/ant/latest"
98 export ANT_HOME
99 FINDBUGS_HOME="${share}/findbugs/latest"
100 export FINDBUGS_HOME
102 # The 3 bin directories in common to all platforms
103 sharebin="${share}/bin"
104 antbin="${ANT_HOME}/bin"
105 findbugsbin="${FINDBUGS_HOME}/bin"
107 # Check input
108 dirMustExist "${bootdir}" ALT_BOOTDIR
109 dirMustExist "${slashjava}" ALT_SLASH_JAVA
110 dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
111 dirMustExist "${ANT_HOME}" ANT_HOME
112 dirMustExist "${FINDBUGS_HOME}" FINDBUGS_HOME
114 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
115 osname=`uname -s`
116 if [ "${osname}" = SunOS ] ; then
118 # SOLARIS: Sparc or X86
119 osarch=`uname -p`
120 if [ "${osarch}" = sparc ] ; then
121 solaris_arch=sparc
122 else
123 solaris_arch=i386
124 fi
126 # Get the SS11 compilers into path (make sure it matches ALT setting)
127 compiler_path=${jdk_devtools}/${solaris_arch}/SUNWspro/SS11/bin
128 compiler_name=SS11
129 ALT_COMPILER_PATH="${compiler_path}"
130 export ALT_COMPILER_PATH
131 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
132 path4sdk=${compiler_path}:${sharebin}:${antbin}:${findbugsbin}
134 # Add basic solaris system paths
135 path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
137 # Get the previous JDK to be used to bootstrap the build
138 path4sdk=${bootdir}/bin:${path4sdk}
140 # Find GNU make
141 make=/usr/sfw/bin/gmake
142 if [ ! -f ${make} ] ; then
143 make=/opt/sfw/bin/gmake
144 if [ ! -f ${make} ] ; then
145 make=${jdk_devtools}/${solaris_arch}/bin/gnumake
146 fi
147 fi
148 fileMustExist "${make}" make
150 # File creation mask
151 umask 002
153 elif [ "${osname}" = Linux ] ; then
155 # LINUX: X86, AMD64
156 osarch=`uname -m`
157 if [ "${osarch}" = i686 ] ; then
158 linux_arch=i586
159 elif [ "${osarch}" = x86_64 ] ; then
160 linux_arch=amd64
161 fi
163 # Get the compilers into path (make sure it matches ALT setting)
164 compiler_path=/usr/bin
165 compiler_name=usr_bin
166 ALT_COMPILER_PATH="${compiler_path}"
167 export ALT_COMPILER_PATH
168 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
169 path4sdk=${compiler_path}:${sharebin}:${antbin}:${findbugsbin}
171 # Add basic paths
172 path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin
174 # Get the previous JDK to be used to bootstrap the build
175 path4sdk=${bootdir}/bin:${path4sdk}
177 # Find GNU make
178 make=/usr/bin/make
179 fileMustExist "${make}" make
181 umask 002
183 else
185 # Windows: Differs on CYGWIN vs. MKS, and the compiler available.
186 # Also, blanks in pathnames gives GNU make headaches, so anything placed
187 # in any ALT_* variable should be the short windows dosname.
189 # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
190 # Assumption here is that you are in a shell window via MKS or cygwin.
191 # MKS install should have defined the environment variable ROOTDIR.
192 # We also need to figure out which one we have: X86, AMD64
193 if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
194 windows_arch=amd64
195 else
196 windows_arch=i586
197 fi
199 # We need to determine if we are running a CYGWIN shell or an MKS shell
200 # (if uname isn't available, then it will be unix_toolset=unknown)
201 unix_toolset=unknown
202 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
203 # We kind of assume ROOTDIR is where MKS is and it's ok
204 unix_toolset=MKS
205 mkshome=`dosname -s "${ROOTDIR}"`
206 # Utility to convert to short pathnames without spaces
207 dosname="${mkshome}/mksnt/dosname -s"
208 # Most unix utilities are in the mksnt directory of ROOTDIR
209 unixcommand_path="${mkshome}/mksnt"
210 path4sdk="${sharebin};${antbin};${findbugsbin};${unixcommand_path}"
211 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
212 devtools_path="${jdk_devtools}/win32/bin"
213 path4sdk="${devtools_path};${path4sdk}"
214 # Normally this need not be set, but on Windows it's default is C:/UTILS
215 ALT_DEVTOOLS_PATH="${devtools_path}"
216 export ALT_DEVTOOLS_PATH
217 dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH
218 # Find GNU make
219 make="${devtools_path}/gnumake.exe"
220 fileMustExist "${make}" make
221 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
222 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
223 unix_toolset=CYGWIN
224 # Utility to convert to short pathnames without spaces
225 dosname="/usr/bin/cygpath -a -m -s"
226 # Most unix utilities are in the /usr/bin
227 unixcommand_path="/usr/bin"
228 path4sdk="${sharebin};${antbin};${findbugsbin};${unixcommand_path}"
229 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
230 # Find GNU make
231 make="${unixcommand_path}/make.exe"
232 fileMustExist "${make}" make
233 else
234 echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
235 fi
237 # WINDOWS: Compiler setup (nasty part)
238 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
239 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
240 if [ "${windows_arch}" = i586 ] ; then
241 # 32bit Windows compiler settings
242 # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
243 vs_root=`${dosname} "${VS71COMNTOOLS}/../.."`
244 # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
245 msdev_root="${vs_root}/Common7/Tools"
246 msdevtools_path="${msdev_root}/bin"
247 vc7_root="${vs_root}/Vc7"
248 compiler_path="${vc7_root}/bin"
249 compiler_name=VS2003
250 platform_sdk="${vc7_root}/PlatformSDK"
251 # LIB and INCLUDE must use ; as a separator
252 include4sdk="${vc7_root}/atlmfc/include"
253 include4sdk="${include4sdk};${vc7_root}/include"
254 include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
255 include4sdk="${include4sdk};${platform_sdk}/include"
256 include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
257 lib4sdk="${vc7_root}/atlmfc/lib"
258 lib4sdk="${lib4sdk};${vc7_root}/lib"
259 lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
260 lib4sdk="${lib4sdk};${platform_sdk}/lib"
261 lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
262 # Search path and DLL locating path
263 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
264 path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
265 path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
266 path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
267 path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
268 path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
269 path4sdk="${compiler_path};${path4sdk}"
270 elif [ "${windows_arch}" = amd64 ] ; then
271 # AMD64 64bit Windows compiler settings
272 if [ "${MSSDK}" != "" ] ; then
273 platform_sdk="${MSSDK}"
274 else
275 platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"`
276 fi
277 compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
278 compiler_name=VS2005_PSDK
279 msdevtools_path="${platform_sdk}/Bin"
280 # LIB and INCLUDE must use ; as a separator
281 include4sdk="${platform_sdk}/Include"
282 include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
283 include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
284 include4sdk="${include4sdk};${platform_sdk}/Include/atl"
285 include4sdk="${include4sdk};${platform_sdk}/Include/crt"
286 lib4sdk="${platform_sdk}/Lib/AMD64"
287 lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
288 # Search path and DLL locating path
289 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
290 path4sdk="${platform_sdk}/bin;${path4sdk}"
291 path4sdk="${compiler_path};${path4sdk}"
292 fi
293 # Export LIB and INCLUDE
294 unset lib
295 unset Lib
296 LIB="${lib4sdk}"
297 export LIB
298 unset include
299 unset Include
300 INCLUDE="${include4sdk}"
301 export INCLUDE
302 # Set the ALT variable
303 ALT_COMPILER_PATH=`${dosname} "${compiler_path}"`
304 export ALT_COMPILER_PATH
305 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
306 ALT_MSDEVTOOLS_PATH=`${dosname} "${msdevtools_path}"`
307 export ALT_MSDEVTOOLS_PATH
308 dirMustExist "${msdevtools_path}" ALT_MSDEVTOOLS_PATH
310 # WINDOWS: Get the previous JDK to be used to bootstrap the build
311 path4sdk="${bootdir}/bin;${path4sdk}"
313 # Turn all \\ into /, remove duplicates and trailing /
314 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
316 # For windows, it's hard to know where the system is, so we just add this
317 # to PATH.
318 path4sdk="${slash_path};${PATH}"
320 # Convert path4sdk to cygwin style
321 if [ "${unix_toolset}" = CYGWIN ] ; then
322 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
323 fi
325 fi
327 # Export PATH setting
328 PATH="${path4sdk}"
329 export PATH
331 # Things we need to unset
332 unset LD_LIBRARY_PATH
333 unset LD_LIBRARY_PATH_32
334 unset LD_LIBRARY_PATH_64
335 unset JAVA_HOME