mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Backed out 4 changesets (bug 1724372, bug 1724374) for causing macos non-unified build bustages in BlockingResourceBase.h.
CLOSED TREE Backed out changeset a8d4d6248454 (bug 1724374) Backed out changeset 030e725b4799 (bug 1724374) Backed out changeset 9c32dfd8b694 (bug 1724374) Backed out changeset d1096773021b (bug 1724372)
This commit is contained in:
parent
c4fd908d12
commit
10c5583558
@ -121,11 +121,11 @@ option(
|
||||
cxx_compiler,
|
||||
clang_search_path,
|
||||
target,
|
||||
target_sysroot.path,
|
||||
target_sysroot_flags,
|
||||
)
|
||||
@checking("for clang for bindgen", lambda x: x.path if x else "not found")
|
||||
def bindgen_clang_compiler(
|
||||
clang_path, c_compiler, cxx_compiler, clang_search_path, target, sysroot_path
|
||||
clang_path, c_compiler, cxx_compiler, clang_search_path, target, sysroot_flags
|
||||
):
|
||||
# When the target compiler is clang, use that, including flags.
|
||||
if cxx_compiler.type == "clang":
|
||||
@ -162,9 +162,7 @@ def bindgen_clang_compiler(
|
||||
# Hack before bug 1617793: if the compiler is clang-cl, hack the target
|
||||
if cxx_compiler.type == "clang-cl":
|
||||
target = split_triplet("%s-pc-windows-msvc" % target.raw_cpu, allow_msvc=True)
|
||||
flags = []
|
||||
if sysroot_path:
|
||||
flags.extend(("--sysroot", sysroot_path))
|
||||
flags = list(sysroot_flags or ())
|
||||
info = check_compiler([clang_path] + flags, "C++", target)
|
||||
return namespace(
|
||||
path=clang_path,
|
||||
|
@ -19,7 +19,7 @@ def pkg_config_version(pkg_config):
|
||||
return Version(check_cmd_output(pkg_config, "--version").rstrip())
|
||||
|
||||
|
||||
@depends(target_sysroot.path, multiarch_dir, when=pkg_config)
|
||||
@depends(target_sysroot_path, multiarch_dir, when=pkg_config)
|
||||
@imports(_from="os", _import="environ")
|
||||
def pkg_config_vars(sysroot_path, multiarch_dir):
|
||||
if sysroot_path:
|
||||
|
@ -918,7 +918,7 @@ def provided_program(env_var, when=None):
|
||||
|
||||
|
||||
@template
|
||||
def sysroot(host_or_target):
|
||||
def sysroot_path(host_or_target):
|
||||
if host_or_target is host:
|
||||
host_or_target_str = "host"
|
||||
opt = "--with-host-sysroot"
|
||||
@ -948,26 +948,22 @@ def sysroot(host_or_target):
|
||||
|
||||
@depends(
|
||||
sysroot_input,
|
||||
host_or_target,
|
||||
macos_sdk,
|
||||
bootstrap_path(
|
||||
depends(host_or_target)(lambda t: "sysroot-{}".format(t.toolchain)),
|
||||
when=bootstrap_sysroot,
|
||||
),
|
||||
)
|
||||
def sysroot(sysroot_input, host_or_target, macos_sdk, path):
|
||||
def sysroot_path(sysroot_input, path):
|
||||
if sysroot_input:
|
||||
path = sysroot_input[0]
|
||||
elif host_or_target.kernel == "Darwin" and macos_sdk:
|
||||
path = macos_sdk
|
||||
if path:
|
||||
log.info("Using %s sysroot in %s", host_or_target_str, path)
|
||||
return namespace(path=path, bootstrapped=bool(path and not sysroot_input))
|
||||
|
||||
return sysroot
|
||||
return sysroot_path
|
||||
|
||||
|
||||
target_sysroot = sysroot(target)
|
||||
target_sysroot_path = sysroot_path(target)
|
||||
|
||||
|
||||
# Use `system_lib_option` instead of `option` for options that enable building
|
||||
@ -977,7 +973,7 @@ target_sysroot = sysroot(target)
|
||||
def system_lib_option(name, *args, **kwargs):
|
||||
option(name, *args, **kwargs)
|
||||
|
||||
@depends(name, target_sysroot.bootstrapped)
|
||||
@depends(name, target_sysroot_path.bootstrapped)
|
||||
def no_system_lib_in_sysroot(value, bootstrapped):
|
||||
if bootstrapped and value:
|
||||
die(
|
||||
@ -987,10 +983,33 @@ def system_lib_option(name, *args, **kwargs):
|
||||
)
|
||||
|
||||
|
||||
host_sysroot = sysroot(host)
|
||||
host_sysroot_path = sysroot_path(host).path
|
||||
target_sysroot_path = target_sysroot_path.path
|
||||
|
||||
|
||||
@depends(target, when=target_sysroot.path)
|
||||
@template
|
||||
def sysroot_flags(host_or_target):
|
||||
sysroot_path = {
|
||||
host: host_sysroot_path,
|
||||
target: target_sysroot_path,
|
||||
}[host_or_target]
|
||||
|
||||
@depends(host_or_target, macos_sdk, sysroot_path)
|
||||
def sysroot_flags(host_or_target, macos_sdk, sysroot_path):
|
||||
if macos_sdk and host_or_target.os == "OSX":
|
||||
return ["-isysroot", macos_sdk]
|
||||
if sysroot_path:
|
||||
return ["--sysroot", sysroot_path]
|
||||
return []
|
||||
|
||||
return sysroot_flags
|
||||
|
||||
|
||||
host_sysroot_flags = sysroot_flags(host)
|
||||
target_sysroot_flags = sysroot_flags(target)
|
||||
|
||||
|
||||
@depends(target, when=target_sysroot_path)
|
||||
def multiarch_dir(target):
|
||||
if target.cpu == "x86":
|
||||
# Turn e.g. i686-linux-gnu into i386-linux-gnu
|
||||
@ -1033,9 +1052,9 @@ def compiler(
|
||||
target: "target",
|
||||
}[host_or_target]
|
||||
|
||||
sysroot = {
|
||||
host: host_sysroot,
|
||||
target: target_sysroot,
|
||||
sysroot_flags = {
|
||||
host: host_sysroot_flags,
|
||||
target: target_sysroot_flags,
|
||||
}[host_or_target]
|
||||
|
||||
var = {
|
||||
@ -1073,19 +1092,23 @@ def compiler(
|
||||
)
|
||||
|
||||
@depends(
|
||||
compiler, provided_compiler, compiler_wrapper, host_or_target, sysroot.path
|
||||
compiler, provided_compiler, compiler_wrapper, host_or_target, sysroot_flags
|
||||
)
|
||||
@checking("whether %s can be used" % what, lambda x: bool(x))
|
||||
@imports(_from="mozbuild.shellutil", _import="quote")
|
||||
def valid_compiler(
|
||||
compiler, provided_compiler, compiler_wrapper, host_or_target, sysroot_path
|
||||
compiler, provided_compiler, compiler_wrapper, host_or_target, sysroot_flags
|
||||
):
|
||||
wrapper = list(compiler_wrapper or ())
|
||||
flags = []
|
||||
if sysroot_path:
|
||||
flags.extend(("--sysroot", sysroot_path))
|
||||
flags = list(sysroot_flags or ())
|
||||
if provided_compiler:
|
||||
wrapper.extend(provided_compiler.wrapper)
|
||||
provided_wrapper = list(provided_compiler.wrapper)
|
||||
# When doing a subconfigure, the compiler is set by old-configure
|
||||
# and it contains the wrappers from --with-compiler-wrapper and
|
||||
# --with-ccache.
|
||||
if provided_wrapper[: len(wrapper)] == wrapper:
|
||||
provided_wrapper = provided_wrapper[len(wrapper) :]
|
||||
wrapper.extend(provided_wrapper)
|
||||
flags.extend(provided_compiler.flags)
|
||||
|
||||
info = check_compiler(wrapper + [compiler] + flags, language, host_or_target)
|
||||
@ -2227,10 +2250,16 @@ def select_linker(
|
||||
set_config("LINKER_KIND", select_linker.KIND)
|
||||
|
||||
|
||||
@depends_if(select_linker, target, target_sysroot.path, multiarch_dir)
|
||||
@depends_if(select_linker, target, macos_sdk, target_sysroot_path, multiarch_dir)
|
||||
@imports("os")
|
||||
def linker_ldflags(linker, target, sysroot_path, multiarch_dir):
|
||||
def linker_ldflags(linker, target, macos_sdk, sysroot_path, multiarch_dir):
|
||||
flags = list((linker and linker.LINKER_FLAG) or [])
|
||||
if target.kernel == "Darwin":
|
||||
if linker and linker.KIND == "ld64":
|
||||
flags.append("-Wl,-syslibroot,%s" % macos_sdk)
|
||||
else:
|
||||
flags.append("-Wl,--sysroot=%s" % macos_sdk)
|
||||
|
||||
# rpath-link is irrelevant to wasm, see for more info https://github.com/emscripten-core/emscripten/issues/11076.
|
||||
if sysroot_path and multiarch_dir and target.os != "WASI":
|
||||
for d in ("lib", "usr/lib"):
|
||||
@ -2745,12 +2774,15 @@ def path_remapping(value):
|
||||
@depends(
|
||||
target,
|
||||
check_build_environment,
|
||||
target_sysroot.path,
|
||||
target_sysroot_path,
|
||||
macos_sdk,
|
||||
windows_sdk_dir,
|
||||
vc_path,
|
||||
when="--enable-path-remapping",
|
||||
)
|
||||
def path_remappings(target, build_env, sysroot_path, windows_sdk_dir, vc_path):
|
||||
def path_remappings(
|
||||
target, build_env, sysroot_path, macos_sdk, windows_sdk_dir, vc_path
|
||||
):
|
||||
win = target.kernel == "WINNT"
|
||||
|
||||
# The prefix maps are processed in the order they're specified on the
|
||||
@ -2769,6 +2801,8 @@ def path_remappings(target, build_env, sysroot_path, windows_sdk_dir, vc_path):
|
||||
# IDEs.
|
||||
if sysroot_path:
|
||||
path_remappings.append((sysroot_path, "k:/" if win else "/sysroot/"))
|
||||
if macos_sdk:
|
||||
path_remappings.append((macos_sdk, "k:/" if win else "/sysroot/"))
|
||||
if windows_sdk_dir:
|
||||
path_remappings.append((windows_sdk_dir, "k:/" if win else "/windows_sdk/"))
|
||||
if vc_path:
|
||||
|
@ -749,7 +749,7 @@ and/or set $JAVA_HOME.
|
||||
compile_environment = depends(when='--enable-compile-environment')(lambda: True)
|
||||
toolchain_prefix = depends(when=True)(lambda: None)
|
||||
multiarch_dir = depends(when=True)(lambda: None)
|
||||
target_sysroot = depends(when=True)(lambda: None)
|
||||
target_sysroot_path = depends(when=True)(lambda: None)
|
||||
include('%(topsrcdir)s/build/moz.configure/util.configure')
|
||||
include('%(topsrcdir)s/build/moz.configure/checks.configure')
|
||||
include('%(topsrcdir)s/build/moz.configure/pkg.configure')
|
||||
|
@ -885,7 +885,7 @@ class OSXToolchainTest(BaseToolchainTest):
|
||||
GCC_7_RESULT = LinuxToolchainTest.GCC_7_RESULT
|
||||
GXX_7_RESULT = LinuxToolchainTest.GXX_7_RESULT
|
||||
SYSROOT_FLAGS = {
|
||||
"flags": PrependFlags(["--sysroot", xcrun("", ("--show-sdk-path",))[1]])
|
||||
"flags": PrependFlags(["-isysroot", xcrun("", ("--show-sdk-path",))[1]])
|
||||
}
|
||||
|
||||
def test_clang(self):
|
||||
|
@ -13,7 +13,10 @@ import six
|
||||
from six import StringIO
|
||||
from textwrap import dedent
|
||||
|
||||
from mozunit import main, MockedOpen
|
||||
from mozunit import (
|
||||
main,
|
||||
MockedOpen,
|
||||
)
|
||||
|
||||
from mozbuild.preprocessor import Preprocessor
|
||||
from mozbuild.util import ReadOnlyNamespace
|
||||
@ -103,7 +106,10 @@ class TestCompilerPreprocessor(unittest.TestCase):
|
||||
|
||||
def test_normalization(self):
|
||||
pp = CompilerPreprocessor(
|
||||
{"__has_attribute(bar)": 1, '__has_warning("-Wc++98-foo")': 1}
|
||||
{
|
||||
"__has_attribute(bar)": 1,
|
||||
'__has_warning("-Wc++98-foo")': 1,
|
||||
}
|
||||
)
|
||||
pp.out = StringIO()
|
||||
input = StringIO(
|
||||
@ -136,7 +142,13 @@ class TestCompilerPreprocessor(unittest.TestCase):
|
||||
self.assertEquals(pp.out.getvalue(), "WFOO\nBAR\nNO_FOO\n")
|
||||
|
||||
def test_condition(self):
|
||||
pp = CompilerPreprocessor({"A": 1, "B": "2", "C": "0L"})
|
||||
pp = CompilerPreprocessor(
|
||||
{
|
||||
"A": 1,
|
||||
"B": "2",
|
||||
"C": "0L",
|
||||
}
|
||||
)
|
||||
pp.out = StringIO()
|
||||
input = StringIO(
|
||||
dedent(
|
||||
@ -217,8 +229,8 @@ class FakeCompiler(dict):
|
||||
if arg is None:
|
||||
break
|
||||
if arg.startswith("-"):
|
||||
# Ignore --sysroot and the argument that follows it.
|
||||
if arg == "--sysroot":
|
||||
# Ignore -isysroot and the argument that follows it.
|
||||
if arg == "-isysroot":
|
||||
next(args, None)
|
||||
else:
|
||||
flags.append(arg)
|
||||
@ -261,17 +273,39 @@ class FakeCompiler(dict):
|
||||
|
||||
class TestFakeCompiler(unittest.TestCase):
|
||||
def test_fake_compiler(self):
|
||||
with MockedOpen({"file": "A B C", "file.c": "A B C"}):
|
||||
compiler = FakeCompiler({"A": "1", "B": "2"})
|
||||
with MockedOpen(
|
||||
{
|
||||
"file": "A B C",
|
||||
"file.c": "A B C",
|
||||
}
|
||||
):
|
||||
compiler = FakeCompiler(
|
||||
{
|
||||
"A": "1",
|
||||
"B": "2",
|
||||
}
|
||||
)
|
||||
self.assertEquals(compiler(None, ["-E", "file"]), (0, "1 2 C", ""))
|
||||
|
||||
compiler = FakeCompiler(
|
||||
{
|
||||
None: {"A": "1", "B": "2"},
|
||||
"-foo": {"C": "foo"},
|
||||
"-bar": {"B": "bar", "C": "bar"},
|
||||
"-qux": {"B": False},
|
||||
"*.c": {"B": "42"},
|
||||
None: {
|
||||
"A": "1",
|
||||
"B": "2",
|
||||
},
|
||||
"-foo": {
|
||||
"C": "foo",
|
||||
},
|
||||
"-bar": {
|
||||
"B": "bar",
|
||||
"C": "bar",
|
||||
},
|
||||
"-qux": {
|
||||
"B": False,
|
||||
},
|
||||
"*.c": {
|
||||
"B": "42",
|
||||
},
|
||||
}
|
||||
)
|
||||
self.assertEquals(compiler(None, ["-E", "file"]), (0, "1 2 C", ""))
|
||||
@ -300,25 +334,111 @@ class TestFakeCompiler(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_multiple_definitions(self):
|
||||
compiler = FakeCompiler({"A": 1, "B": 2}, {"C": 3})
|
||||
|
||||
self.assertEquals(compiler, {None: {"A": 1, "B": 2, "C": 3}})
|
||||
compiler = FakeCompiler({"A": 1, "B": 2}, {"B": 4, "C": 3})
|
||||
|
||||
self.assertEquals(compiler, {None: {"A": 1, "B": 4, "C": 3}})
|
||||
compiler = FakeCompiler(
|
||||
{"A": 1, "B": 2}, {None: {"B": 4, "C": 3}, "-foo": {"D": 5}}
|
||||
)
|
||||
|
||||
self.assertEquals(compiler, {None: {"A": 1, "B": 4, "C": 3}, "-foo": {"D": 5}})
|
||||
|
||||
compiler = FakeCompiler(
|
||||
{None: {"A": 1, "B": 2}, "-foo": {"D": 5}},
|
||||
{"-foo": {"D": 5}, "-bar": {"E": 6}},
|
||||
{
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
},
|
||||
{
|
||||
"C": 3,
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
compiler, {None: {"A": 1, "B": 2}, "-foo": {"D": 5}, "-bar": {"E": 6}}
|
||||
compiler,
|
||||
{
|
||||
None: {
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
"C": 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
compiler = FakeCompiler(
|
||||
{
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
},
|
||||
{
|
||||
"B": 4,
|
||||
"C": 3,
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
compiler,
|
||||
{
|
||||
None: {
|
||||
"A": 1,
|
||||
"B": 4,
|
||||
"C": 3,
|
||||
},
|
||||
},
|
||||
)
|
||||
compiler = FakeCompiler(
|
||||
{
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
},
|
||||
{
|
||||
None: {
|
||||
"B": 4,
|
||||
"C": 3,
|
||||
},
|
||||
"-foo": {
|
||||
"D": 5,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
compiler,
|
||||
{
|
||||
None: {
|
||||
"A": 1,
|
||||
"B": 4,
|
||||
"C": 3,
|
||||
},
|
||||
"-foo": {
|
||||
"D": 5,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
compiler = FakeCompiler(
|
||||
{
|
||||
None: {
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
},
|
||||
"-foo": {
|
||||
"D": 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
"-foo": {
|
||||
"D": 5,
|
||||
},
|
||||
"-bar": {
|
||||
"E": 6,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEquals(
|
||||
compiler,
|
||||
{
|
||||
None: {
|
||||
"A": 1,
|
||||
"B": 2,
|
||||
},
|
||||
"-foo": {
|
||||
"D": 5,
|
||||
},
|
||||
"-bar": {
|
||||
"E": 6,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user