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