Bug 1724606 - Replace uses of MACOSX_DEPLOYMENT_TARGET env variable with -mmacosx-version-min flag. r=firefox-build-system-reviewers,andi

They are equivalent, except for the fact that MACOSX_DEPLOYMENT_TARGET
may apply to more processes in a normal build. In practice, all the
processes that matter are covered through compiler flags.

On the opposite end, MACOSX_DEPLOYMENT_TARGET isn't necessary passed in
all cases (like clangd, mach static-analysis, etc.), while compiler
flags are.

Differential Revision: https://phabricator.services.mozilla.com/D122145
This commit is contained in:
Mike Hommey 2021-08-11 07:40:57 +00:00
Родитель 49f523cc07
Коммит d873082139
4 изменённых файлов: 28 добавлений и 25 удалений

Просмотреть файл

@ -12,8 +12,3 @@ HOST_LDFLAGS += -brepro
else
HOST_LDFLAGS += -shared
endif
# Use the default OS X deployment target to enable using the libc++ headers
# correctly. Note that the binary produced here is a host tool and doesn't need
# to be distributed.
MACOSX_DEPLOYMENT_TARGET :=

Просмотреть файл

@ -56,16 +56,9 @@ with only_when(target_is_osx):
help="Set the minimum MacOS version needed at runtime{|}",
)
@depends("--enable-macos-target")
@imports(_from="os", _import="environ")
@depends_if("--enable-macos-target")
def macos_target(value):
if value:
# Ensure every compiler process we spawn uses this value.
environ["MACOSX_DEPLOYMENT_TARGET"] = value[0]
return value[0]
set_config("MACOSX_DEPLOYMENT_TARGET", macos_target)
add_old_configure_assignment("MACOSX_DEPLOYMENT_TARGET", macos_target)
return value[0]
@depends(host)
@ -1102,15 +1095,27 @@ def compiler(
)
@depends(
compiler, provided_compiler, compiler_wrapper, host_or_target, sysroot_flags
compiler,
provided_compiler,
compiler_wrapper,
host_or_target,
sysroot_flags,
macos_target,
)
@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_flags
compiler,
provided_compiler,
compiler_wrapper,
host_or_target,
sysroot_flags,
macos_target,
):
wrapper = list(compiler_wrapper or ())
flags = list(sysroot_flags or ())
if host_or_target.os == "OSX" and macos_target:
flags.append("-mmacosx-version-min=%s" % macos_target)
if provided_compiler:
wrapper.extend(provided_compiler.wrapper)
flags.extend(provided_compiler.flags)

Просмотреть файл

@ -249,10 +249,6 @@ endif
DEPENDENCIES = .md
ifdef MACOSX_DEPLOYMENT_TARGET
export MACOSX_DEPLOYMENT_TARGET
endif # MACOSX_DEPLOYMENT_TARGET
# Export to propagate to cl and submake for third-party code.
# Eventually, we'll want to just use -I.
ifdef INCLUDE

Просмотреть файл

@ -885,7 +885,13 @@ class OSXToolchainTest(BaseToolchainTest):
GCC_7_RESULT = LinuxToolchainTest.GCC_7_RESULT
GXX_7_RESULT = LinuxToolchainTest.GXX_7_RESULT
SYSROOT_FLAGS = {
"flags": PrependFlags(["-isysroot", xcrun("", ("--show-sdk-path",))[1]])
"flags": PrependFlags(
[
"-isysroot",
xcrun("", ("--show-sdk-path",))[1],
"-mmacosx-version-min=10.12",
]
)
}
def test_clang(self):
@ -1755,10 +1761,11 @@ class RustTest(BaseConfigureTest):
)
# Same for the arm_target checks.
dep = sandbox._depends[sandbox["arm_target"]]
getattr(sandbox, "__value_for_depends")[
(dep,)
] = arm_target or ReadOnlyNamespace(
arm_arch=7, thumb2=False, fpu="vfpv2", float_abi="softfp"
getattr(sandbox, "__value_for_depends")[(dep,)] = (
arm_target
or ReadOnlyNamespace(
arm_arch=7, thumb2=False, fpu="vfpv2", float_abi="softfp"
)
)
return sandbox._value_for(sandbox["rust_target_triple"])