Bug 1289289 - Move --with-windows-version to python configure. r=chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Jul 2016 17:08:53 +0900
changeset 393073 1b7e700d87ed47503c6fe0c18a9be4d84d8a3724
parent 393072 3b2e3a1f28449edee58c6abe77355eaa1f4620b6
child 526485 f1a6e56ebd6c13f717ee55a0ce0ac0c7efaf662a
push id24204
push userbmo:mh+mozilla@glandium.org
push dateTue, 26 Jul 2016 23:53:38 +0000
reviewerschmanchester
bugs1289289
milestone50.0a1
Bug 1289289 - Move --with-windows-version to python configure. r=chmanchester Also, don't set the MOZ_WINSDK_TARGETVER define anymore, as it's unused.
build/moz.configure/old.configure
build/moz.configure/toolchain.configure
build/moz.configure/windows.configure
js/src/old-configure.in
old-configure.in
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -317,17 +317,16 @@ def old_configure_options(*options):
     '--with-system-nspr',
     '--with-system-nss',
     '--with-system-png',
     '--with-system-zlib',
     '--with-thumb',
     '--with-thumb-interwork',
     '--with-unify-dist',
     '--with-user-appdir',
-    '--with-windows-version',
     '--x-includes',
     '--x-libraries',
 
     # Below are the configure flags used by comm-central.
     '--enable-ldap',
     '--enable-mapi',
     '--enable-calendar',
     '--enable-incomplete-external-linkage',
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -851,9 +851,10 @@ add_old_configure_assignment('MOZ_DEBUG_
 @depends(c_compiler, target)
 def libcxx_inline_visibility(c_compiler, target):
     if c_compiler.type == 'clang' and target.os == 'Android':
         return ''
 
 set_define('_LIBCPP_INLINE_VISIBILITY', libcxx_inline_visibility)
 set_define('_LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49', libcxx_inline_visibility)
 
+include('windows.configure')
 include('rust.configure')
new file mode 100644
--- /dev/null
+++ b/build/moz.configure/windows.configure
@@ -0,0 +1,32 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+option('--with-windows-version', nargs=1, default='603',
+       help='Windows SDK version to target. Win 8.1 (603) is currently'
+            'the minimum supported version.')
+
+@depends(target)
+def is_windows(target):
+    return target.kernel == 'WINNT'
+
+
+@depends_when('--with-windows-version', when=is_windows)
+@imports(_from='__builtin__', _import='ValueError')
+def valid_windows_version(value):
+    if not value:
+        die('Cannot build with --without-windows-version')
+    try:
+        version = int(value[0], 16)
+        if version in (0x603,):
+            return version
+    except ValueError:
+        pass
+
+    die('Invalid value for --with-windows-version (%s)', value[0])
+
+add_old_configure_assignment(
+    'MOZ_WINSDK_TARGETVER',
+    depends(valid_windows_version)(lambda x: '%04x0000' % x if x else None))
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -144,36 +144,18 @@ MOZ_TOOL_VARIABLES
 
 AC_PROG_CPP
 AC_PROG_CXXCPP
 
 dnl Special win32 checks
 dnl ========================================================
 
 # Target the Windows 8.1 SDK by default
-WINSDK_TARGETVER=603
 WINVER=502
 
-MOZ_ARG_WITH_STRING(windows-version,
-[  --with-windows-version=WINSDK_TARGETVER
-                          Windows SDK version to target. Win8.1 (603) is
-                          currently the minimum supported version.],
-  WINSDK_TARGETVER=$withval)
-
-# Currently only version 603 is allowed
-case "$WINSDK_TARGETVER" in
-603)
-    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
-    ;;
-
-*)
-    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
-    ;;
-esac
-
 case "$target" in
 *-mingw*)
     if test "$GCC" != "yes"; then
         # Check to see if we are really running in a msvc environemnt
         _WIN32_MSVC=1
 
         # Make sure compilers are valid
         CFLAGS="$CFLAGS -TC -nologo"
@@ -320,17 +302,16 @@ case "$target" in
     AC_MSG_CHECKING([for Windows SDK being recent enough])
     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
         AC_MSG_RESULT("yes")
     else
         AC_MSG_RESULT("no")
         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
     fi
 
-    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
     ;;
 esac
 
 if test -n "$_WIN32_MSVC"; then
     SKIP_PATH_CHECKS=1
     SKIP_COMPILER_CHECKS=1
     SKIP_LIBRARY_CHECKS=1
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -250,37 +250,18 @@ MOZ_TOOL_VARIABLES
 
 AC_PROG_CPP
 AC_PROG_CXXCPP
 
 dnl ========================================================
 dnl Special win32 checks
 dnl ========================================================
 
-# Target the Windows 8.1 SDK by default
-WINSDK_TARGETVER=603
 WINVER=502
 
-MOZ_ARG_WITH_STRING(windows-version,
-[  --with-windows-version=WINSDK_TARGETVER
-                          Windows SDK version to target. Win8.1 (603) is
-                          currently the minimum supported version.],
-  WINSDK_TARGETVER=$withval)
-
-# Currently only version 603 is allowed
-case "$WINSDK_TARGETVER" in
-603)
-    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
-    ;;
-
-*)
-    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
-    ;;
-esac
-
 case "$target" in
 *-mingw*)
     if test "$GCC" != "yes"; then
         # Check to see if we are really running in a msvc environemnt
         _WIN32_MSVC=1
         AC_CHECK_PROGS(MIDL, midl)
 
         # Make sure compilers are valid
@@ -502,17 +483,16 @@ case "$target" in
     AC_MSG_CHECKING([for Windows SDK being recent enough])
     if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
         AC_MSG_RESULT("yes")
     else
         AC_MSG_RESULT("no")
         AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
     fi
 
-    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
     ;;
 esac
 
 if test -n "$_WIN32_MSVC"; then
     SKIP_PATH_CHECKS=1
     SKIP_COMPILER_CHECKS=1
     SKIP_LIBRARY_CHECKS=1