Wed, 06 Aug 2008 16:39:58 -0700
Merge
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 # OPENJDK
36 # Windows Only:
37 # PATH
38 # VS71COMNTOOLS
39 # PROCESSOR_IDENTIFIER
40 # ROOTDIR
41 #
42 # Output variable settings:
43 # make Full path to GNU make
44 # compiler_path Path to compiler bin directory
45 # compiler_name Unique name of this compiler
46 #
47 # Output environment variables:
48 # PATH
49 # ALT_COMPILER_PATH
50 # OPENJDK only:
51 # ALT_CLOSED_JDK_IMPORT_PATH
52 # ALT_JDK_DEVTOOLS_DIR
53 # Windows Only:
54 # ALT_MSDEVTOOLS_PATH
55 # ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default)
56 # LIB
57 # INCLUDE
58 #
59 # After JDK6, most settings will be found via ALT_SLASH_JAVA or
60 # by way of other system environment variables. If this was JDK5
61 # or an older JDK, you might need to export more ALT_* variables.
62 #
63 # On Windows AMD64, if MSSDK is not set, assumes Platform SDK is installed at:
64 # C:/Program Files/Microsoft Platform SDK
65 #
66 #############################################################################
68 #############################################################################
69 # Error
70 error() # message
71 {
72 echo "ERROR: $1"
73 exit 6
74 }
75 # Directory must exist
76 dirMustExist() # dir name
77 {
78 if [ ! -d "$1" ] ; then
79 error "Directory for $2 does not exist: $1"
80 fi
81 }
82 # File must exist
83 fileMustExist() # dir name
84 {
85 if [ ! -f "$1" ] ; then
86 error "File for $2 does not exist: $1"
87 fi
88 }
89 #############################################################################
91 # Should be set by JPRT as the 3 basic inputs
92 bootdir="${ALT_BOOTDIR}"
93 slashjava="${ALT_SLASH_JAVA}"
94 jdk_import="${ALT_JDK_IMPORT_PATH}"
96 # The /java/devtools items
97 jdk_devtools="${slashjava}/devtools"
98 share="${jdk_devtools}/share"
100 # Needed for langtools, maybe other parts of the build
101 ANT_HOME="${share}/ant/latest"
102 export ANT_HOME
103 FINDBUGS_HOME="${share}/findbugs/latest"
104 export FINDBUGS_HOME
106 # The 3 bin directories in common to all platforms
107 sharebin="${share}/bin"
108 antbin="${ANT_HOME}/bin"
109 findbugsbin="${FINDBUGS_HOME}/bin"
111 # Check input
112 dirMustExist "${bootdir}" ALT_BOOTDIR
113 dirMustExist "${slashjava}" ALT_SLASH_JAVA
114 dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
115 dirMustExist "${ANT_HOME}" ANT_HOME
116 dirMustExist "${FINDBUGS_HOME}" FINDBUGS_HOME
118 # If ALT_PREVIOUS_RELEASE_IMAGE not defined, set it to the bootdir area for
119 # any possible image comparisons.
120 # We assume bootdir is a previous jdk release image, valid for comparison
121 # reasons.
122 if [ "${ALT_PREVIOUS_RELEASE_IMAGE}" = "" ] ; then
123 ALT_PREVIOUS_RELEASE_IMAGE="${bootdir}"
124 export ALT_PREVIOUS_RELEASE_IMAGE
125 fi
127 # Use the JDK import for now (FIXME: use the binary plugs?)
128 if [ "${OPENJDK}" = true ] ; then
129 ALT_CLOSED_JDK_IMPORT_PATH="${jdk_import}"
130 export ALT_CLOSED_JDK_IMPORT_PATH
131 fi
133 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
134 osname=`uname -s`
135 if [ "${osname}" = SunOS ] ; then
137 # SOLARIS: Sparc or X86
138 osarch=`uname -p`
139 if [ "${osarch}" = sparc ] ; then
140 solaris_arch=sparc
141 else
142 solaris_arch=i386
143 fi
145 # Get the compilers into path (make sure it matches ALT setting)
146 if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then
147 compiler_name=${JPRT_SOLARIS_COMPILER_NAME}
148 else
149 compiler_name=SS12
150 fi
151 compiler_path=${jdk_devtools}/${solaris_arch}/SUNWspro/${compiler_name}/bin
152 ALT_COMPILER_PATH="${compiler_path}"
153 export ALT_COMPILER_PATH
154 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
155 path4sdk=${compiler_path}:${sharebin}:${antbin}:${findbugsbin}
157 # Add basic solaris system paths
158 path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
160 # Get the previous JDK to be used to bootstrap the build
161 path4sdk=${bootdir}/bin:${path4sdk}
163 # Find GNU make
164 make=/usr/sfw/bin/gmake
165 if [ ! -f ${make} ] ; then
166 make=/opt/sfw/bin/gmake
167 if [ ! -f ${make} ] ; then
168 make=${jdk_devtools}/${solaris_arch}/bin/gnumake
169 fi
170 fi
171 fileMustExist "${make}" make
173 # File creation mask
174 umask 002
176 elif [ "${osname}" = Linux ] ; then
178 # LINUX: X86, AMD64
179 osarch=`uname -m`
180 if [ "${osarch}" = i686 ] ; then
181 linux_arch=i586
182 elif [ "${osarch}" = x86_64 ] ; then
183 linux_arch=amd64
184 fi
186 # Get the compilers into path (make sure it matches ALT setting)
187 compiler_path=/usr/bin
188 compiler_name=usr_bin
189 ALT_COMPILER_PATH="${compiler_path}"
190 export ALT_COMPILER_PATH
191 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
192 path4sdk=${compiler_path}:${sharebin}:${antbin}:${findbugsbin}
194 # Add basic paths
195 path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin
197 # Get the previous JDK to be used to bootstrap the build
198 path4sdk=${bootdir}/bin:${path4sdk}
200 # Find GNU make
201 make=/usr/bin/make
202 fileMustExist "${make}" make
204 umask 002
206 # Linux platform may be old, use motif files from the devtools area
207 if [ "${OPENJDK}" = true ] ; then
208 ALT_JDK_DEVTOOLS_DIR="${jdk_devtools}"
209 export ALT_JDK_DEVTOOLS_DIR
210 fi
213 else
215 # Windows: Differs on CYGWIN vs. MKS, and the compiler available.
216 # Also, blanks in pathnames gives GNU make headaches, so anything placed
217 # in any ALT_* variable should be the short windows dosname.
219 # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
220 # Assumption here is that you are in a shell window via MKS or cygwin.
221 # MKS install should have defined the environment variable ROOTDIR.
222 # We also need to figure out which one we have: X86, AMD64
223 if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
224 windows_arch=amd64
225 else
226 windows_arch=i586
227 fi
229 # We need to determine if we are running a CYGWIN shell or an MKS shell
230 # (if uname isn't available, then it will be unix_toolset=unknown)
231 unix_toolset=unknown
232 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
233 # We kind of assume ROOTDIR is where MKS is and it's ok
234 unix_toolset=MKS
235 mkshome=`dosname -s "${ROOTDIR}"`
236 # Utility to convert to short pathnames without spaces
237 dosname="${mkshome}/mksnt/dosname -s"
238 # Most unix utilities are in the mksnt directory of ROOTDIR
239 unixcommand_path="${mkshome}/mksnt"
240 path4sdk="${sharebin};${antbin};${findbugsbin};${unixcommand_path}"
241 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
242 devtools_path="${jdk_devtools}/win32/bin"
243 path4sdk="${devtools_path};${path4sdk}"
244 # Normally this need not be set, but on Windows it's default is C:/UTILS
245 ALT_DEVTOOLS_PATH="${devtools_path}"
246 export ALT_DEVTOOLS_PATH
247 dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH
248 # Find GNU make
249 make="${devtools_path}/gnumake.exe"
250 fileMustExist "${make}" make
251 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
252 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
253 unix_toolset=CYGWIN
254 # Utility to convert to short pathnames without spaces
255 dosname="/usr/bin/cygpath -a -m -s"
256 # Most unix utilities are in the /usr/bin
257 unixcommand_path="/usr/bin"
258 path4sdk="${sharebin};${antbin};${findbugsbin};${unixcommand_path}"
259 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
260 # Find GNU make
261 make="${unixcommand_path}/make.exe"
262 fileMustExist "${make}" make
263 else
264 echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
265 fi
267 # WINDOWS: Compiler setup (nasty part)
268 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
269 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
270 if [ "${windows_arch}" = i586 ] ; then
271 # 32bit Windows compiler settings
272 # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
273 vs_root=`${dosname} "${VS71COMNTOOLS}/../.."`
274 # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
275 msdev_root="${vs_root}/Common7/Tools"
276 msdevtools_path="${msdev_root}/bin"
277 vc7_root="${vs_root}/Vc7"
278 compiler_path="${vc7_root}/bin"
279 compiler_name=VS2003
280 platform_sdk="${vc7_root}/PlatformSDK"
281 # LIB and INCLUDE must use ; as a separator
282 include4sdk="${vc7_root}/atlmfc/include"
283 include4sdk="${include4sdk};${vc7_root}/include"
284 include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
285 include4sdk="${include4sdk};${platform_sdk}/include"
286 include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
287 lib4sdk="${vc7_root}/atlmfc/lib"
288 lib4sdk="${lib4sdk};${vc7_root}/lib"
289 lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
290 lib4sdk="${lib4sdk};${platform_sdk}/lib"
291 lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
292 # Search path and DLL locating path
293 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
294 path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
295 path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
296 path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
297 path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
298 path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
299 path4sdk="${compiler_path};${path4sdk}"
300 elif [ "${windows_arch}" = amd64 ] ; then
301 # AMD64 64bit Windows compiler settings
302 if [ "${MSSDK}" != "" ] ; then
303 platform_sdk="${MSSDK}"
304 else
305 platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"`
306 fi
307 compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
308 compiler_name=VS2005_PSDK
309 msdevtools_path="${platform_sdk}/Bin"
310 # LIB and INCLUDE must use ; as a separator
311 include4sdk="${platform_sdk}/Include"
312 include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
313 include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
314 include4sdk="${include4sdk};${platform_sdk}/Include/atl"
315 include4sdk="${include4sdk};${platform_sdk}/Include/crt"
316 lib4sdk="${platform_sdk}/Lib/AMD64"
317 lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
318 # Search path and DLL locating path
319 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
320 path4sdk="${platform_sdk}/bin;${path4sdk}"
321 path4sdk="${compiler_path};${path4sdk}"
322 fi
323 # Export LIB and INCLUDE
324 unset lib
325 unset Lib
326 LIB="${lib4sdk}"
327 export LIB
328 unset include
329 unset Include
330 INCLUDE="${include4sdk}"
331 export INCLUDE
332 # Set the ALT variable
333 ALT_COMPILER_PATH=`${dosname} "${compiler_path}"`
334 export ALT_COMPILER_PATH
335 dirMustExist "${compiler_path}" ALT_COMPILER_PATH
336 ALT_MSDEVTOOLS_PATH=`${dosname} "${msdevtools_path}"`
337 export ALT_MSDEVTOOLS_PATH
338 dirMustExist "${msdevtools_path}" ALT_MSDEVTOOLS_PATH
340 # WINDOWS: Get the previous JDK to be used to bootstrap the build
341 path4sdk="${bootdir}/bin;${path4sdk}"
343 # Turn all \\ into /, remove duplicates and trailing /
344 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
346 # For windows, it's hard to know where the system is, so we just add this
347 # to PATH.
348 path4sdk="${slash_path};${PATH}"
350 # Convert path4sdk to cygwin style
351 if [ "${unix_toolset}" = CYGWIN ] ; then
352 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
353 fi
355 # Set special windows ALT variables
356 ALT_ISHIELDDIR="C:/ishield802"
357 export ALT_ISHIELDDIR
359 # Sponsors binaries
360 ALT_SPONSOR1DIR=C:/sponsor_binaries
361 export ALT_SPONSOR1DIR
362 ALT_SPONSOR2DIR=C:/sponsor_binaries
363 export ALT_SPONSOR2DIR
365 fi
367 # Export PATH setting
368 PATH="${path4sdk}"
369 export PATH
371 # Things we need to unset
372 unset LD_LIBRARY_PATH
373 unset LD_LIBRARY_PATH_32
374 unset LD_LIBRARY_PATH_64
375 unset JAVA_HOME