hotspot/test/jprt.config
changeset 1 489c9b5090e2
child 5547 f4b087cbb361
equal deleted inserted replaced
0:fd16c54261b3 1:489c9b5090e2
       
     1 #!echo "This is not a shell script"
       
     2 #############################################################################
       
     3 # 
       
     4 # Copyright 2006-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.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
       
    23 # have any questions.
       
    24 # 
       
    25 #############################################################################
       
    26 
       
    27 #############################################################################
       
    28 #
       
    29 # JPRT shell configuration for testing.
       
    30 #
       
    31 # Input environment variables:
       
    32 #    Windows Only:
       
    33 #      PATH
       
    34 #      ROOTDIR
       
    35 #
       
    36 # Output variable settings:
       
    37 #    make    Full path to GNU make
       
    38 #
       
    39 # Output environment variables:
       
    40 #    PATH
       
    41 #
       
    42 #############################################################################
       
    43 
       
    44 #############################################################################
       
    45 # Error
       
    46 error() # message
       
    47 {
       
    48   echo "ERROR: $1"
       
    49   exit 6
       
    50 }
       
    51 # Directory must exist
       
    52 dirMustExist() # dir name
       
    53 {
       
    54   if [ ! -d "$1" ] ; then
       
    55     error "Directory for $2 does not exist: $1"
       
    56   fi
       
    57 }
       
    58 # File must exist
       
    59 fileMustExist() # dir name
       
    60 {
       
    61   if [ ! -f "$1" ] ; then
       
    62     error "File for $2 does not exist: $1"
       
    63   fi
       
    64 }
       
    65 #############################################################################
       
    66 
       
    67 # Should be set by JPRT as the 3 basic inputs
       
    68 slashjava="${ALT_SLASH_JAVA}"
       
    69 if [ "${slashjava}" = "" ] ; then
       
    70   slashjava=/java
       
    71 fi
       
    72 
       
    73 # Check input
       
    74 dirMustExist "${slashjava}"  ALT_SLASH_JAVA
       
    75 
       
    76 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
       
    77 osname=`uname -s`
       
    78 if [ "${osname}" = SunOS ] ; then
       
    79    
       
    80     # SOLARIS: Sparc or X86
       
    81     osarch=`uname -p`
       
    82     if [ "${osarch}" = sparc ] ; then
       
    83 	solaris_arch=sparc
       
    84     else
       
    85 	solaris_arch=i386
       
    86     fi
       
    87 
       
    88     # Add basic solaris system paths
       
    89     path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
       
    90 
       
    91     # Find GNU make
       
    92     make=/usr/sfw/bin/gmake
       
    93     if [ ! -f ${make} ] ; then
       
    94 	make=/opt/sfw/bin/gmake
       
    95 	if [ ! -f ${make} ] ; then
       
    96 	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
       
    97         fi 
       
    98     fi
       
    99     fileMustExist "${make}" make
       
   100 
       
   101     # File creation mask
       
   102     umask 002
       
   103 
       
   104 elif [ "${osname}" = Linux ] ; then
       
   105    
       
   106     # Add basic paths
       
   107     path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
       
   108 
       
   109     # Find GNU make
       
   110     make=/usr/bin/make
       
   111     fileMustExist "${make}" make
       
   112 
       
   113     umask 002
       
   114 
       
   115 else
       
   116 
       
   117     # Windows: Differs on CYGWIN vs. MKS.
       
   118    
       
   119     # We need to determine if we are running a CYGWIN shell or an MKS shell
       
   120     #    (if uname isn't available, then it will be unix_toolset=unknown)
       
   121     unix_toolset=unknown
       
   122     if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
       
   123         # We kind of assume ROOTDIR is where MKS is and it's ok
       
   124         unix_toolset=MKS
       
   125         mkshome=`dosname -s "${ROOTDIR}"`
       
   126         # Most unix utilities are in the mksnt directory of ROOTDIR
       
   127         unixcommand_path="${mkshome}/mksnt"
       
   128         path4sdk="${unixcommand_path}"
       
   129 	devtools_path="${slashjava}/devtools/win32/bin"
       
   130 	path4sdk="${devtools_path};${path4sdk}"
       
   131         # Find GNU make
       
   132         make="${devtools_path}/gnumake.exe"
       
   133         fileMustExist "${make}" make
       
   134     elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
       
   135         # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
       
   136         unix_toolset=CYGWIN
       
   137         # Most unix utilities are in the /usr/bin
       
   138         unixcommand_path="/usr/bin"
       
   139         path4sdk="${unixcommand_path}"
       
   140         # Find GNU make
       
   141         make="${unixcommand_path}/make.exe"
       
   142         fileMustExist "${make}" make
       
   143     else
       
   144       echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
       
   145     fi
       
   146 
       
   147     
       
   148     # For windows, it's hard to know where the system is, so we just add this
       
   149     #    to PATH.
       
   150     slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
       
   151     path4sdk="${slash_path};${PATH}"
       
   152     
       
   153     # Convert path4sdk to cygwin style
       
   154     if [ "${unix_toolset}" = CYGWIN ] ; then
       
   155 	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
       
   156     fi
       
   157 
       
   158 fi
       
   159 
       
   160 # Export PATH setting
       
   161 PATH="${path4sdk}"
       
   162 export PATH
       
   163