comparison make/windows/get_msc_ver.sh @ 1322:21141e23627a

6923488: 4/4 need minor tweaks to HotSpot build for Cygwin Summary: Clean up get_msc_ver, build.bat and build.make in general and for Cygwin. Reviewed-by: ohair
author dcubed
date Tue, 16 Mar 2010 17:47:03 -0600
parents bd02caa94611
children 39e409a664b3
comparison
equal deleted inserted replaced
914:50a95aa4a247 1322:21141e23627a
20 # CA 95054 USA or visit www.sun.com if you need additional information or 20 # CA 95054 USA or visit www.sun.com if you need additional information or
21 # have any questions. 21 # have any questions.
22 # 22 #
23 # 23 #
24 24
25 set -e
26
25 # This shell script echoes "MSC_VER=<munged version of cl>" 27 # This shell script echoes "MSC_VER=<munged version of cl>"
26 # It ignores the micro version component. 28 # It ignores the micro version component.
27 # Examples: 29 # Examples:
28 # cl version 12.00.8804 returns "MSC_VER=1200" 30 # cl version 12.00.8804 returns "MSC_VER=1200"
29 # cl version 13.10.3077 returns "MSC_VER=1310" 31 # cl version 13.10.3077 returns "MSC_VER=1310"
36 # reason this environment variable is necessary is that it seems that 38 # reason this environment variable is necessary is that it seems that
37 # Windows truncates very long PATHs when executing shells like MKS's 39 # Windows truncates very long PATHs when executing shells like MKS's
38 # sh, and it has been found that sometimes `which sh` fails. 40 # sh, and it has been found that sometimes `which sh` fails.
39 41
40 if [ "x$HotSpotMksHome" != "x" ]; then 42 if [ "x$HotSpotMksHome" != "x" ]; then
41 MKS_HOME="$HotSpotMksHome" 43 TOOL_DIR="$HotSpotMksHome"
42 else 44 else
43 SH=`which sh` 45 # HotSpotMksHome is not set so use the directory that contains "sh".
44 MKS_HOME=`dirname "$SH"` 46 # This works with both MKS and Cygwin.
47 SH=`which sh`
48 TOOL_DIR=`dirname "$SH"`
45 fi 49 fi
46 50
47 HEAD="$MKS_HOME/head" 51 HEAD="$TOOL_DIR/head"
48 ECHO="$MKS_HOME/echo" 52 ECHO="$TOOL_DIR/echo"
49 EXPR="$MKS_HOME/expr" 53 EXPR="$TOOL_DIR/expr"
50 CUT="$MKS_HOME/cut" 54 CUT="$TOOL_DIR/cut"
51 SED="$MKS_HOME/sed" 55 SED="$TOOL_DIR/sed"
52 56
53 if [ "x$FORCE_MSC_VER" != "x" ]; then 57 if [ "x$FORCE_MSC_VER" != "x" ]; then
54 echo "MSC_VER=$FORCE_MSC_VER" 58 echo "MSC_VER=$FORCE_MSC_VER"
55 else 59 else
56 MSC_VER_RAW=`cl 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'` 60 MSC_VER_RAW=`cl 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'`
68 fi 72 fi
69 73
70 if [ "x$FORCE_LINK_VER" != "x" ]; then 74 if [ "x$FORCE_LINK_VER" != "x" ]; then
71 echo "LINK_VER=$FORCE_LINK_VER" 75 echo "LINK_VER=$FORCE_LINK_VER"
72 else 76 else
73 LINK_VER_RAW=`link 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'` 77 # use the "link" command that is co-located with the "cl" command
78 cl_cmd=`which cl`
79 cl_dir=`dirname $cl_cmd`
80 LINK_VER_RAW=`$cl_dir/link 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'`
74 LINK_VER_MAJOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f1` 81 LINK_VER_MAJOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f1`
75 LINK_VER_MINOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f2` 82 LINK_VER_MINOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f2`
76 LINK_VER_MICRO=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f3` 83 LINK_VER_MICRO=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f3`
77 LINK_VER=`"$EXPR" $LINK_VER_MAJOR \* 100 + $LINK_VER_MINOR` 84 LINK_VER=`"$EXPR" $LINK_VER_MAJOR \* 100 + $LINK_VER_MINOR`
78 echo "LINK_VER=$LINK_VER" 85 echo "LINK_VER=$LINK_VER"