blob: 73801313b4fdb7b7532ca5531d9b59dd01de42d4 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#!/bin/sh
2
3#
4# Copyright 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#############################################################################
30#
31# Generic build profile.sh for all platforms, works in bash, sh, and ksh.
32#
33# Copy this file to your own area, and edit it to suit your needs.
34#
35# Ideally you either won't need to set the ALT_* variables because the
36# build system will find what it needs through system provided paths
37# or environment variables, or you have installed the component in the
38# recommended default path.
39#
40# If you find yourself forced to set an ALT_* environment variable and
41# suspect we could have figured it out automatically, please let us know.
42#
43# Most ALT_* directory defaults are based on being in the parent directory in
44# ALT_SLASH_JAVA, so it's possible to create for example a "C:/jdk6"
45# directory, assign that to ALT_SLASH_JAVA, and place all the components
46# in that directory. This could also minimize the ALT_* environment
47# variables you need to set.
48#
49########
50#
51# Assumes basic unix utilities are in the PATH already (uname, hostname, etc.).
52#
53# On Windows, assumes PROCESSOR_IDENTIFIER, VS71COMNTOOLS,
54# SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and
55# USERNAME is defined in the environment.
56# This profile does not rely on using vcvars32.bat and 64bit Setup.bat.
57# Uses CYGWIN cygpath to make sure paths are space-free.
58#
59# The JDK Makefiles may change in the future, making some of these
60# settings unnecessary or redundant.
61#
62# This is a working example, but may or may not work on all systems.
63#
64#############################################################################
65#
66# WARNING: This file will clobber the value of some environment variables.
67#
68# Sets up these environment variables for doing JDK builds:
69# USERNAME
70# COMPUTERNAME
71# PATH
72# Windows Only:
73# LIB
74# INCLUDE
75# PS1
76# SHELL
77#
78# Attempts to set these variables for the JDK builds:
79# ALT_COMPILER_PATH
80# ALT_BOOTDIR
81# ALT_BINARY_PLUGS_PATH
82# ALT_CLOSED_JDK_IMPORT_PATH
83# Windows Only:
84# ALT_UNIXCOMMAND_PATH
85# ALT_MSDEVTOOLS_PATH
86# ALT_DXSDK_PATH
87# ALT_MSVCRT_DLL_PATH
88# ALT_MSVCR71_DLL_PATH
89#
90#############################################################################
91#
92# Keep in mind that at this point, we are running in some kind of shell
93# (sh, ksh, or bash). We don't know if it's solaris, linux, or windows
94# CYGWIN. We need to figure that out.
95
96# Find user name
97if [ "${USERNAME}" = "" ] ; then
98 USERNAME="${LOGNAME}"
99fi
100if [ "${USERNAME}" = "" ] ; then
101 USERNAME="${USER}"
102fi
103export USERNAME
104
105# Find machine name
106if [ "${COMPUTERNAME}" = "" ] ; then
107 COMPUTERNAME="$(hostname)"
108fi
109export COMPUTERNAME
110
111# Boot jdk
112bootjdk=jdk1.6.0
113importjdk=jdk1.7.0
114
115# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
116osname=$(uname -s)
117if [ "${osname}" = SunOS ] ; then
118
119 # System place where JDK installed images are stored?
120 jdk_instances=/usr/jdk/instances
121
122 # Get the SS11 compilers (and latest patches for them too)
123 if [ "${ALT_COMPILER_PATH}" = "" ] ; then
124 ALT_COMPILER_PATH=/opt/SUNWspro/bin
125 export ALT_COMPILER_PATH
126 fi
127 if [ ! -d ${ALT_COMPILER_PATH} ] ; then
128 echo "WARNING: Cannot access ALT_COMPILER_PATH=${ALT_COMPILER_PATH}"
129 fi
130
131 # Place compiler path early in PATH to avoid 'cc' conflicts.
132 path4sdk=${ALT_COMPILER_PATH}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
133
134 # Make sure these are unset
135 unset JAVA_HOME
136 unset LD_LIBRARY_PATH
137
138 # Build in C locale
139 LANG=C
140 export LANG
141 LC_ALL=C
142 export LC_ALL
143
144 umask 002
145
146elif [ "${osname}" = Linux ] ; then
147
148 # System place where JDK installed images are stored?
149 jdk_instances=/opt/java
150
151 # Use compilers from /usr/bin
152 path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
153
154 # Make sure these are unset
155 unset JAVA_HOME
156 unset LD_LIBRARY_PATH
157
158 # Build in C locale
159 LANG=C
160 export LANG
161 LC_ALL=C
162 export LC_ALL
163
164 umask 002
165
166else
167
168 # System place where JDK installed images are stored?
169 jdk_instances="C:"
170
171 # Windows: Differs on CYGWIN and the compiler available.
172 # Also, blanks in pathnames gives make headaches, so anything placed
173 # in any ALT_* variable should be the short windows DOS names.
174
175 # Check CYGWIN (should have already been done)
176 # Assumption here is that you are in a shell window via cygwin.
177 if [ "$(echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64)" != "" ] ; then
178 windows_arch=amd64
179 else
180 windows_arch=i586
181 fi
182 # We need to check if we are running a CYGWIN shell
183 if [ "$(uname -a | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then
184 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
185 # Utility to convert to short pathnames without spaces
186 cygpath="/usr/bin/cygpath -a -m -s"
187 # Most unix utilities are in the /usr/bin
188 unixcommand_path="/usr/bin"
189 # Make the prompt tell you CYGWIN
190 export PS1="CYGWIN:${COMPUTERNAME}:${USERNAME}[\!] "
191 else
192 echo "ERROR: Cannot find CYGWIN on this machine"
193 exit 1
194 fi
195 if [ "${ALT_UNIXCOMMAND_PATH}" != "" ] ; then
196 unixcommand_path=${ALT_UNIXCOMMAND_PATH}
197 fi
198
199 # Default shell
200 export SHELL="${unixcommand_path}/sh"
201
202 # Setup path system (verify this is right)
203 if [ "${SystemRoot}" != "" ] ; then
204 sys_root=$(${cygpath} "${SystemRoot}")
205 elif [ "${SYSTEMROOT}" != "" ] ; then
206 sys_root=$(${cygpath} "${SYSTEMROOT}")
207 else
208 sys_root=$(${cygpath} "C:/WINNT")
209 fi
210 path4sdk="${unixcommand_path};${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"
211 if [ ! -d "${sys_root}" ] ; then
212 echo "WARNING: No system root found at: ${sys_root}"
213 fi
214
215 # Compiler setup (nasty part)
216 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
217 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
218 if [ "${windows_arch}" = i586 ] ; then
219 # 32bit Windows compiler settings
220 # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
221 vs_root=$(${cygpath} "${VS71COMNTOOLS}/../..")
222 # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
223 msdev_root="${vs_root}/Common7/Tools"
224 msdevtools_path="${msdev_root}/bin"
225 vc7_root="${vs_root}/Vc7"
226 compiler_path="${vc7_root}/bin"
227 platform_sdk="${vc7_root}/PlatformSDK"
228
229 # LIB and INCLUDE must use ; as a separator
230 include4sdk="${vc7_root}/atlmfc/include"
231 include4sdk="${include4sdk};${vc7_root}/include"
232 include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
233 include4sdk="${include4sdk};${platform_sdk}/include"
234 include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
235 lib4sdk="${lib4sdk};${vc7_root}/lib"
236 lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
237 lib4sdk="${lib4sdk};${platform_sdk}/lib"
238 lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
239 # Search path and DLL locating path
240 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
241 path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
242 path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
243 path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
244 path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
245 path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
246 path4sdk="${compiler_path};${path4sdk}"
247 elif [ "${windows_arch}" = amd64 ] ; then
248 # AMD64 64bit Windows compiler settings
249 if [ "${ALT_DEPLOY_MSSDK}" != "" ] ; then
250 platform_sdk=${ALT_DEPLOY_MSSDK}
251 else
252 platform_sdk=$(${cygpath} "C:/Program Files/Microsoft Platform SDK/")
253 fi
254 if [ "${ALT_COMPILER_PATH}" != "" ] ; then
255 compiler_path=${ALT_COMPILER_PATH}
256 if [ "${ALT_DEPLOY_MSSDK}" = "" ] ; then
257 platform_sdk=${ALT_COMPILER_PATH}/../../../..
258 fi
259 else
260 compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
261 fi
262 if [ "${ALT_MSDEVTOOLS_PATH}" != "" ] ; then
263 msdevtools_path=${ALT_MSDEVTOOLS_PATH}
264 else
265 msdevtools_path="${platform_sdk}/Bin/win64/x86/AMD64"
266 fi
267 msdevtools_path="${compiler_path}"
268 # LIB and INCLUDE must use ; as a separator
269 include4sdk="${platform_sdk}/Include"
270 include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
271 include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
272 include4sdk="${include4sdk};${platform_sdk}/Include/atl"
273 include4sdk="${include4sdk};${platform_sdk}/Include/crt"
274 lib4sdk="${platform_sdk}/Lib/AMD64"
275 lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
276 # Search path and DLL locating path
277 # WARNING: CYGWIN has a link.exe too, make sure compilers are first
278 path4sdk="${platform_sdk}/bin;${path4sdk}"
279 path4sdk="${compiler_path};${path4sdk}"
280 fi
281 # Export LIB and INCLUDE
282 unset lib
283 unset Lib
284 LIB="${lib4sdk}"
285 export LIB
286 unset include
287 unset Include
288 INCLUDE="${include4sdk}"
289 export INCLUDE
290
291 # Turn all \\ into /, remove duplicates and trailing /
292 slash_path="$(echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g')"
293 path4sdk="${slash_path}"
294
295 # Convert path4sdk to cygwin style
296 path4sdk="$(/usr/bin/cygpath -p ${path4sdk})"
297
298fi
299
300# Get the previous JDK to be used to bootstrap the build
301if [ "${ALT_BOOTDIR}" = "" ] ; then
302 ALT_BOOTDIR=${jdk_instances}/${bootjdk}
303 export ALT_BOOTDIR
304fi
305if [ ! -d ${ALT_BOOTDIR} ] ; then
306 echo "WARNING: Cannot access ALT_BOOTDIR=${ALT_BOOTDIR}"
307fi
308
309# Get the import JDK to be used to get hotspot VM if not built
310if [ "${ALT_JDK_IMPORT_PATH}" = "" -a -d ${jdk_instances}/${importjdk} ] ; then
311 ALT_JDK_IMPORT_PATH=${jdk_instances}/${importjdk}
312 export ALT_JDK_IMPORT_PATH
313fi
314
315# Get the latest JDK binary plugs or build to import pre-built binaries
316if [ "${ALT_BINARY_PLUGS_PATH}" = "" ] ; then
317 binplugs=${jdk_instances}/openjdk-binary-plugs
318 jdkplugs=${jdk_instances}/${importjdk}
319 if [ -d ${binplugs} ] ; then
320 ALT_BINARY_PLUGS_PATH=${binplugs}
321 export ALT_BINARY_PLUGS_PATH
322 elif [ "${ALT_CLOSED_JDK_IMPORT_PATH}" = "" -a -d ${jdkplugs} ] ; then
323 ALT_CLOSED_JDK_IMPORT_PATH=${jdkplugs}
324 export ALT_CLOSED_JDK_IMPORT_PATH
325 fi
326 if [ "${ALT_BINARY_PLUGS_PATH}" = "" ] ; then
327 echo "WARNING: Missing ALT_BINARY_PLUGS_PATH: ${binplugs}"
328 fi
329fi
330if [ "${ALT_BINARY_PLUGS_PATH}" != "" -a ! -d "${ALT_BINARY_PLUGS_PATH}" ] ; then
331 echo "WARNING: Cannot access ALT_BINARY_PLUGS_PATH=${ALT_BINARY_PLUGS_PATH}"
332fi
333if [ "${ALT_CLOSED_JDK_IMPORT_PATH}" != "" -a ! -d "${ALT_CLOSED_JDK_IMPORT_PATH}" ] ; then
334 echo "WARNING: Cannot access ALT_CLOSED_JDK_IMPORT_PATH=${ALT_CLOSED_JDK_IMPORT_PATH}"
335fi
336
337# Export PATH setting
338PATH="${path4sdk}"
339export PATH
340