Bug 1723956 - Make --without-sysroot work again. r=firefox-build-system-reviewers,mhentges

Also make it not bootstrap a host sysroot.

Differential Revision: https://phabricator.services.mozilla.com/D121815
This commit is contained in:
Mike Hommey 2021-08-10 20:38:51 +00:00
Родитель 9df33a60f4
Коммит 83fb89d35f
1 изменённых файлов: 15 добавлений и 5 удалений

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

@ -918,20 +918,27 @@ def provided_program(env_var, when=None):
@template
def sysroot_path(host_or_target):
def sysroot_path(host_or_target, target_sysroot=None):
assert target_sysroot or host_or_target is target
bootstrap_target_when = target_is_linux
if host_or_target is host:
host_or_target_str = "host"
opt = "--with-host-sysroot"
env = "HOST_SYSROOT"
when = depends(host)(lambda h: h.kernel == "Linux")
bootstrap_when = when
# Only bootstrap a host sysroot when using a bootstrapped target sysroot
# or when the target doesn't use a bootstrapped sysroot in the first place.
@depends(when, bootstrap_target_when, target_sysroot.bootstrapped)
def bootstrap_when(when, bootstrap_target_when, bootstrapped):
return when and (bootstrapped or not bootstrap_target_when)
else:
assert host_or_target is target
host_or_target_str = "target"
opt = "--with-sysroot"
env = "SYSROOT"
when = target_is_linux_or_wasi
bootstrap_when = target_is_linux
bootstrap_when = bootstrap_target_when
option(
opt,
@ -943,7 +950,10 @@ def sysroot_path(host_or_target):
sysroot_input = depends(opt, when=when)(lambda x: x)
bootstrap_sysroot = depends(bootstrap_when, sysroot_input)(
lambda bootstrap, input: bootstrap and not input
# Only bootstrap when no flag was explicitly given (either --with or --without)
lambda bootstrap, input: bootstrap
and not input
and input.origin == "default"
)
@depends(
@ -983,7 +993,7 @@ def system_lib_option(name, *args, **kwargs):
)
host_sysroot_path = sysroot_path(host).path
host_sysroot_path = sysroot_path(host, target_sysroot_path).path
target_sysroot_path = target_sysroot_path.path