duke@1: #!echo "This is not a shell script" duke@1: ############################################################################# duke@1: # xdono@49: # Copyright 2006-2009 Sun Microsystems, Inc. All Rights Reserved. duke@1: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: # duke@1: # This code is free software; you can redistribute it and/or modify it duke@1: # under the terms of the GNU General Public License version 2 only, as duke@1: # published by the Free Software Foundation. Sun designates this duke@1: # particular file as subject to the "Classpath" exception as provided duke@1: # by Sun in the LICENSE file that accompanied this code. duke@1: # duke@1: # This code is distributed in the hope that it will be useful, but WITHOUT duke@1: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: # version 2 for more details (a copy is included in the LICENSE file that duke@1: # accompanied this code). duke@1: # duke@1: # You should have received a copy of the GNU General Public License version duke@1: # 2 along with this work; if not, write to the Free Software Foundation, duke@1: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: # duke@1: # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@1: # CA 95054 USA or visit www.sun.com if you need additional information or duke@1: # have any questions. duke@1: # duke@1: ############################################################################# duke@1: # duke@1: # JPRT shell configuration for building. duke@1: # duke@1: # Input environment variables: duke@1: # ALT_BOOTDIR duke@1: # ALT_SLASH_JAVA duke@1: # ALT_JDK_IMPORT_PATH duke@1: # Windows Only: duke@1: # PATH duke@1: # VS71COMNTOOLS duke@1: # PROCESSOR_IDENTIFIER duke@1: # ROOTDIR duke@1: # duke@1: # Output variable settings: duke@1: # make Full path to GNU make duke@1: # compiler_path Path to compiler bin directory duke@1: # compiler_name Unique name of this compiler duke@1: # duke@1: # Output environment variables: duke@1: # PATH duke@1: # ALT_COMPILER_PATH duke@1: # Windows Only: duke@1: # ALT_MSDEVTOOLS_PATH duke@1: # ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default) duke@1: # LIB duke@1: # INCLUDE duke@1: # duke@1: # After JDK6, most settings will be found via ALT_SLASH_JAVA or duke@1: # by way of other system environment variables. If this was JDK5 duke@1: # or an older JDK, you might need to export more ALT_* variables. duke@1: # duke@1: # On Windows AMD64, if MSSDK is not set, assumes Platform SDK is installed at: duke@1: # C:/Program Files/Microsoft Platform SDK duke@1: # duke@1: ############################################################################# duke@1: duke@1: ############################################################################# duke@1: # Error duke@1: error() # message duke@1: { duke@1: echo "ERROR: $1" duke@1: exit 6 duke@1: } duke@1: # Directory must exist duke@1: dirMustExist() # dir name duke@1: { duke@1: if [ ! -d "$1" ] ; then duke@1: error "Directory for $2 does not exist: $1" duke@1: fi duke@1: } duke@1: # File must exist duke@1: fileMustExist() # dir name duke@1: { duke@1: if [ ! -f "$1" ] ; then duke@1: error "File for $2 does not exist: $1" duke@1: fi duke@1: } duke@1: ############################################################################# duke@1: duke@1: # Should be set by JPRT as the 3 basic inputs duke@1: bootdir="${ALT_BOOTDIR}" duke@1: slashjava="${ALT_SLASH_JAVA}" duke@1: jdk_import="${ALT_JDK_IMPORT_PATH}" duke@1: duke@1: # The /java/devtools items duke@1: jdk_devtools="${slashjava}/devtools" duke@1: share="${jdk_devtools}/share" duke@1: duke@1: # The 3 bin directories in common to all platforms duke@1: sharebin="${share}/bin" duke@1: duke@1: # Check input duke@1: dirMustExist "${bootdir}" ALT_BOOTDIR duke@1: dirMustExist "${slashjava}" ALT_SLASH_JAVA duke@1: dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH duke@1: duke@1: # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. duke@1: osname=`uname -s` duke@1: if [ "${osname}" = SunOS ] ; then duke@1: duke@1: # SOLARIS: Sparc or X86 duke@1: osarch=`uname -p` duke@1: if [ "${osarch}" = sparc ] ; then duke@1: solaris_arch=sparc duke@1: else duke@1: solaris_arch=i386 duke@1: fi duke@1: ohair@10: # Get the compilers into path (make sure it matches ALT setting) ohair@10: if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then ohair@10: compiler_name=${JPRT_SOLARIS_COMPILER_NAME} ohair@10: else ohair@20: compiler_name=SS12 ohair@10: fi ohair@10: compiler_path=${jdk_devtools}/${solaris_arch}/SUNWspro/${compiler_name}/bin duke@1: ALT_COMPILER_PATH="${compiler_path}" duke@1: export ALT_COMPILER_PATH duke@1: dirMustExist "${compiler_path}" ALT_COMPILER_PATH ohair@27: path4sdk=${compiler_path}:${sharebin} duke@1: duke@1: # Add basic solaris system paths duke@1: path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin duke@1: duke@1: # Get the previous JDK to be used to bootstrap the build duke@1: path4sdk=${bootdir}/bin:${path4sdk} duke@1: duke@1: # Find GNU make duke@1: make=/usr/sfw/bin/gmake duke@1: if [ ! -f ${make} ] ; then duke@1: make=/opt/sfw/bin/gmake duke@1: if [ ! -f ${make} ] ; then duke@1: make=${jdk_devtools}/${solaris_arch}/bin/gnumake duke@1: fi duke@1: fi duke@1: fileMustExist "${make}" make duke@1: duke@1: # File creation mask duke@1: umask 002 duke@1: duke@1: elif [ "${osname}" = Linux ] ; then duke@1: duke@1: # LINUX: X86, AMD64 duke@1: osarch=`uname -m` duke@1: if [ "${osarch}" = i686 ] ; then duke@1: linux_arch=i586 duke@1: elif [ "${osarch}" = x86_64 ] ; then duke@1: linux_arch=amd64 duke@1: fi duke@1: duke@1: # Get the compilers into path (make sure it matches ALT setting) duke@1: compiler_path=/usr/bin duke@1: compiler_name=usr_bin duke@1: ALT_COMPILER_PATH="${compiler_path}" duke@1: export ALT_COMPILER_PATH duke@1: dirMustExist "${compiler_path}" ALT_COMPILER_PATH ohair@27: path4sdk=${compiler_path}:${sharebin} duke@1: duke@1: # Add basic paths duke@1: path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin duke@1: duke@1: # Get the previous JDK to be used to bootstrap the build duke@1: path4sdk=${bootdir}/bin:${path4sdk} duke@1: duke@1: # Find GNU make duke@1: make=/usr/bin/make duke@1: fileMustExist "${make}" make duke@1: duke@1: umask 002 duke@1: duke@1: else duke@1: duke@1: # Windows: Differs on CYGWIN vs. MKS, and the compiler available. duke@1: # Also, blanks in pathnames gives GNU make headaches, so anything placed duke@1: # in any ALT_* variable should be the short windows dosname. duke@1: duke@1: # WINDOWS: Install and use MKS or CYGWIN (should have already been done) duke@1: # Assumption here is that you are in a shell window via MKS or cygwin. duke@1: # MKS install should have defined the environment variable ROOTDIR. duke@1: # We also need to figure out which one we have: X86, AMD64 duke@1: if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then duke@1: windows_arch=amd64 duke@1: else duke@1: windows_arch=i586 duke@1: fi duke@1: duke@1: # We need to determine if we are running a CYGWIN shell or an MKS shell duke@1: # (if uname isn't available, then it will be unix_toolset=unknown) duke@1: unix_toolset=unknown duke@1: if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then duke@1: # We kind of assume ROOTDIR is where MKS is and it's ok duke@1: unix_toolset=MKS duke@1: mkshome=`dosname -s "${ROOTDIR}"` duke@1: # Utility to convert to short pathnames without spaces duke@1: dosname="${mkshome}/mksnt/dosname -s" duke@1: # Most unix utilities are in the mksnt directory of ROOTDIR duke@1: unixcommand_path="${mkshome}/mksnt" ohair@27: path4sdk="${sharebin};${unixcommand_path}" duke@1: dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH duke@1: devtools_path="${jdk_devtools}/win32/bin" duke@1: path4sdk="${devtools_path};${path4sdk}" duke@1: # Normally this need not be set, but on Windows it's default is C:/UTILS duke@1: ALT_DEVTOOLS_PATH="${devtools_path}" duke@1: export ALT_DEVTOOLS_PATH duke@1: dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH duke@1: # Find GNU make duke@1: make="${devtools_path}/gnumake.exe" duke@1: fileMustExist "${make}" make duke@1: elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then duke@1: # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist duke@1: unix_toolset=CYGWIN duke@1: # Utility to convert to short pathnames without spaces duke@1: dosname="/usr/bin/cygpath -a -m -s" duke@1: # Most unix utilities are in the /usr/bin duke@1: unixcommand_path="/usr/bin" ohair@27: path4sdk="${sharebin};${unixcommand_path}" duke@1: dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH duke@1: # Find GNU make duke@1: make="${unixcommand_path}/make.exe" duke@1: fileMustExist "${make}" make duke@1: else duke@1: echo "WARNING: Cannot figure out if this is MKS or CYGWIN" duke@1: fi duke@1: duke@1: # WINDOWS: Compiler setup (nasty part) duke@1: # NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE. duke@1: # NOTE: CYGWIN has a link.exe too, make sure the compilers are first duke@1: if [ "${windows_arch}" = i586 ] ; then duke@1: # 32bit Windows compiler settings duke@1: # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined) duke@1: vs_root=`${dosname} "${VS71COMNTOOLS}/../.."` duke@1: # Fill in PATH, LIB, and INCLUDE (unset all others to make sure) duke@1: msdev_root="${vs_root}/Common7/Tools" duke@1: msdevtools_path="${msdev_root}/bin" duke@1: vc7_root="${vs_root}/Vc7" duke@1: compiler_path="${vc7_root}/bin" duke@1: compiler_name=VS2003 duke@1: platform_sdk="${vc7_root}/PlatformSDK" duke@1: # LIB and INCLUDE must use ; as a separator duke@1: include4sdk="${vc7_root}/atlmfc/include" duke@1: include4sdk="${include4sdk};${vc7_root}/include" duke@1: include4sdk="${include4sdk};${platform_sdk}/include/prerelease" duke@1: include4sdk="${include4sdk};${platform_sdk}/include" duke@1: include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include" duke@1: lib4sdk="${vc7_root}/atlmfc/lib" duke@1: lib4sdk="${lib4sdk};${vc7_root}/lib" duke@1: lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease" duke@1: lib4sdk="${lib4sdk};${platform_sdk}/lib" duke@1: lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib" duke@1: # Search path and DLL locating path duke@1: # WARNING: CYGWIN has a link.exe too, make sure compilers are first duke@1: path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}" duke@1: path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}" duke@1: path4sdk="${vs_root}/Common7/Tools;${path4sdk}" duke@1: path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}" duke@1: path4sdk="${vs_root}/Common7/IDE;${path4sdk}" duke@1: path4sdk="${compiler_path};${path4sdk}" duke@1: elif [ "${windows_arch}" = amd64 ] ; then duke@1: # AMD64 64bit Windows compiler settings duke@1: if [ "${MSSDK}" != "" ] ; then duke@1: platform_sdk="${MSSDK}" duke@1: else duke@1: platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"` duke@1: fi duke@1: compiler_path="${platform_sdk}/Bin/win64/x86/AMD64" duke@1: compiler_name=VS2005_PSDK duke@1: msdevtools_path="${platform_sdk}/Bin" duke@1: # LIB and INCLUDE must use ; as a separator duke@1: include4sdk="${platform_sdk}/Include" duke@1: include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys" duke@1: include4sdk="${include4sdk};${platform_sdk}/Include/mfc" duke@1: include4sdk="${include4sdk};${platform_sdk}/Include/atl" duke@1: include4sdk="${include4sdk};${platform_sdk}/Include/crt" duke@1: lib4sdk="${platform_sdk}/Lib/AMD64" duke@1: lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc" duke@1: # Search path and DLL locating path duke@1: # WARNING: CYGWIN has a link.exe too, make sure compilers are first duke@1: path4sdk="${platform_sdk}/bin;${path4sdk}" duke@1: path4sdk="${compiler_path};${path4sdk}" duke@1: fi duke@1: # Export LIB and INCLUDE duke@1: unset lib duke@1: unset Lib duke@1: LIB="${lib4sdk}" duke@1: export LIB duke@1: unset include duke@1: unset Include duke@1: INCLUDE="${include4sdk}" duke@1: export INCLUDE duke@1: # Set the ALT variable duke@1: ALT_COMPILER_PATH=`${dosname} "${compiler_path}"` duke@1: export ALT_COMPILER_PATH duke@1: dirMustExist "${compiler_path}" ALT_COMPILER_PATH duke@1: ALT_MSDEVTOOLS_PATH=`${dosname} "${msdevtools_path}"` duke@1: export ALT_MSDEVTOOLS_PATH duke@1: dirMustExist "${msdevtools_path}" ALT_MSDEVTOOLS_PATH duke@1: duke@1: # WINDOWS: Get the previous JDK to be used to bootstrap the build duke@1: path4sdk="${bootdir}/bin;${path4sdk}" duke@1: duke@1: # Turn all \\ into /, remove duplicates and trailing / duke@1: slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`" duke@1: duke@1: # For windows, it's hard to know where the system is, so we just add this duke@1: # to PATH. duke@1: path4sdk="${slash_path};${PATH}" duke@1: duke@1: # Convert path4sdk to cygwin style duke@1: if [ "${unix_toolset}" = CYGWIN ] ; then duke@1: path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" duke@1: fi duke@1: duke@1: fi duke@1: duke@1: # Export PATH setting duke@1: PATH="${path4sdk}" duke@1: export PATH duke@1: duke@1: # Things we need to unset duke@1: unset LD_LIBRARY_PATH duke@1: unset LD_LIBRARY_PATH_32 duke@1: unset LD_LIBRARY_PATH_64 duke@1: unset JAVA_HOME duke@1: