0N/A#!/bin/sh
0N/A
0N/A#
3909N/A# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
2362N/A# published by the Free Software Foundation. Oracle designates this
0N/A# particular file as subject to the "Classpath" exception as provided
2362N/A# by Oracle in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
0N/A#
0N/A
0N/A
0N/A#############################################################################
0N/A#
0N/A# Generic build profile.sh for all platforms, works in bash, sh, and ksh.
0N/A#
0N/A# Copy this file to your own area, and edit it to suit your needs.
0N/A#
0N/A# Ideally you either won't need to set the ALT_* variables because the
0N/A# build system will find what it needs through system provided paths
0N/A# or environment variables, or you have installed the component in the
0N/A# recommended default path.
0N/A#
0N/A# If you find yourself forced to set an ALT_* environment variable and
0N/A# suspect we could have figured it out automatically, please let us know.
0N/A#
0N/A# Most ALT_* directory defaults are based on being in the parent directory in
0N/A# ALT_SLASH_JAVA, so it's possible to create for example a "C:/jdk6"
0N/A# directory, assign that to ALT_SLASH_JAVA, and place all the components
0N/A# in that directory. This could also minimize the ALT_* environment
0N/A# variables you need to set.
0N/A#
0N/A########
0N/A#
0N/A# Assumes basic unix utilities are in the PATH already (uname, hostname, etc.).
0N/A#
3429N/A# On Windows, assumes PROCESSOR_IDENTIFIER, VS100COMNTOOLS,
0N/A# SYSTEMROOT (or SystemRoot), COMPUTERNAME (or hostname works), and
0N/A# USERNAME is defined in the environment.
0N/A# This profile does not rely on using vcvars32.bat and 64bit Setup.bat.
0N/A# Uses CYGWIN cygpath to make sure paths are space-free.
0N/A#
0N/A# The JDK Makefiles may change in the future, making some of these
0N/A# settings unnecessary or redundant.
0N/A#
0N/A# This is a working example, but may or may not work on all systems.
0N/A#
0N/A#############################################################################
0N/A#
0N/A# WARNING: This file will clobber the value of some environment variables.
0N/A#
0N/A# Sets up these environment variables for doing JDK builds:
0N/A# USERNAME
0N/A# COMPUTERNAME
0N/A# PATH
0N/A# Windows Only:
0N/A# LIB
0N/A# INCLUDE
0N/A# PS1
0N/A# SHELL
0N/A#
0N/A# Attempts to set these variables for the JDK builds:
0N/A# ALT_COMPILER_PATH
0N/A# ALT_BOOTDIR
0N/A# Windows Only:
0N/A# ALT_UNIXCOMMAND_PATH
0N/A# ALT_DXSDK_PATH
3429N/A# ALT_MSVCRNN_DLL_PATH
0N/A#
0N/A#############################################################################
0N/A#
0N/A# Keep in mind that at this point, we are running in some kind of shell
0N/A# (sh, ksh, or bash). We don't know if it's solaris, linux, or windows
0N/A# CYGWIN. We need to figure that out.
0N/A
0N/A# Find user name
0N/Aif [ "${USERNAME}" = "" ] ; then
0N/A USERNAME="${LOGNAME}"
0N/Afi
0N/Aif [ "${USERNAME}" = "" ] ; then
0N/A USERNAME="${USER}"
0N/Afi
0N/Aexport USERNAME
0N/A
0N/A# Find machine name
0N/Aif [ "${COMPUTERNAME}" = "" ] ; then
0N/A COMPUTERNAME="$(hostname)"
0N/Afi
0N/Aexport COMPUTERNAME
0N/A
0N/A# Boot jdk
0N/Abootjdk=jdk1.6.0
0N/Aimportjdk=jdk1.7.0
0N/A
0N/A# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
0N/Aosname=$(uname -s)
0N/Aif [ "${osname}" = SunOS ] ; then
0N/A
0N/A # System place where JDK installed images are stored?
0N/A jdk_instances=/usr/jdk/instances
0N/A
334N/A # Get the Sun Studio compilers (and latest patches for them too)
0N/A if [ "${ALT_COMPILER_PATH}" = "" ] ; then
0N/A ALT_COMPILER_PATH=/opt/SUNWspro/bin
0N/A export ALT_COMPILER_PATH
0N/A fi
0N/A if [ ! -d ${ALT_COMPILER_PATH} ] ; then
0N/A echo "WARNING: Cannot access ALT_COMPILER_PATH=${ALT_COMPILER_PATH}"
0N/A fi
0N/A
0N/A # Place compiler path early in PATH to avoid 'cc' conflicts.
0N/A path4sdk=${ALT_COMPILER_PATH}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
0N/A
0N/A # Make sure these are unset
0N/A unset JAVA_HOME
0N/A unset LD_LIBRARY_PATH
0N/A
0N/A # Build in C locale
0N/A LANG=C
0N/A export LANG
0N/A LC_ALL=C
0N/A export LC_ALL
0N/A
0N/A umask 002
0N/A
0N/Aelif [ "${osname}" = Linux ] ; then
0N/A
0N/A # System place where JDK installed images are stored?
0N/A jdk_instances=/opt/java
0N/A
0N/A # Use compilers from /usr/bin
0N/A path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
0N/A
0N/A # Make sure these are unset
0N/A unset JAVA_HOME
0N/A unset LD_LIBRARY_PATH
0N/A
0N/A # Build in C locale
0N/A LANG=C
0N/A export LANG
0N/A LC_ALL=C
0N/A export LC_ALL
0N/A
0N/A umask 002
0N/A
0N/Aelse
0N/A
0N/A # System place where JDK installed images are stored?
0N/A jdk_instances="C:"
0N/A
0N/A # Windows: Differs on CYGWIN and the compiler available.
0N/A # Also, blanks in pathnames gives make headaches, so anything placed
0N/A # in any ALT_* variable should be the short windows DOS names.
0N/A
0N/A # Check CYGWIN (should have already been done)
0N/A # Assumption here is that you are in a shell window via cygwin.
2424N/A 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'`
970N/A if [ "${proc_arch}" = "X64" ] ; then
0N/A windows_arch=amd64
0N/A else
0N/A windows_arch=i586
0N/A fi
0N/A # We need to check if we are running a CYGWIN shell
0N/A if [ "$(uname -a | fgrep Cygwin)" != "" -a -f /bin/cygpath ] ; then
0N/A # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
0N/A # Utility to convert to short pathnames without spaces
0N/A cygpath="/usr/bin/cygpath -a -m -s"
0N/A # Most unix utilities are in the /usr/bin
0N/A unixcommand_path="/usr/bin"
0N/A # Make the prompt tell you CYGWIN
0N/A export PS1="CYGWIN:${COMPUTERNAME}:${USERNAME}[\!] "
0N/A else
0N/A echo "ERROR: Cannot find CYGWIN on this machine"
0N/A exit 1
0N/A fi
0N/A if [ "${ALT_UNIXCOMMAND_PATH}" != "" ] ; then
0N/A unixcommand_path=${ALT_UNIXCOMMAND_PATH}
0N/A fi
0N/A
0N/A # Default shell
0N/A export SHELL="${unixcommand_path}/sh"
0N/A
0N/A # Setup path system (verify this is right)
0N/A if [ "${SystemRoot}" != "" ] ; then
0N/A sys_root=$(${cygpath} "${SystemRoot}")
0N/A elif [ "${SYSTEMROOT}" != "" ] ; then
0N/A sys_root=$(${cygpath} "${SYSTEMROOT}")
0N/A else
0N/A sys_root=$(${cygpath} "C:/WINNT")
0N/A fi
0N/A path4sdk="${unixcommand_path};${sys_root}/system32;${sys_root};${sys_root}/System32/Wbem"
0N/A if [ ! -d "${sys_root}" ] ; then
0N/A echo "WARNING: No system root found at: ${sys_root}"
0N/A fi
0N/A
0N/A # Compiler setup (nasty part)
0N/A # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
0N/A # NOTE: CYGWIN has a link.exe too, make sure the compilers are first
3429N/A
3429N/A # Use supplied vsvars.sh
3429N/A repo=`hg root`
3429N/A if [ -f "${repo}/make/scripts/vsvars.sh" ] ; then
3429N/A eval `sh ${repo}/make/scripts/vsvars.sh -v10`
3429N/A elif [ -f "${repo}/../make/scripts/vsvars.sh" ] ; then
3429N/A eval `sh ${repo}/../make/scripts/vsvars.sh -v10`
3429N/A else
3429N/A echo "WARNING: No make/scripts/vsvars.sh file found"
0N/A fi
0N/A
0N/Afi
0N/A
0N/A# Get the previous JDK to be used to bootstrap the build
0N/Aif [ "${ALT_BOOTDIR}" = "" ] ; then
0N/A ALT_BOOTDIR=${jdk_instances}/${bootjdk}
0N/A export ALT_BOOTDIR
0N/Afi
0N/Aif [ ! -d ${ALT_BOOTDIR} ] ; then
0N/A echo "WARNING: Cannot access ALT_BOOTDIR=${ALT_BOOTDIR}"
0N/Afi
0N/A
0N/A# Get the import JDK to be used to get hotspot VM if not built
0N/Aif [ "${ALT_JDK_IMPORT_PATH}" = "" -a -d ${jdk_instances}/${importjdk} ] ; then
0N/A ALT_JDK_IMPORT_PATH=${jdk_instances}/${importjdk}
0N/A export ALT_JDK_IMPORT_PATH
0N/Afi
0N/A
0N/A# Export PATH setting
0N/APATH="${path4sdk}"
0N/Aexport PATH
0N/A
1772N/A# Export variables required for Zero
2659N/Aif [ "${SHARK_BUILD}" = true ] ; then
2659N/A ZERO_BUILD=true
2659N/A export ZERO_BUILD
2659N/Afi
1772N/Aif [ "${ZERO_BUILD}" = true ] ; then
1772N/A # ZERO_LIBARCH is the name of the architecture-specific
1772N/A # subdirectory under $JAVA_HOME/jre/lib
1772N/A arch=$(uname -m)
1772N/A case "${arch}" in
1772N/A x86_64) ZERO_LIBARCH=amd64 ;;
1772N/A i?86) ZERO_LIBARCH=i386 ;;
1772N/A sparc64) ZERO_LIBARCH=sparcv9 ;;
1772N/A arm*) ZERO_LIBARCH=arm ;;
1772N/A *) ZERO_LIBARCH="$(arch)"
1772N/A esac
1772N/A export ZERO_LIBARCH
1772N/A
1772N/A # ARCH_DATA_MODEL is the number of bits in a pointer
1772N/A case "${ZERO_LIBARCH}" in
1772N/A i386|ppc|s390|sparc|arm)
1772N/A ARCH_DATA_MODEL=32
1772N/A ;;
1772N/A amd64|ppc64|s390x|sparcv9|ia64|alpha)
1772N/A ARCH_DATA_MODEL=64
1772N/A ;;
1772N/A *)
1772N/A echo "ERROR: Unable to determine ARCH_DATA_MODEL for ${ZERO_LIBARCH}"
1772N/A exit 1
1772N/A esac
1772N/A export ARCH_DATA_MODEL
1772N/A
1772N/A # ZERO_ENDIANNESS is the endianness of the processor
1772N/A case "${ZERO_LIBARCH}" in
1772N/A i386|amd64|ia64)
1772N/A ZERO_ENDIANNESS=little
1772N/A ;;
1772N/A ppc*|s390*|sparc*|alpha)
1772N/A ZERO_ENDIANNESS=big
1772N/A ;;
1772N/A *)
1772N/A echo "ERROR: Unable to determine ZERO_ENDIANNESS for ${ZERO_LIBARCH}"
1772N/A exit 1
1772N/A esac
1772N/A export ZERO_ENDIANNESS
1772N/A
1772N/A # ZERO_ARCHDEF is used to enable architecture-specific code
1772N/A case "${ZERO_LIBARCH}" in
1772N/A i386) ZERO_ARCHDEF=IA32 ;;
1772N/A ppc*) ZERO_ARCHDEF=PPC ;;
1772N/A s390*) ZERO_ARCHDEF=S390 ;;
1772N/A sparc*) ZERO_ARCHDEF=SPARC ;;
1772N/A *) ZERO_ARCHDEF=$(echo "${ZERO_LIBARCH}" | tr a-z A-Z)
1772N/A esac
1772N/A export ZERO_ARCHDEF
1772N/A
1772N/A # ZERO_ARCHFLAG tells the compiler which mode to build for
1772N/A case "${ZERO_LIBARCH}" in
1772N/A s390)
1772N/A ZERO_ARCHFLAG="-m31"
1772N/A ;;
1772N/A *)
1772N/A ZERO_ARCHFLAG="-m${ARCH_DATA_MODEL}"
1772N/A esac
1772N/A export ZERO_ARCHFLAG
1772N/A
1772N/A # LIBFFI_CFLAGS and LIBFFI_LIBS tell the compiler how to compile and
1772N/A # link against libffi
1772N/A pkgconfig=$(which pkg-config 2>/dev/null)
1772N/A if [ -x "${pkgconfig}" ] ; then
1772N/A if [ "${LIBFFI_CFLAGS}" = "" ] ; then
1772N/A LIBFFI_CFLAGS=$("${pkgconfig}" --cflags libffi)
1772N/A fi
1772N/A if [ "${LIBFFI_LIBS}" = "" ] ; then
1772N/A LIBFFI_LIBS=$("${pkgconfig}" --libs libffi)
1772N/A fi
1772N/A fi
1772N/A if [ "${LIBFFI_LIBS}" = "" ] ; then
1772N/A LIBFFI_LIBS="-lffi"
1772N/A fi
1772N/A export LIBFFI_CFLAGS
1772N/A export LIBFFI_LIBS
2659N/A
2659N/A # LLVM_CFLAGS, LLVM_LDFLAGS and LLVM_LIBS tell the compiler how to
2659N/A # compile and link against LLVM
2659N/A if [ "${SHARK_BUILD}" = true ] ; then
2659N/A if [ "${LLVM_CONFIG}" = "" ] ; then
2659N/A LLVM_CONFIG=$(which llvm-config 2>/dev/null)
2659N/A fi
2659N/A if [ ! -x "${LLVM_CONFIG}" ] ; then
2659N/A echo "ERROR: Unable to locate llvm-config"
2659N/A exit 1
2659N/A fi
2659N/A llvm_components="jit engine nativecodegen"
2659N/A
2659N/A unset LLVM_CFLAGS
2659N/A for flag in $("${LLVM_CONFIG}" --cxxflags $llvm_components); do
2659N/A if echo "${flag}" | grep -q '^-[ID]'; then
2659N/A if [ "${flag}" != "-D_DEBUG" ] ; then
2659N/A if [ "${LLVM_CFLAGS}" != "" ] ; then
2659N/A LLVM_CFLAGS="${LLVM_CFLAGS} "
2659N/A fi
2659N/A LLVM_CFLAGS="${LLVM_CFLAGS}${flag}"
2659N/A fi
2659N/A fi
2659N/A done
2659N/A llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
2659N/A LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
2659N/A
2659N/A unset LLVM_LDFLAGS
2659N/A for flag in $("${LLVM_CONFIG}" --ldflags $llvm_components); do
2659N/A if echo "${flag}" | grep -q '^-L'; then
2659N/A if [ "${LLVM_LDFLAGS}" != "" ] ; then
2659N/A LLVM_LDFLAGS="${LLVM_LDFLAGS} "
2659N/A fi
2659N/A LLVM_LDFLAGS="${LLVM_LDFLAGS}${flag}"
2659N/A fi
2659N/A done
2659N/A
2659N/A unset LLVM_LIBS
2659N/A for flag in $("${LLVM_CONFIG}" --libs $llvm_components); do
2659N/A if echo "${flag}" | grep -q '^-l'; then
2659N/A if [ "${LLVM_LIBS}" != "" ] ; then
2659N/A LLVM_LIBS="${LLVM_LIBS} "
2659N/A fi
2659N/A LLVM_LIBS="${LLVM_LIBS}${flag}"
2659N/A fi
2659N/A done
2659N/A
2659N/A export LLVM_CFLAGS
2659N/A export LLVM_LDFLAGS
2659N/A export LLVM_LIBS
2659N/A fi
1772N/Afi
5353N/A
5353N/A# Export variables for system zlib
5353N/A# ZLIB_CFLAGS and ZLIB_LIBS tell the compiler how to compile and
5353N/A# link against zlib
5353N/Apkgconfig=$(which pkg-config 2>/dev/null)
5353N/Aif [ -x "${pkgconfig}" ] ; then
5353N/A if [ "${ZLIB_CFLAGS}" = "" ] ; then
5353N/A ZLIB_CFLAGS=$("${pkgconfig}" --cflags zlib)
5353N/A fi
5353N/A if [ "${ZLIB_LIBS}" = "" ] ; then
5353N/A ZLIB_LIBS=$("${pkgconfig}" --libs zlib)
5353N/A fi
5353N/Afi
5353N/Aif [ "${ZLIB_LIBS}" = "" ] ; then
5353N/A ZLIB_LIBS="-lz"
5353N/Afi
5353N/Aexport ZLIB_CFLAGS
5353N/Aexport ZLIB_LIBS
5353N/A