Bug 1500504 - Add version checks for the OSX SDK; r=froydnj#firefox-build-system-reviewers
authorMike Shal <mshal@mozilla.com>
Fri, 11 Jan 2019 19:59:23 +0000
changeset 453527 4195353da58d384a69466e622085c14354450347
parent 453526 e920686642fa8461a7c4b72e1c6ed3335b553614
child 453528 92a30f1b817cba3154156a74bee123fc1af7b647
push id35360
push usernbeleuzu@mozilla.com
push dateSat, 12 Jan 2019 09:39:47 +0000
treeherdermozilla-central@cb35977ae7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1500504, 1494022
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1500504 - Add version checks for the OSX SDK; r=froydnj#firefox-build-system-reviewers In bug 1494022 there are problems using an SDK that is too new, which can cause developers to spend many hours debugging an issue that we could've checked up front. This patch gets the version from the SDKSettings.plist file at the root of the SDK directory, and checks it against min and max supported versions. The current min version is 10.11, since that is what we build with in automation. The current max version is 10.13, since 10.14+ currently has an issue with a black screen at startup. Differential Revision: https://phabricator.services.mozilla.com/D16140
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -215,22 +215,42 @@ with only_when(target_is_osx):
     # MacOS SDK
     # =========
 
     option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
            help='Location of platform SDK to use')
 
     @depends_if('--with-macos-sdk')
     @imports(_from='os.path', _import='isdir')
+    @imports(_from='plistlib', _import='readPlist')
     def macos_sdk(value):
+        sdk_min_version = Version('10.11')
+        sdk_max_version = Version('10.13')
+
         if not isdir(value[0]):
             die('SDK not found in %s. When using --with-macos-sdk, you must specify a '
                 'valid SDK. SDKs are installed when the optional cross-development '
                 'tools are selected during the Xcode/Developer Tools installation.'
                 % value[0])
+        obj = readPlist(os.path.join(value[0], 'SDKSettings.plist'))
+        if not obj:
+            die('Error parsing SDKSettings.plist in the SDK directory: %s' % value[0])
+        if 'Version' not in obj:
+            die('Error finding Version information in SDKSettings.plist from the SDK: %s' % value[0])
+        version = Version(obj['Version'])
+        if version < sdk_min_version:
+            die('SDK version "%s" is too old. Please upgrade to at least %s. '
+                'You may need to point to it using --with-macos-sdk=<path> in your '
+                'mozconfig. Various SDK versions are available from '
+                'https://github.com/phracker/MacOSX-SDKs' % (version, sdk_min_version))
+        if version > sdk_max_version:
+            die('SDK version "%s" is unsupported. Please downgrade to version '
+                '%s. You may need to point to it using --with-macos-sdk=<path> in '
+                'your mozconfig. Various SDK versions are available from '
+                'https://github.com/phracker/MacOSX-SDKs' % (version, sdk_max_version))
         return value[0]
 
     set_config('MACOS_SDK_DIR', macos_sdk)
 
     with only_when(cross_compiling):
         option('--with-macos-private-frameworks',
                env="MACOS_PRIVATE_FRAMEWORKS_DIR", nargs=1,
                help='Location of private frameworks to use')