jprt.config 9.6 KB
Newer Older
D
duke 已提交
1 2
#!echo "This is not a shell script"
#
X
xdono 已提交
3
# Copyright 2006-2008 Sun Microsystems, Inc.  All Rights Reserved.
D
duke 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#  
#

#############################################################################
# Error
error() # message
{
  echo "ERROR: $1"
  exit 6
}
# Directory must exist
dirMustExist() # dir name
{
  if [ ! -d "$1" ] ; then
    error "Directory for $2 does not exist: $1"
  fi
}
# File must exist
fileMustExist() # dir name
{
  if [ ! -f "$1" ] ; then
    error "File for $2 does not exist: $1"
  fi
}
#############################################################################

# Should be set by JPRT as the 3 basic inputs
bootdir="${ALT_BOOTDIR}"
slashjava="${ALT_SLASH_JAVA}"
jdk_import="${ALT_JDK_IMPORT_PATH}"

# Check input
dirMustExist "${bootdir}"    ALT_BOOTDIR
dirMustExist "${slashjava}"  ALT_SLASH_JAVA
dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH

# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
osname=`uname -s`
if [ "${osname}" = SunOS ] ; then
   
    # SOLARIS: Sparc or X86
    osarch=`uname -p`
    if [ "${osarch}" = sparc ] ; then
	solaris_arch=sparc
    else
	solaris_arch=i386
    fi

71 72 73 74 75
    if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then
        compiler_name=${JPRT_SOLARIS_COMPILER_NAME}
    else
        if [ "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6"      -o \
             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6u10"   -o \
76
             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6u14"   -o \
77 78 79 80
             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6perf" ] ; then
            # All jdk6 builds use SS11
            compiler_name=SS11
        else
81
	    compiler_name=SS12
82 83 84 85 86
        fi
    fi
    
    # Get into path (make sure it matches ALT setting)
    compiler_path=${slashjava}/devtools/${solaris_arch}/SUNWspro/${compiler_name}/bin
D
duke 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
    dirMustExist "${compiler_path}" COMPILER_PATH
    path4sdk=${compiler_path}

    # Add basic solaris system paths
    path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin

    # Get the previous JDK to be used to bootstrap the build
    path4sdk=${bootdir}/bin:${path4sdk}

    # Find GNU make
    make=/usr/sfw/bin/gmake
    if [ ! -f ${make} ] ; then
	make=/opt/sfw/bin/gmake
	if [ ! -f ${make} ] ; then
	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
        fi 
    fi
    fileMustExist "${make}" make

    # File creation mask
    umask 002

elif [ "${osname}" = Linux ] ; then
   
    # LINUX: X86, AMD64
    osarch=`uname -m`
    if [ "${osarch}" = i686 ] ; then
	linux_arch=i586
    elif [ "${osarch}" = x86_64 ] ; then
	linux_arch=amd64
    fi

    # Get the compilers into path (make sure it matches ALT setting)
    compiler_path=/usr/bin
    dirMustExist "${compiler_path}" COMPILER_PATH
    path4sdk=${compiler_path}
    
    # Add basic paths
    path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin

    # Get the previous JDK to be used to bootstrap the build
    path4sdk=${bootdir}/bin:${path4sdk}
    
    # Find GNU make
    make=/usr/bin/make
    fileMustExist "${make}" make

    umask 002

else

    # Windows: Differs on CYGWIN vs. MKS, and the compiler available.
    #   Also, blanks in pathnames gives GNU make headaches, so anything placed
    #   in any ALT_* variable should be the short windows dosname.
   
    # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
    #   Assumption here is that you are in a shell window via MKS or cygwin.
    #   MKS install should have defined the environment variable ROOTDIR.
    #   We also need to figure out which one we have: X86, AMD64
    if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
	windows_arch=amd64
    else
	windows_arch=i586
    fi
    
    # We need to determine if we are running a CYGWIN shell or an MKS shell
    #    (if uname isn't available, then it will be unix_toolset=unknown)
    unix_toolset=unknown
    if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
        # We kind of assume ROOTDIR is where MKS is and it's ok
        unix_toolset=MKS
        mkshome=`dosname -s "${ROOTDIR}"`
	# Utility to convert to short pathnames without spaces
	dosname="${mkshome}/mksnt/dosname -s"
        # Most unix utilities are in the mksnt directory of ROOTDIR
        unixcommand_path="${mkshome}/mksnt"
        path4sdk="${unixcommand_path}"
        dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
	devtools_path="${slashjava}/devtools/win32/bin"
	path4sdk="${devtools_path};${path4sdk}"
        dirMustExist "${devtools_path}" DEVTOOLS_PATH
        # Find GNU make
        make="${devtools_path}/gnumake.exe"
        fileMustExist "${make}" make
    elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
        # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
        unix_toolset=CYGWIN
	# Utility to convert to short pathnames without spaces
	dosname="/usr/bin/cygpath -a -m -s"
        # Most unix utilities are in the /usr/bin
        unixcommand_path="/usr/bin"
        path4sdk="${unixcommand_path}"
        dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
        # Find GNU make
        make="${unixcommand_path}/make.exe"
        fileMustExist "${make}" make
    else
      echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
    fi

    # WINDOWS: Compiler setup (nasty part)
    #   NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
    #   NOTE: CYGWIN has a link.exe too, make sure the compilers are first
    if [ "${windows_arch}" = i586 ] ; then
        # 32bit Windows compiler settings
        # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
        vs_root=`${dosname} "${VS71COMNTOOLS}/../.."`
        # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
        vc7_root="${vs_root}/Vc7"
        compiler_path="${vc7_root}/bin"
        platform_sdk="${vc7_root}/PlatformSDK"
        # LIB and INCLUDE must use ; as a separator
        include4sdk="${vc7_root}/atlmfc/include"
        include4sdk="${include4sdk};${vc7_root}/include"
        include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
        include4sdk="${include4sdk};${platform_sdk}/include"
        include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
        lib4sdk="${vc7_root}/atlmfc/lib"
        lib4sdk="${lib4sdk};${vc7_root}/lib"
        lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
        lib4sdk="${lib4sdk};${platform_sdk}/lib"
        lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
        # Search path and DLL locating path
        #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
        path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
	path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
        path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
	path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
        path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
	path4sdk="${compiler_path};${path4sdk}"
    elif [ "${windows_arch}" = amd64 ] ; then
        # AMD64 64bit Windows compiler settings
	if [ "${MSSDK}" != "" ] ; then
	    platform_sdk="${MSSDK}"
	else
	    platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"`
	fi
	compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
        # LIB and INCLUDE must use ; as a separator
        include4sdk="${platform_sdk}/Include"
	include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
	include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
	include4sdk="${include4sdk};${platform_sdk}/Include/atl"
	include4sdk="${include4sdk};${platform_sdk}/Include/crt"
        lib4sdk="${platform_sdk}/Lib/AMD64"
        lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
        # Search path and DLL locating path
        #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
        path4sdk="${platform_sdk}/bin;${path4sdk}"
        path4sdk="${compiler_path};${path4sdk}"
    fi
    # Export LIB and INCLUDE
    unset lib
    unset Lib
    LIB="${lib4sdk}"
    export LIB
    unset include
    unset Include
    INCLUDE="${include4sdk}"
    export INCLUDE
    # Set the ALT variable
    dirMustExist "${compiler_path}" COMPILER_PATH
    
    # WINDOWS: Get the previous JDK to be used to bootstrap the build
    path4sdk="${bootdir}/bin;${path4sdk}"

    # Turn all \\ into /, remove duplicates and trailing /
    slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
    
    # For windows, it's hard to know where the system is, so we just add this
    #    to PATH.
    path4sdk="${slash_path};${PATH}"
    
    # Convert path4sdk to cygwin style
    if [ "${unix_toolset}" = CYGWIN ] ; then
	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
    fi

fi

# Export PATH setting
PATH="${path4sdk}"
export PATH

# Unset certain vars
unset LD_LIBRARY_PATH
unset LD_LIBRARY_PATH_32
unset LD_LIBRARY_PATH_64