Bug 1724522 - Split wasi-sysroot in two separate toolchains. r=firefox-build-system-reviewers,mhentges

The wasi-sysroot toolchain contains both a sysroot for wasi and a
compiler-rt for clang. That makes it impractical to use as a
bootstrapped sysroot for wasm32-wasi builds of Spidermonkey.

We thus split the toolchain in two, one for the compiler-rt and one
for the sysroot. Ideally, the compiler-rt one would avoid building
clang/llvm the same way the sysroot one does, but that leads to
a case of chicken-and-egg, because the compiler-rt is needed to build
the clang toolchain. Eventually, the clang build would be split from
the addition of the compiler-rt, but we're not there yet.

Differential Revision: https://phabricator.services.mozilla.com/D122402
This commit is contained in:
Mike Hommey
2021-08-13 07:07:45 +00:00
parent 93fc8f61fe
commit 859a6854ae
23 changed files with 183 additions and 113 deletions

View File

@@ -993,19 +993,17 @@ if __name__ == "__main__":
)
# Copy the wasm32 builtins to the final_inst_dir if the archive is present.
if "wasi-sysroot" in config:
sysroot = config["wasi-sysroot"].format(**os.environ)
if os.path.isdir(sysroot):
for srcdir in glob.glob(
os.path.join(sysroot, "lib", "clang", "*", "lib", "wasi")
if "wasi-compiler-rt" in config:
compiler_rt = config["wasi-compiler-rt"].format(**os.environ)
if os.path.isdir(compiler_rt):
for libdir in glob.glob(
os.path.join(final_inst_dir, "lib", "clang", "*", "lib")
):
print("Copying from wasi-sysroot srcdir %s" % srcdir)
srcdir = os.path.join(compiler_rt, "lib", "wasi")
print("Copying from wasi-compiler-rt srcdir %s" % srcdir)
# Copy the contents of the "lib/wasi" subdirectory to the
# appropriate location in final_inst_dir.
version = os.path.basename(os.path.dirname(os.path.dirname(srcdir)))
destdir = os.path.join(
final_inst_dir, "lib", "clang", version, "lib", "wasi"
)
destdir = os.path.join(libdir, "wasi")
mkdir_p(destdir)
copy_tree(srcdir, destdir)