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