Bug 1265627 - Prettify the MSVC version. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 19 Apr 2016 16:03:07 +0900
changeset 319119 ff37852da65327ad01f01fbbe08a9125e105b05a
parent 319118 c21f5aae0771b331982794474ccfa4799e481961
child 319120 5c27d962527869fb8c72d495677d0f89de3abeb4
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-esr52@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1265627
milestone48.0a1
Bug 1265627 - Prettify the MSVC version. r=ted
build/moz.configure/init.configure
build/moz.configure/toolchain.configure
js/src/old-configure.in
old-configure.in
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -142,17 +142,17 @@ def add_old_configure_assignment(var, va
             return
         if value is True:
             assignments.append('%s=1' % var)
         elif value is False:
             assignments.append('%s=' % var)
         else:
             if isinstance(value, (list, tuple)):
                 value = quote(*value)
-            assignments.append('%s=%s' % (var, quote(value)))
+            assignments.append('%s=%s' % (var, quote(str(value))))
 
 @template
 def add_old_configure_arg(arg):
     @depends(extra_old_configure_args, arg)
     def add_arg(args, arg):
         if arg:
             args.append(arg)
 
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -253,27 +253,40 @@ def get_compiler_info(compiler, language
     data = {}
     for line in result.splitlines():
         if line.startswith('%'):
             k, _, v = line.partition(' ')
             k = k.lstrip('%')
             data[k] = v.replace(' ', '')
             log.debug('%s = %s', k, data[k])
 
-    type = data.get('COMPILER')
-    if not type:
+    try:
+        type = CompilerType(data['COMPILER'])
+    except:
         raise FatalCheckError(
             'Unknown compiler or compiler not supported.')
 
     cplusplus = int(data.get('cplusplus', '0L').rstrip('L'))
     stdc_version = int(data.get('STDC_VERSION', '0L').rstrip('L'))
 
+    version = data.get('VERSION')
+    if version and type in ('msvc', 'clang-cl'):
+        msc_ver = version
+        version = msc_ver[0:2]
+        if len(msc_ver) > 2:
+            version += '.' + msc_ver[2:4]
+        if len(msc_ver) > 4:
+            version += '.' + msc_ver[4:]
+
+    if version:
+        version = Version(version)
+
     return namespace(
-        type=CompilerType(type),
-        version=data.get('VERSION'),
+        type=type,
+        version=version,
         language='C++' if cplusplus else 'C',
         language_version=cplusplus if cplusplus else stdc_version,
     )
 
 
 @imports(_from='mozbuild.shellutil', _import='quote')
 def check_compiler(compiler, language):
     info = get_compiler_info(compiler, language)
@@ -304,17 +317,17 @@ def check_compiler(compiler, language):
     # Note: this is a strict version check because we used to always add
     # -std=gnu++11.
     if info.language == 'C++' and info.language_version != 201103:
         if info.type in ('clang-cl', 'clang', 'gcc'):
             append_flag('-std=gnu++11')
 
     # We force clang-cl to emulate Visual C++ 2013 Update 3 with fallback to
     # cl.exe.
-    if info.type == 'clang-cl' and info.version != '180030723':
+    if info.type == 'clang-cl' and info.version != '18.00.30723':
         # Those flags are direct clang-cl flags that don't need -Xclang, add
         # them directly.
         flags.append('-fms-compatibility-version=18.00.30723')
         flags.append('-fallback')
 
     return info.type, info.version, flags
 
 
@@ -494,30 +507,29 @@ def compiler(language, host_or_target, c
             raise FatalCheckError(
                 'Unknown compiler or compiler not supported.')
 
         # Compiler version checks
         # ===================================================
         # Check the compiler version here instead of in `compiler_version` so
         # that the `checking` message doesn't pretend the compiler can be used
         # to then bail out one line later.
-        if type == 'gcc' and Version(version) < '4.8.0':
+        if type == 'gcc' and version < '4.8.0':
             raise FatalCheckError(
                 'Only GCC 4.8 or newer is supported (found version %s).'
                 % version)
 
         # If you want to bump the version check here search for
         # __cpp_static_assert above, and see the associated comment.
         if type == 'clang' and not version:
             raise FatalCheckError(
                 'Only clang/llvm 3.4 or newer is supported.')
 
         if type == 'msvc':
-            if version < '180030723' or (version > '19' and
-                                         version < '190023506'):
+            if version < '18.00.30723' or ('19' < version < '19.00.23506'):
                 raise FatalCheckError(
                     'This version (%s) of the MSVC compiler is not '
                     'supported.\n'
                     'You must install Visual C++ 2013 Update 3, Visual '
                     'C++ 2015 Update 1, or newer in order to build.\n'
                     'See https://developer.mozilla.org/en/'
                     'Windows_Build_Prerequisites' % version)
 
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -221,17 +221,17 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-4`
+        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
 
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         case "$CC_VERSION" in
         18*)
             _CC_SUITE=12
--- a/old-configure.in
+++ b/old-configure.in
@@ -342,17 +342,17 @@ case "$target" in
             [ unsigned *test = new unsigned(42); ],,
             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
         AC_LANG_RESTORE
 
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
-        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-4`
+        _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
 
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         case "$CC_VERSION" in
         18*)
             _CC_SUITE=12
@@ -1518,17 +1518,17 @@ case "$target" in
         dnl optimization/PGO case. I think it's probably a compiler bug,
         dnl but we work around it here.
         PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
         dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
         dnl Probably also a compiler bug, but what can you do?
         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
         LDFLAGS="$LDFLAGS -DYNAMICBASE"
         RCFLAGS="-nologo"
-        if test "$CC_VERSION" = "180031101"; then
+        if test "$CC_VERSION" = "18.00.31101"; then
             dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
             dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
             LDFLAGS="$LDFLAGS -MaxILKSize:0x7FF00000"
         fi
         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
         dnl both SSSE3 and SSE4.1.
         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
         HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1