annotate make/jdk_generic_profile.sh @ 7884:70e3553d9d6e

Added tag jdk7u80-b05 for changeset d4bd8bd71ca7
author asaha
date Wed, 21 Jan 2015 08:22:16 -0800
parents 272483f6650b
children
rev   line source
duke@0 1 #!/bin/sh
duke@0 2
duke@0 3 #
ohair@3909 4 # Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
duke@0 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 6 #
duke@0 7 # This code is free software; you can redistribute it and/or modify it
duke@0 8 # under the terms of the GNU General Public License version 2 only, as
ohair@2362 9 # published by the Free Software Foundation. Oracle designates this
duke@0 10 # particular file as subject to the "Classpath" exception as provided
ohair@2362 11 # by Oracle in the LICENSE file that accompanied this code.
duke@0 12 #
duke@0 13 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 16 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 17 # accompanied this code).
duke@0 18 #
duke@0 19 # You should have received a copy of the GNU General Public License version
duke@0 20 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 22 #
ohair@2362 23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 24 # or visit www.oracle.com if you need additional information or have any
ohair@2362 25 # questions.
duke@0 26 #
duke@0 27
duke@0 28
duke@0 29 #############################################################################
duke@0 30 #
duke@0 31 # Generic build profile.sh for all platforms, works in bash, sh, and ksh.
duke@0 32 #
duke@0 33 # Copy this file to your own area, and edit it to suit your needs.
duke@0 34 #
duke@0 35 # Ideally you either won't need to set the ALT_* variables because the
duke@0 36 # build system will find what it needs through system provided paths
duke@0 37 # or environment variables, or you have installed the component in the
duke@0 38 # recommended default path.
duke@0 39 #
duke@0 40 # If you find yourself forced to set an ALT_* environment variable and
duke@0 41 # suspect we could have figured it out automatically, please let us know.
duke@0 42 #
duke@0 43 # Most ALT_* directory defaults are based on being in the parent directory in
duke@0 44 # ALT_SLASH_JAVA, so it's possible to create for example a "C:/jdk6"
duke@0 45 # directory, assign that to ALT_SLASH_JAVA, and place all the components
duke@0 46 # in that directory. This could also minimize the ALT_* environment
duke@0 47 # variables you need to set.
duke@0 48 #
duke@0 49 ########
duke@0 50 #
duke@0 51 # Assumes basic unix utilities are in the PATH already (uname, hostname, etc.).
duke@0 52 #
ohair@3429 53 # On Windows, assumes PROCESSOR_IDENTIFIER, VS100COMNTOOLS,
duke@0 54 # SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and
duke@0 55 # USERNAME is defined in the environment.
duke@0 56 # This profile does not rely on using vcvars32.bat and 64bit Setup.bat.
duke@0 57 # Uses CYGWIN cygpath to make sure paths are space-free.
duke@0 58 #
duke@0 59 # The JDK Makefiles may change in the future, making some of these
duke@0 60 # settings unnecessary or redundant.
duke@0 61 #
duke@0 62 # This is a working example, but may or may not work on all systems.
duke@0 63 #
duke@0 64 #############################################################################
duke@0 65 #
duke@0 66 # WARNING: This file will clobber the value of some environment variables.
duke@0 67 #
duke@0 68 # Sets up these environment variables for doing JDK builds:
duke@0 69 # USERNAME
duke@0 70 # COMPUTERNAME
duke@0 71 # PATH
duke@0 72 # Windows Only:
duke@0 73 # LIB
duke@0 74 # INCLUDE
duke@0 75 # PS1
duke@0 76 # SHELL
duke@0 77 #
duke@0 78 # Attempts to set these variables for the JDK builds:
duke@0 79 # ALT_COMPILER_PATH
duke@0 80 # ALT_BOOTDIR
duke@0 81 # Windows Only:
duke@0 82 # ALT_UNIXCOMMAND_PATH
duke@0 83 # ALT_DXSDK_PATH
ohair@3429 84 # ALT_MSVCRNN_DLL_PATH
duke@0 85 #
duke@0 86 #############################################################################
duke@0 87 #
duke@0 88 # Keep in mind that at this point, we are running in some kind of shell
duke@0 89 # (sh, ksh, or bash). We don't know if it's solaris, linux, or windows
duke@0 90 # CYGWIN. We need to figure that out.
duke@0 91
duke@0 92 # Find user name
duke@0 93 if [ "${USERNAME}" = "" ] ; then
duke@0 94 USERNAME="${LOGNAME}"
duke@0 95 fi
duke@0 96 if [ "${USERNAME}" = "" ] ; then
duke@0 97 USERNAME="${USER}"
duke@0 98 fi
duke@0 99 export USERNAME
duke@0 100
duke@0 101 # Find machine name
duke@0 102 if [ "${COMPUTERNAME}" = "" ] ; then
duke@0 103 COMPUTERNAME="$(hostname)"
duke@0 104 fi
duke@0 105 export COMPUTERNAME
duke@0 106
duke@0 107 # Boot jdk
duke@0 108 bootjdk=jdk1.6.0
duke@0 109 importjdk=jdk1.7.0
duke@0 110
duke@0 111 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
duke@0 112 osname=$(uname -s)
duke@0 113 if [ "${osname}" = SunOS ] ; then
duke@0 114
duke@0 115 # System place where JDK installed images are stored?
duke@0 116 jdk_instances=/usr/jdk/instances
duke@0 117
ohair@334 118 # Get the Sun Studio compilers (and latest patches for them too)
duke@0 119 if [ "${ALT_COMPILER_PATH}" = "" ] ; then
duke@0 120 ALT_COMPILER_PATH=/opt/SUNWspro/bin
duke@0 121 export ALT_COMPILER_PATH
duke@0 122 fi
duke@0 123 if [ ! -d ${ALT_COMPILER_PATH} ] ; then
duke@0 124 echo "WARNING: Cannot access ALT_COMPILER_PATH=${ALT_COMPILER_PATH}"
duke@0 125 fi
duke@0 126
duke@0 127 # Place compiler path early in PATH to avoid 'cc' conflicts.
duke@0 128 path4sdk=${ALT_COMPILER_PATH}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
duke@0 129
duke@0 130 # Make sure these are unset
duke@0 131 unset JAVA_HOME
duke@0 132 unset LD_LIBRARY_PATH
duke@0 133
duke@0 134 # Build in C locale
duke@0 135 LANG=C
duke@0 136 export LANG
duke@0 137 LC_ALL=C
duke@0 138 export LC_ALL
duke@0 139
duke@0 140 umask 002
duke@0 141
duke@0 142 elif [ "${osname}" = Linux ] ; then
duke@0 143
duke@0 144 # System place where JDK installed images are stored?
duke@0 145 jdk_instances=/opt/java
duke@0 146
duke@0 147 # Use compilers from /usr/bin
duke@0 148 path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
duke@0 149
duke@0 150 # Make sure these are unset
duke@0 151 unset JAVA_HOME
duke@0 152 unset LD_LIBRARY_PATH
duke@0 153
duke@0 154 # Build in C locale
duke@0 155 LANG=C
duke@0 156 export LANG
duke@0 157 LC_ALL=C
duke@0 158 export LC_ALL
duke@0 159
duke@0 160 umask 002
duke@0 161
duke@0 162 else
duke@0 163
duke@0 164 # System place where JDK installed images are stored?
duke@0 165 jdk_instances="C:"
duke@0 166
duke@0 167 # Windows: Differs on CYGWIN and the compiler available.
duke@0 168 # Also, blanks in pathnames gives make headaches, so anything placed
duke@0 169 # in any ALT_* variable should be the short windows DOS names.
duke@0 170
duke@0 171 # Check CYGWIN (should have already been done)
duke@0 172 # Assumption here is that you are in a shell window via cygwin.
ohair@2424 173 proc_arch=`echo "${PROCESSOR_IDENTIFIER}" | expand | cut -d' ' -f1 | sed -e 's@x86@X86@g' -e 's@Intel64@X64@g' -e 's@em64t@X64@g' -e 's@EM64T@X64@g' -e 's@amd64@X64@g' -e 's@AMD64@X64@g' -e 's@ia64@IA64@g'`
ohair@970 174 if [ "${proc_arch}" = "X64" ] ; then
duke@0 175 windows_arch=amd64
duke@0 176 else
duke@0 177 windows_arch=i586
duke@0 178 fi
duke@0 179 # We need to check if we are running a CYGWIN shell
duke@0 180 if [ "$(uname -a | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then
duke@0 181 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
duke@0 182 # Utility to convert to short pathnames without spaces
duke@0 183 cygpath="/usr/bin/cygpath -a -m -s"
duke@0 184 # Most unix utilities are in the /usr/bin
duke@0 185 unixcommand_path="/usr/bin"
duke@0 186 # Make the prompt tell you CYGWIN
duke@0 187 export PS1="CYGWIN:${COMPUTERNAME}:${USERNAME}[\!] "
duke@0 188 else
duke@0 189 echo "ERROR: Cannot find CYGWIN on this machine"
duke@0 190 exit 1
duke@0 191 fi
duke@0 192 if [ "${ALT_UNIXCOMMAND_PATH}" != "" ] ; then
duke@0 193 unixcommand_path=${ALT_UNIXCOMMAND_PATH}
duke@0 194 fi
duke@0 195
duke@0 196 # Default shell
duke@0 197 export SHELL="${unixcommand_path}/sh"
duke@0 198
duke@0 199 # Setup path system (verify this is right)
duke@0 200 if [ "${SystemRoot}" != "" ] ; then
duke@0 201 sys_root=$(${cygpath} "${SystemRoot}")
duke@0 202 elif [ "${SYSTEMROOT}" != "" ] ; then
duke@0 203 sys_root=$(${cygpath} "${SYSTEMROOT}")
duke@0 204 else
duke@0 205 sys_root=$(${cygpath} "C:/WINNT")
duke@0 206 fi
duke@0 207 path4sdk="${unixcommand_path};${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"
duke@0 208 if [ ! -d "${sys_root}" ] ; then
duke@0 209 echo "WARNING: No system root found at: ${sys_root}"
duke@0 210 fi
duke@0 211
duke@0 212 # Compiler setup (nasty part)
duke@0 213 # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
duke@0 214 # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
ohair@3429 215
ohair@3429 216 # Use supplied vsvars.sh
ohair@3429 217 repo=`hg root`
ohair@3429 218 if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then
ohair@3429 219 eval `sh ${repo}/make/scripts/vsvars.sh -v10`
ohair@3429 220 elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then
ohair@3429 221 eval `sh ${repo}/../make/scripts/vsvars.sh -v10`
ohair@3429 222 else
ohair@3429 223 echo "WARNING: No make/scripts/vsvars.sh file found"
duke@0 224 fi
duke@0 225
duke@0 226 fi
duke@0 227
duke@0 228 # Get the previous JDK to be used to bootstrap the build
duke@0 229 if [ "${ALT_BOOTDIR}" = "" ] ; then
duke@0 230 ALT_BOOTDIR=${jdk_instances}/${bootjdk}
duke@0 231 export ALT_BOOTDIR
duke@0 232 fi
duke@0 233 if [ ! -d ${ALT_BOOTDIR} ] ; then
duke@0 234 echo "WARNING: Cannot access ALT_BOOTDIR=${ALT_BOOTDIR}"
duke@0 235 fi
duke@0 236
duke@0 237 # Get the import JDK to be used to get hotspot VM if not built
duke@0 238 if [ "${ALT_JDK_IMPORT_PATH}" = "" -a -d ${jdk_instances}/${importjdk} ] ; then
duke@0 239 ALT_JDK_IMPORT_PATH=${jdk_instances}/${importjdk}
duke@0 240 export ALT_JDK_IMPORT_PATH
duke@0 241 fi
duke@0 242
duke@0 243 # Export PATH setting
duke@0 244 PATH="${path4sdk}"
duke@0 245 export PATH
duke@0 246
gbenson@1772 247 # Export variables required for Zero
gbenson@2659 248 if [ "${SHARK_BUILD}" = true ] ; then
gbenson@2659 249 ZERO_BUILD=true
gbenson@2659 250 export ZERO_BUILD
gbenson@2659 251 fi
gbenson@1772 252 if [ "${ZERO_BUILD}" = true ] ; then
gbenson@1772 253 # ZERO_LIBARCH is the name of the architecture-specific
gbenson@1772 254 # subdirectory under $JAVA_HOME/jre/lib
gbenson@1772 255 arch=$(uname -m)
gbenson@1772 256 case "${arch}" in
gbenson@1772 257 x86_64) ZERO_LIBARCH=amd64 ;;
gbenson@1772 258 i?86) ZERO_LIBARCH=i386 ;;
gbenson@1772 259 sparc64) ZERO_LIBARCH=sparcv9 ;;
gbenson@1772 260 arm*) ZERO_LIBARCH=arm ;;
gbenson@1772 261 *) ZERO_LIBARCH="$(arch)"
gbenson@1772 262 esac
gbenson@1772 263 export ZERO_LIBARCH
gbenson@1772 264
gbenson@1772 265 # ARCH_DATA_MODEL is the number of bits in a pointer
gbenson@1772 266 case "${ZERO_LIBARCH}" in
gbenson@1772 267 i386|ppc|s390|sparc|arm)
gbenson@1772 268 ARCH_DATA_MODEL=32
gbenson@1772 269 ;;
gbenson@1772 270 amd64|ppc64|s390x|sparcv9|ia64|alpha)
gbenson@1772 271 ARCH_DATA_MODEL=64
gbenson@1772 272 ;;
gbenson@1772 273 *)
gbenson@1772 274 echo "ERROR: Unable to determine ARCH_DATA_MODEL for ${ZERO_LIBARCH}"
gbenson@1772 275 exit 1
gbenson@1772 276 esac
gbenson@1772 277 export ARCH_DATA_MODEL
gbenson@1772 278
gbenson@1772 279 # ZERO_ENDIANNESS is the endianness of the processor
gbenson@1772 280 case "${ZERO_LIBARCH}" in
gbenson@1772 281 i386|amd64|ia64)
gbenson@1772 282 ZERO_ENDIANNESS=little
gbenson@1772 283 ;;
gbenson@1772 284 ppc*|s390*|sparc*|alpha)
gbenson@1772 285 ZERO_ENDIANNESS=big
gbenson@1772 286 ;;
gbenson@1772 287 *)
gbenson@1772 288 echo "ERROR: Unable to determine ZERO_ENDIANNESS for ${ZERO_LIBARCH}"
gbenson@1772 289 exit 1
gbenson@1772 290 esac
gbenson@1772 291 export ZERO_ENDIANNESS
gbenson@1772 292
gbenson@1772 293 # ZERO_ARCHDEF is used to enable architecture-specific code
gbenson@1772 294 case "${ZERO_LIBARCH}" in
gbenson@1772 295 i386) ZERO_ARCHDEF=IA32 ;;
gbenson@1772 296 ppc*) ZERO_ARCHDEF=PPC ;;
gbenson@1772 297 s390*) ZERO_ARCHDEF=S390 ;;
gbenson@1772 298 sparc*) ZERO_ARCHDEF=SPARC ;;
gbenson@1772 299 *) ZERO_ARCHDEF=$(echo "${ZERO_LIBARCH}" | tr a-z A-Z)
gbenson@1772 300 esac
gbenson@1772 301 export ZERO_ARCHDEF
gbenson@1772 302
gbenson@1772 303 # ZERO_ARCHFLAG tells the compiler which mode to build for
gbenson@1772 304 case "${ZERO_LIBARCH}" in
gbenson@1772 305 s390)
gbenson@1772 306 ZERO_ARCHFLAG="-m31"
gbenson@1772 307 ;;
gbenson@1772 308 *)
gbenson@1772 309 ZERO_ARCHFLAG="-m${ARCH_DATA_MODEL}"
gbenson@1772 310 esac
gbenson@1772 311 export ZERO_ARCHFLAG
gbenson@1772 312
gbenson@1772 313 # LIBFFI_CFLAGS and LIBFFI_LIBS tell the compiler how to compile and
gbenson@1772 314 # link against libffi
gbenson@1772 315 pkgconfig=$(which pkg-config 2>/dev/null)
gbenson@1772 316 if [ -x "${pkgconfig}" ] ; then
gbenson@1772 317 if [ "${LIBFFI_CFLAGS}" = "" ] ; then
gbenson@1772 318 LIBFFI_CFLAGS=$("${pkgconfig}" --cflags libffi)
gbenson@1772 319 fi
gbenson@1772 320 if [ "${LIBFFI_LIBS}" = "" ] ; then
gbenson@1772 321 LIBFFI_LIBS=$("${pkgconfig}" --libs libffi)
gbenson@1772 322 fi
gbenson@1772 323 fi
gbenson@1772 324 if [ "${LIBFFI_LIBS}" = "" ] ; then
gbenson@1772 325 LIBFFI_LIBS="-lffi"
gbenson@1772 326 fi
gbenson@1772 327 export LIBFFI_CFLAGS
gbenson@1772 328 export LIBFFI_LIBS
gbenson@2659 329
gbenson@2659 330 # LLVM_CFLAGS, LLVM_LDFLAGS and LLVM_LIBS tell the compiler how to
gbenson@2659 331 # compile and link against LLVM
gbenson@2659 332 if [ "${SHARK_BUILD}" = true ] ; then
gbenson@2659 333 if [ "${LLVM_CONFIG}" = "" ] ; then
gbenson@2659 334 LLVM_CONFIG=$(which llvm-config 2>/dev/null)
gbenson@2659 335 fi
gbenson@2659 336 if [ ! -x "${LLVM_CONFIG}" ] ; then
gbenson@2659 337 echo "ERROR: Unable to locate llvm-config"
gbenson@2659 338 exit 1
gbenson@2659 339 fi
gbenson@2659 340 llvm_components="jit engine nativecodegen"
gbenson@2659 341
gbenson@2659 342 unset LLVM_CFLAGS
gbenson@2659 343 for flag in $("${LLVM_CONFIG}" --cxxflags $llvm_components); do
gbenson@2659 344 if echo "${flag}" | grep -q '^-[ID]'; then
gbenson@2659 345 if [ "${flag}" != "-D_DEBUG" ] ; then
gbenson@2659 346 if [ "${LLVM_CFLAGS}" != "" ] ; then
gbenson@2659 347 LLVM_CFLAGS="${LLVM_CFLAGS} "
gbenson@2659 348 fi
gbenson@2659 349 LLVM_CFLAGS="${LLVM_CFLAGS}${flag}"
gbenson@2659 350 fi
gbenson@2659 351 fi
gbenson@2659 352 done
gbenson@2659 353 llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
gbenson@2659 354 LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
gbenson@2659 355
gbenson@2659 356 unset LLVM_LDFLAGS
gbenson@2659 357 for flag in $("${LLVM_CONFIG}" --ldflags $llvm_components); do
gbenson@2659 358 if echo "${flag}" | grep -q '^-L'; then
gbenson@2659 359 if [ "${LLVM_LDFLAGS}" != "" ] ; then
gbenson@2659 360 LLVM_LDFLAGS="${LLVM_LDFLAGS} "
gbenson@2659 361 fi
gbenson@2659 362 LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}"
gbenson@2659 363 fi
gbenson@2659 364 done
gbenson@2659 365
gbenson@2659 366 unset LLVM_LIBS
gbenson@2659 367 for flag in $("${LLVM_CONFIG}" --libs $llvm_components); do
gbenson@2659 368 if echo "${flag}" | grep -q '^-l'; then
gbenson@2659 369 if [ "${LLVM_LIBS}" != "" ] ; then
gbenson@2659 370 LLVM_LIBS="${LLVM_LIBS} "
gbenson@2659 371 fi
gbenson@2659 372 LLVM_LIBS="${LLVM_LIBS}${flag}"
gbenson@2659 373 fi
gbenson@2659 374 done
gbenson@2659 375
gbenson@2659 376 export LLVM_CFLAGS
gbenson@2659 377 export LLVM_LDFLAGS
gbenson@2659 378 export LLVM_LIBS
gbenson@2659 379 fi
gbenson@1772 380 fi
andrew@5351 381
andrew@5351 382 # Export variables for system zlib
andrew@5351 383 # ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and
andrew@5351 384 # link against zlib
andrew@5351 385 pkgconfig=$(which pkg-config 2>/dev/null)
andrew@5351 386 if [ -x "${pkgconfig}" ] ; then
andrew@5351 387 if [ "${ZLIB_CFLAGS}" = "" ] ; then
andrew@5351 388 ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib)
andrew@5351 389 fi
andrew@5351 390 if [ "${ZLIB_LIBS}" = "" ] ; then
andrew@5351 391 ZLIB_LIBS=$("${pkgconfig}" --libs zlib)
andrew@5351 392 fi
andrew@5351 393 fi
andrew@5351 394 if [ "${ZLIB_LIBS}" = "" ] ; then
andrew@5351 395 ZLIB_LIBS="-lz"
andrew@5351 396 fi
andrew@5351 397 export ZLIB_CFLAGS
andrew@5351 398 export ZLIB_LIBS
andrew@5351 399