Backed out changeset a275000100a4 (bug 1704766) for causing build bustages CLOSED TREE
This commit is contained in:
@@ -21,6 +21,7 @@ import sys
|
||||
import tarfile
|
||||
from contextlib import contextmanager
|
||||
from distutils.dir_util import copy_tree
|
||||
from distutils.file_util import copy_file
|
||||
|
||||
from shutil import which
|
||||
|
||||
@@ -166,6 +167,37 @@ def delete(path):
|
||||
pass
|
||||
|
||||
|
||||
def install_libgcc(gcc_dir, clang_dir, is_final_stage):
|
||||
gcc_bin_dir = os.path.join(gcc_dir, "bin")
|
||||
|
||||
out = subprocess.check_output(
|
||||
[os.path.join(gcc_bin_dir, "gcc"), "-print-libgcc-file-name"]
|
||||
)
|
||||
|
||||
libgcc_dir = os.path.dirname(out.decode().rstrip())
|
||||
clang_lib_dir = os.path.join(
|
||||
clang_dir,
|
||||
"lib",
|
||||
"gcc",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
os.path.basename(libgcc_dir),
|
||||
)
|
||||
mkdir_p(clang_lib_dir)
|
||||
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
|
||||
libgcc_dir = os.path.join(gcc_dir, "lib64")
|
||||
# This is necessary as long as CI runs on debian8 docker images.
|
||||
copy_file(
|
||||
os.path.join(libgcc_dir, "libstdc++.so.6"), os.path.join(clang_dir, "lib")
|
||||
)
|
||||
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
|
||||
libgcc_dir = os.path.join(gcc_dir, "lib32")
|
||||
clang_lib_dir = os.path.join(clang_lib_dir, "32")
|
||||
copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True)
|
||||
include_dir = os.path.join(gcc_dir, "include")
|
||||
clang_include_dir = os.path.join(clang_dir, "include")
|
||||
copy_tree(include_dir, clang_include_dir, preserve_symlinks=True)
|
||||
|
||||
|
||||
def install_import_library(build_dir, clang_dir):
|
||||
shutil.copy2(
|
||||
os.path.join(build_dir, "lib", "clang.lib"), os.path.join(clang_dir, "lib")
|
||||
@@ -216,6 +248,7 @@ def build_one_stage(
|
||||
build_type,
|
||||
assertions,
|
||||
python_path,
|
||||
gcc_dir,
|
||||
libcxx_include_dir,
|
||||
build_wasm,
|
||||
compiler_rt_source_dir=None,
|
||||
@@ -281,10 +314,6 @@ def build_one_stage(
|
||||
sysroot = os.path.join(os.environ.get("MOZ_FETCHES_DIR", ""), "sysroot")
|
||||
if os.path.exists(sysroot):
|
||||
cmake_args += ["-DCMAKE_SYSROOT=%s" % sysroot]
|
||||
# Work around the LLVM build system not building the i386 compiler-rt
|
||||
# because it doesn't allow to use a sysroot for that during the cmake
|
||||
# checks.
|
||||
cmake_args += ["-DCAN_TARGET_i386=1"]
|
||||
if is_windows():
|
||||
cmake_args.insert(-1, "-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
|
||||
cmake_args.insert(-1, "-DLLVM_USE_CRT_RELEASE=MT")
|
||||
@@ -410,6 +439,8 @@ def build_one_stage(
|
||||
cmake_args += [src_dir]
|
||||
build_package(build_dir, cmake_args)
|
||||
|
||||
if is_linux():
|
||||
install_libgcc(gcc_dir, inst_dir, is_final_stage)
|
||||
# For some reasons the import library clang.lib of clang.exe is not
|
||||
# installed, so we copy it by ourselves.
|
||||
if is_windows():
|
||||
@@ -715,6 +746,11 @@ if __name__ == "__main__":
|
||||
if "python_path" not in config:
|
||||
raise ValueError("Config file needs to set python_path")
|
||||
python_path = config["python_path"]
|
||||
gcc_dir = None
|
||||
if "gcc_dir" in config:
|
||||
gcc_dir = config["gcc_dir"].format(**os.environ)
|
||||
if not os.path.exists(gcc_dir):
|
||||
raise ValueError("gcc_dir must point to an existing path")
|
||||
ndk_dir = None
|
||||
android_targets = None
|
||||
if "android_targets" in config:
|
||||
@@ -734,6 +770,9 @@ if __name__ == "__main__":
|
||||
if not all(isinstance(t, str) for t in extra_targets):
|
||||
raise ValueError("members of extra_targets should be strings")
|
||||
|
||||
if is_linux() and gcc_dir is None:
|
||||
raise ValueError("Config file needs to set gcc_dir")
|
||||
|
||||
if is_darwin() or osx_cross_compile:
|
||||
os.environ["MACOSX_DEPLOYMENT_TARGET"] = (
|
||||
"11.0" if os.environ.get("OSX_ARCH") == "arm64" else "10.12"
|
||||
@@ -885,6 +924,7 @@ if __name__ == "__main__":
|
||||
build_type,
|
||||
assertions,
|
||||
python_path,
|
||||
gcc_dir,
|
||||
libcxx_include_dir,
|
||||
build_wasm,
|
||||
is_final_stage=(stages == 1),
|
||||
@@ -914,6 +954,7 @@ if __name__ == "__main__":
|
||||
build_type,
|
||||
assertions,
|
||||
python_path,
|
||||
gcc_dir,
|
||||
libcxx_include_dir,
|
||||
build_wasm,
|
||||
compiler_rt_source_dir,
|
||||
@@ -946,6 +987,7 @@ if __name__ == "__main__":
|
||||
build_type,
|
||||
assertions,
|
||||
python_path,
|
||||
gcc_dir,
|
||||
libcxx_include_dir,
|
||||
build_wasm,
|
||||
compiler_rt_source_dir,
|
||||
@@ -987,6 +1029,7 @@ if __name__ == "__main__":
|
||||
build_type,
|
||||
assertions,
|
||||
python_path,
|
||||
gcc_dir,
|
||||
libcxx_include_dir,
|
||||
build_wasm,
|
||||
compiler_rt_source_dir,
|
||||
|
||||
Reference in New Issue
Block a user