Thu, 11 Sep 2008 11:04:55 -0700
6745363: Add ability to run packtest to hotspot/test/makefile
Reviewed-by: ksrini
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 #
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 #############################################################################
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}"
54 # Check input
55 dirMustExist "${bootdir}" ALT_BOOTDIR
56 dirMustExist "${slashjava}" ALT_SLASH_JAVA
57 dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
59 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
60 osname=`uname -s`
61 if [ "${osname}" = SunOS ] ; then
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
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}" = "jdk6perf" ] ; then
77 # All jdk6 builds use SS11
78 compiler_name=SS11
79 else
80 compiler_name=SS12
81 fi
82 fi
84 # Get into path (make sure it matches ALT setting)
85 compiler_path=${slashjava}/devtools/${solaris_arch}/SUNWspro/${compiler_name}/bin
86 dirMustExist "${compiler_path}" COMPILER_PATH
87 path4sdk=${compiler_path}
89 # Add basic solaris system paths
90 path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
92 # Get the previous JDK to be used to bootstrap the build
93 path4sdk=${bootdir}/bin:${path4sdk}
95 # Find GNU make
96 make=/usr/sfw/bin/gmake
97 if [ ! -f ${make} ] ; then
98 make=/opt/sfw/bin/gmake
99 if [ ! -f ${make} ] ; then
100 make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
101 fi
102 fi
103 fileMustExist "${make}" make
105 # File creation mask
106 umask 002
108 elif [ "${osname}" = Linux ] ; then
110 # LINUX: X86, AMD64
111 osarch=`uname -m`
112 if [ "${osarch}" = i686 ] ; then
113 linux_arch=i586
114 elif [ "${osarch}" = x86_64 ] ; then
115 linux_arch=amd64
116 fi
118 # Get the compilers into path (make sure it matches ALT setting)
119 compiler_path=/usr/bin
120 dirMustExist "${compiler_path}" COMPILER_PATH
121 path4sdk=${compiler_path}
123 # Add basic paths
124 path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin
126 # Get the previous JDK to be used to bootstrap the build
127 path4sdk=${bootdir}/bin:${path4sdk}
129 # Find GNU make
130 make=/usr/bin/make
131 fileMustExist "${make}" make
133 umask 002
135 else
137 # Windows: Differs on CYGWIN vs. MKS, and the compiler available.
138 # Also, blanks in pathnames gives GNU make headaches, so anything placed
139 # in any ALT_* variable should be the short windows dosname.
141 # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
142 # Assumption here is that you are in a shell window via MKS or cygwin.
143 # MKS install should have defined the environment variable ROOTDIR.
144 # We also need to figure out which one we have: X86, AMD64
145 if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
146 windows_arch=amd64
147 else
148 windows_arch=i586
149 fi
151 # We need to determine if we are running a CYGWIN shell or an MKS shell
152 # (if uname isn't available, then it will be unix_toolset=unknown)
153 unix_toolset=unknown
154 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
155 # We kind of assume ROOTDIR is where MKS is and it's ok
156 unix_toolset=MKS
157 mkshome=`dosname -s "${ROOTDIR}"`
158 # Utility to convert to short pathnames without spaces
159 dosname="${mkshome}/mksnt/dosname -s"
160 # Most unix utilities are in the mksnt directory of ROOTDIR
161 unixcommand_path="${mkshome}/mksnt"
162 path4sdk="${unixcommand_path}"
163 dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
164 devtools_path="${slashjava}/devtools/win32/bin"
165 path4sdk="${devtools_path};${path4sdk}"
166 dirMustExist "${devtools_path}" DEVTOOLS_PATH
167 # Find GNU make
168 make="${devtools_path}/gnumake.exe"
169 fileMustExist "${make}" make
170 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
171 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
172 unix_toolset=CYGWIN
173 # Utility to convert to short pathnames without spaces
174 dosname="/usr/bin/cygpath -a -m -s"
175 # Most unix utilities are in the /usr/bin
176 unixcommand_path="/usr/bin"
177 path4sdk="${unixcommand_path}"
178 dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
179 # Find GNU make
180 make="${unixcommand_path}/make.exe"
181 fileMustExist "${make}" make
182 else
183 echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
184 fi
186 # WINDOWS: Compiler setup (nasty part)
187 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
188 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
189 if [ "${windows_arch}" = i586 ] ; then
190 # 32bit Windows compiler settings
191 # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
192 vs_root=`${dosname} "${VS71COMNTOOLS}/../.."`
193 # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
194 vc7_root="${vs_root}/Vc7"
195 compiler_path="${vc7_root}/bin"
196 platform_sdk="${vc7_root}/PlatformSDK"
197 # LIB and INCLUDE must use ; as a separator
198 include4sdk="${vc7_root}/atlmfc/include"
199 include4sdk="${include4sdk};${vc7_root}/include"
200 include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
201 include4sdk="${include4sdk};${platform_sdk}/include"
202 include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
203 lib4sdk="${vc7_root}/atlmfc/lib"
204 lib4sdk="${lib4sdk};${vc7_root}/lib"
205 lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
206 lib4sdk="${lib4sdk};${platform_sdk}/lib"
207 lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
208 # Search path and DLL locating path
209 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
210 path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
211 path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
212 path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
213 path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
214 path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
215 path4sdk="${compiler_path};${path4sdk}"
216 elif [ "${windows_arch}" = amd64 ] ; then
217 # AMD64 64bit Windows compiler settings
218 if [ "${MSSDK}" != "" ] ; then
219 platform_sdk="${MSSDK}"
220 else
221 platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"`
222 fi
223 compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
224 # LIB and INCLUDE must use ; as a separator
225 include4sdk="${platform_sdk}/Include"
226 include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
227 include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
228 include4sdk="${include4sdk};${platform_sdk}/Include/atl"
229 include4sdk="${include4sdk};${platform_sdk}/Include/crt"
230 lib4sdk="${platform_sdk}/Lib/AMD64"
231 lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
232 # Search path and DLL locating path
233 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
234 path4sdk="${platform_sdk}/bin;${path4sdk}"
235 path4sdk="${compiler_path};${path4sdk}"
236 fi
237 # Export LIB and INCLUDE
238 unset lib
239 unset Lib
240 LIB="${lib4sdk}"
241 export LIB
242 unset include
243 unset Include
244 INCLUDE="${include4sdk}"
245 export INCLUDE
246 # Set the ALT variable
247 dirMustExist "${compiler_path}" COMPILER_PATH
249 # WINDOWS: Get the previous JDK to be used to bootstrap the build
250 path4sdk="${bootdir}/bin;${path4sdk}"
252 # Turn all \\ into /, remove duplicates and trailing /
253 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
255 # For windows, it's hard to know where the system is, so we just add this
256 # to PATH.
257 path4sdk="${slash_path};${PATH}"
259 # Convert path4sdk to cygwin style
260 if [ "${unix_toolset}" = CYGWIN ] ; then
261 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
262 fi
264 fi
266 # Export PATH setting
267 PATH="${path4sdk}"
268 export PATH
270 # Unset certain vars
271 unset LD_LIBRARY_PATH
272 unset LD_LIBRARY_PATH_32
273 unset LD_LIBRARY_PATH_64