Bug 1549794 - add sysroot flags for the macOS SDK to bindgen's flags; r=nalexander
authorNathan Froyd <froydnj@mozilla.com>
Fri, 10 May 2019 20:07:34 +0000
changeset 532277 2a59e1221617628b0399e2d51d5e3442a63be51b
parent 532276 60707b6f61599879a67f8b83081aa18eae6ae2a9
child 532278 dac8d01ef94e4c5948f73a3f49a15f8125c88c7d
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1549794
milestone68.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 1549794 - add sysroot flags for the macOS SDK to bindgen's flags; r=nalexander We already do this for the compiler that we detect via toolchain.configure...but as the comment in `basic_bindgen_cflags` alludes to, we don't actually use that compiler here. We use a much more bare-bones compiler, so we have to add the necessary flags manually. We need to make `--with-macos-sdk` a `js_option` so that uses of bindgen in the JS engine will receive the proper flags. Differential Revision: https://phabricator.services.mozilla.com/D30239
build/moz.configure/bindgen.configure
build/moz.configure/toolchain.configure
--- a/build/moz.configure/bindgen.configure
+++ b/build/moz.configure/bindgen.configure
@@ -269,18 +269,19 @@ def bindgen_config_paths(llvm_config, li
         clang_path=clang_resolved,
     )
 
 set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path)
 set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path)
 
 
 @depends(target, target_is_unix, cxx_compiler, bindgen_cflags_android,
-         bindgen_config_paths.clang_path)
-def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags, clang_path):
+         bindgen_config_paths.clang_path, macos_sdk)
+def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags,
+                         clang_path, macos_sdk):
     args = [
         '-x', 'c++', '-fno-sized-deallocation',
         '-DTRACING=1', '-DIMPL_LIBXUL', '-DMOZILLA_INTERNAL_API',
         '-DRUST_BINDGEN'
     ]
 
     if is_unix:
         args += ['-DOS_POSIX=1']
@@ -318,16 +319,21 @@ def basic_bindgen_cflags(target, is_unix
     # We want to pass the same base flags as we'd pass clang.
     # check_compiler from toolchain.configure gives us that.
     # XXX: We should actually use the compiler from toolchain.configure.
     # See bug 1526857.
     info = check_compiler([clang_path], 'C++', target)
 
     args += info.flags
 
+    # XXX We wouldn't have to do this if we were using the compiler from
+    # toolchain.configure, rather than just `check_compiler`.
+    if macos_sdk and target.os == 'OSX':
+        args += ['-isysroot', macos_sdk]
+
     return args
 
 
 js_option(env='BINDGEN_CFLAGS',
           nargs=1,
           help='Options bindgen should pass to the C/C++ parser')
 
 
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -121,17 +121,17 @@ with only_when(target_is_osx):
 
 
     set_config('MACOSX_DEPLOYMENT_TARGET', macos_target)
     add_old_configure_assignment('MACOSX_DEPLOYMENT_TARGET', macos_target)
 
     # MacOS SDK
     # =========
 
-    option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1,
+    js_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='biplist', _import='readPlist')
     def macos_sdk(value):
         sdk_min_version = Version('10.11')
         sdk_max_version = Version('10.14')