Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE

Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
This commit is contained in:
Bogdan Tara
2020-10-24 03:36:18 +03:00
parent e5fc0768e5
commit 612312a64c
3540 changed files with 135641 additions and 174393 deletions

View File

@@ -38,8 +38,8 @@ def symlink(source, link_name):
def check_run(args):
print(" ".join(args), file=sys.stderr, flush=True)
if args[0] == "cmake":
print(' '.join(args), file=sys.stderr, flush=True)
if args[0] == 'cmake':
# CMake `message(STATUS)` messages, as appearing in failed source code
# compiles, appear on stdout, so we only capture that.
p = subprocess.Popen(args, stdout=subprocess.PIPE)
@@ -50,8 +50,8 @@ def check_run(args):
sys.stdout.flush()
r = p.wait()
if r != 0:
cmake_output_re = re.compile(b'See also "(.*/CMakeOutput.log)"')
cmake_error_re = re.compile(b'See also "(.*/CMakeError.log)"')
cmake_output_re = re.compile(b"See also \"(.*/CMakeOutput.log)\"")
cmake_error_re = re.compile(b"See also \"(.*/CMakeError.log)\"")
def find_first_match(re):
for l in lines:
@@ -63,10 +63,9 @@ def check_run(args):
error_match = find_first_match(cmake_error_re)
def dump_file(log):
with open(log, "rb") as f:
with open(log, 'rb') as f:
print("\nContents of", log, "follow\n", file=sys.stderr)
print(f.read(), file=sys.stderr)
if output_match:
dump_file(output_match.group(1))
if error_match:
@@ -95,18 +94,20 @@ def chdir(path):
def patch(patch, srcdir):
patch = os.path.realpath(patch)
check_run(["patch", "-d", srcdir, "-p1", "-i", patch, "--fuzz=0", "-s"])
check_run(['patch', '-d', srcdir, '-p1', '-i', patch, '--fuzz=0',
'-s'])
def import_clang_tidy(source_dir, build_clang_tidy_alpha, build_clang_tidy_external):
clang_plugin_path = os.path.join(os.path.dirname(sys.argv[0]), "..", "clang-plugin")
clang_tidy_path = os.path.join(source_dir, "clang-tools-extra/clang-tidy")
clang_plugin_path = os.path.join(os.path.dirname(sys.argv[0]),
'..', 'clang-plugin')
clang_tidy_path = os.path.join(source_dir,
'clang-tools-extra/clang-tidy')
sys.path.append(clang_plugin_path)
from import_mozilla_checks import do_import
import_options = {
"alpha": build_clang_tidy_alpha,
"external": build_clang_tidy_external,
"alpha": build_clang_tidy_alpha,
"external": build_clang_tidy_external
}
do_import(clang_plugin_path, clang_tidy_path, import_options)
@@ -137,7 +138,7 @@ def updated_env(env):
def build_tar_package(name, base, directory):
name = os.path.realpath(name)
print("tarring {} from {}/{}".format(name, base, directory), file=sys.stderr)
print('tarring {} from {}/{}'.format(name, base, directory), file=sys.stderr)
assert name.endswith(".tar.zst")
cctx = zstandard.ZstdCompressor()
@@ -166,7 +167,7 @@ def delete(path):
def install_libgcc(gcc_dir, clang_dir, is_final_stage):
gcc_bin_dir = os.path.join(gcc_dir, "bin")
gcc_bin_dir = os.path.join(gcc_dir, 'bin')
# Copy over gcc toolchain bits that clang looks for, to ensure that
# clang is using a consistent version of ld, since the system ld may
@@ -177,22 +178,17 @@ def install_libgcc(gcc_dir, clang_dir, is_final_stage):
# Only install this for the bootstrap process; we expect any consumers of
# the newly-built toolchain to provide an appropriate ld themselves.
if not is_final_stage:
x64_bin_dir = os.path.join(clang_dir, "x86_64-unknown-linux-gnu", "bin")
x64_bin_dir = os.path.join(clang_dir, 'x86_64-unknown-linux-gnu', 'bin')
mkdir_p(x64_bin_dir)
shutil.copy2(os.path.join(gcc_bin_dir, "ld"), x64_bin_dir)
shutil.copy2(os.path.join(gcc_bin_dir, 'ld'), x64_bin_dir)
out = subprocess.check_output(
[os.path.join(gcc_bin_dir, "gcc"), "-print-libgcc-file-name"]
)
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),
)
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")
@@ -207,16 +203,14 @@ def install_libgcc(gcc_dir, clang_dir, is_final_stage):
def install_import_library(build_dir, clang_dir):
shutil.copy2(
os.path.join(build_dir, "lib", "clang.lib"), os.path.join(clang_dir, "lib")
)
shutil.copy2(os.path.join(build_dir, "lib", "clang.lib"),
os.path.join(clang_dir, "lib"))
def install_asan_symbols(build_dir, clang_dir):
lib_path_pattern = os.path.join("lib", "clang", "*.*.*", "lib", "windows")
src_path = glob.glob(
os.path.join(build_dir, lib_path_pattern, "clang_rt.asan_dynamic-*.pdb")
)
src_path = glob.glob(os.path.join(build_dir, lib_path_pattern,
"clang_rt.asan_dynamic-*.pdb"))
dst_path = glob.glob(os.path.join(clang_dir, lib_path_pattern))
if len(src_path) != 1:
@@ -240,33 +234,14 @@ def is_windows():
return platform.system() == "Windows"
def build_one_stage(
cc,
cxx,
asm,
ld,
ar,
ranlib,
libtool,
src_dir,
stage_dir,
package_name,
build_libcxx,
osx_cross_compile,
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir=None,
runtimes_source_link=None,
compiler_rt_source_link=None,
is_final_stage=False,
android_targets=None,
extra_targets=None,
pgo_phase=None,
):
def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool,
src_dir, stage_dir, package_name, build_libcxx,
osx_cross_compile, build_type, assertions,
python_path, gcc_dir, libcxx_include_dir, build_wasm,
compiler_rt_source_dir=None, runtimes_source_link=None,
compiler_rt_source_link=None,
is_final_stage=False, android_targets=None,
extra_targets=None, pgo_phase=None):
if is_final_stage and (android_targets or extra_targets):
# Linking compiler-rt under "runtimes" activates LLVM_RUNTIME_TARGETS
# and related arguments.
@@ -284,7 +259,7 @@ def build_one_stage(
# cmake doesn't deal well with backslashes in paths.
def slashify_path(path):
return path.replace("\\", "/")
return path.replace('\\', '/')
def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir):
machine_targets = "X86;ARM;AArch64" if is_final_stage else "X86"
@@ -295,11 +270,11 @@ def build_one_stage(
"-DCMAKE_ASM_COMPILER=%s" % slashify_path(asm[0]),
"-DCMAKE_LINKER=%s" % slashify_path(ld[0]),
"-DCMAKE_AR=%s" % slashify_path(ar),
"-DCMAKE_C_FLAGS=%s" % " ".join(cc[1:]),
"-DCMAKE_CXX_FLAGS=%s" % " ".join(cxx[1:]),
"-DCMAKE_ASM_FLAGS=%s" % " ".join(asm[1:]),
"-DCMAKE_EXE_LINKER_FLAGS=%s" % " ".join(ld[1:]),
"-DCMAKE_SHARED_LINKER_FLAGS=%s" % " ".join(ld[1:]),
"-DCMAKE_C_FLAGS=%s" % ' '.join(cc[1:]),
"-DCMAKE_CXX_FLAGS=%s" % ' '.join(cxx[1:]),
"-DCMAKE_ASM_FLAGS=%s" % ' '.join(asm[1:]),
"-DCMAKE_EXE_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
"-DCMAKE_SHARED_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
"-DCMAKE_BUILD_TYPE=%s" % build_type,
"-DCMAKE_INSTALL_PREFIX=%s" % inst_dir,
"-DLLVM_TARGETS_TO_BUILD=%s" % machine_targets,
@@ -341,7 +316,7 @@ def build_one_stage(
"-DCMAKE_OSX_ARCHITECTURES=x86_64",
"-DDARWIN_osx_ARCHS=x86_64",
"-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
"-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin",
"-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin"
]
# Starting in LLVM 11 (which requires SDK 10.12) the build tries to
# detect the SDK version by calling xcrun. Cross-compiles don't have
@@ -405,9 +380,8 @@ def build_one_stage(
android_include_dirs = cfg["ndk_includes"]
api_level = cfg["api_level"]
android_flags = [
"-isystem %s" % d.format(**os.environ) for d in android_include_dirs
]
android_flags = ["-isystem %s" % d.format(**os.environ)
for d in android_include_dirs]
android_flags += ["--gcc-toolchain=%s" % android_gcc_dir]
android_flags += ["-D__ANDROID_API__=%s" % api_level]
@@ -417,21 +391,24 @@ def build_one_stage(
rt_cxx_flags = " ".join(cxx[1:] + android_flags)
rt_asm_flags = " ".join(asm[1:] + android_flags)
for kind in ("BUILTINS", "RUNTIMES"):
for kind in ('BUILTINS', 'RUNTIMES'):
for var, arg in (
("ANDROID", "1"),
("CMAKE_ASM_FLAGS", rt_asm_flags),
("CMAKE_CXX_FLAGS", rt_cxx_flags),
("CMAKE_C_FLAGS", rt_c_flags),
("CMAKE_EXE_LINKER_FLAGS", android_link_flags),
("CMAKE_SHARED_LINKER_FLAGS", android_link_flags),
("CMAKE_SYSROOT", sysroot_dir),
("ANDROID_NATIVE_API_LEVEL", api_level),
('ANDROID', '1'),
('CMAKE_ASM_FLAGS', rt_asm_flags),
('CMAKE_CXX_FLAGS', rt_cxx_flags),
('CMAKE_C_FLAGS', rt_c_flags),
('CMAKE_EXE_LINKER_FLAGS', android_link_flags),
('CMAKE_SHARED_LINKER_FLAGS', android_link_flags),
('CMAKE_SYSROOT', sysroot_dir),
('ANDROID_NATIVE_API_LEVEL', api_level),
):
cmake_args += ["-D%s_%s_%s=%s" % (kind, target, var, arg)]
cmake_args += ['-D%s_%s_%s=%s' % (kind, target, var, arg)]
cmake_args += cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir)
cmake_args += [src_dir]
cmake_args += cmake_base_args(
cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir)
cmake_args += [
src_dir
]
build_package(build_dir, cmake_args)
if is_linux():
@@ -448,40 +425,35 @@ def build_one_stage(
# 64-bits, which we detect through the contents of the LIB
# environment variable, which we also adjust for a 32-bits build
# at the same time.
old_lib = os.environ["LIB"]
old_lib = os.environ['LIB']
new_lib = []
for l in old_lib.split(os.pathsep):
if l.endswith("x64"):
l = l[:-3] + "x86"
if l.endswith('x64'):
l = l[:-3] + 'x86'
build_32_bit = True
elif l.endswith("amd64"):
elif l.endswith('amd64'):
l = l[:-5]
build_32_bit = True
new_lib.append(l)
if build_32_bit:
os.environ["LIB"] = os.pathsep.join(new_lib)
compiler_rt_build_dir = stage_dir + "/compiler-rt"
compiler_rt_inst_dir = inst_dir + "/lib/clang/"
os.environ['LIB'] = os.pathsep.join(new_lib)
compiler_rt_build_dir = stage_dir + '/compiler-rt'
compiler_rt_inst_dir = inst_dir + '/lib/clang/'
subdirs = os.listdir(compiler_rt_inst_dir)
assert len(subdirs) == 1
compiler_rt_inst_dir += subdirs[0]
cmake_args = cmake_base_args(
[os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + cc[1:],
[os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + cxx[1:],
[os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + asm[1:],
ld,
ar,
ranlib,
libtool,
compiler_rt_inst_dir,
)
[os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cc[1:],
[os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cxx[1:],
[os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + asm[1:],
ld, ar, ranlib, libtool, compiler_rt_inst_dir)
cmake_args += [
"-DLLVM_CONFIG_PATH=%s"
% slashify_path(os.path.join(inst_dir, "bin", "llvm-config")),
os.path.join(src_dir, "projects", "compiler-rt"),
'-DLLVM_CONFIG_PATH=%s' % slashify_path(
os.path.join(inst_dir, 'bin', 'llvm-config')),
os.path.join(src_dir, 'projects', 'compiler-rt'),
]
build_package(compiler_rt_build_dir, cmake_args)
os.environ["LIB"] = old_lib
os.environ['LIB'] = old_lib
if is_final_stage:
install_import_library(build_dir, inst_dir)
install_asan_symbols(build_dir, inst_dir)
@@ -540,16 +512,7 @@ def get_tool(config, key):
# run-clang-tidy.py
def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile):
# Make sure we only have what we expect.
dirs = [
"bin",
"include",
"lib",
"lib32",
"libexec",
"msbuild-bin",
"share",
"tools",
]
dirs = ["bin", "include", "lib", "lib32", "libexec", "msbuild-bin", "share", "tools"]
if is_linux():
dirs.append("x86_64-unknown-linux-gnu")
for f in glob.glob("%s/*" % final_dir):
@@ -558,7 +521,7 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile):
if not os.path.isdir(f):
raise Exception("Expected %s to be a directory" % f)
kept_binaries = ["clang-apply-replacements", "clang-format", "clang-tidy", "clangd"]
kept_binaries = ['clang-apply-replacements', 'clang-format', 'clang-tidy', 'clangd']
re_clang_tidy = re.compile(r"^(" + "|".join(kept_binaries) + r")(\.exe)?$", re.I)
for f in glob.glob("%s/bin/*" % final_dir):
if re_clang_tidy.search(os.path.basename(f)) is None:
@@ -577,12 +540,10 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile):
name = os.path.basename(f)
if name == "clang":
continue
if osx_cross_compile and name in ["libLLVM.dylib", "libclang-cpp.dylib"]:
if osx_cross_compile and name in ['libLLVM.dylib', 'libclang-cpp.dylib']:
continue
if is_linux() and (
fnmatch.fnmatch(name, "libLLVM*.so")
or fnmatch.fnmatch(name, "libclang-cpp.so*")
):
if is_linux() and (fnmatch.fnmatch(name, 'libLLVM*.so') or
fnmatch.fnmatch(name, 'libclang-cpp.so*')):
continue
delete(f)
for f in glob.glob("%s/lib/clang/*" % final_dir):
@@ -611,35 +572,24 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"-c",
"--config",
required=True,
type=argparse.FileType("r"),
help="Clang configuration file",
)
parser.add_argument(
"--clean", required=False, action="store_true", help="Clean the build directory"
)
parser.add_argument(
"--skip-tar",
required=False,
action="store_true",
help="Skip tar packaging stage",
)
parser.add_argument(
"--skip-checkout",
required=False,
action="store_true",
help="Do not checkout/revert source",
)
parser.add_argument('-c', '--config', required=True,
type=argparse.FileType('r'),
help="Clang configuration file")
parser.add_argument('--clean', required=False,
action='store_true',
help="Clean the build directory")
parser.add_argument('--skip-tar', required=False,
action='store_true',
help="Skip tar packaging stage")
parser.add_argument('--skip-checkout', required=False,
action='store_true',
help="Do not checkout/revert source")
args = parser.parse_args()
if not os.path.exists("llvm/LLVMBuild.txt"):
raise Exception(
"The script must be run from the root directory of the " "llvm-project tree"
)
if not os.path.exists('llvm/LLVMBuild.txt'):
raise Exception('The script must be run from the root directory of the '
'llvm-project tree')
source_dir = os.getcwd()
build_dir = source_dir + "/build"
@@ -684,10 +634,8 @@ if __name__ == "__main__":
if "build_type" in config:
build_type = config["build_type"]
if build_type not in ("Release", "Debug", "RelWithDebInfo", "MinSizeRel"):
raise ValueError(
"We only know how to do Release, Debug, RelWithDebInfo or "
"MinSizeRel builds"
)
raise ValueError("We only know how to do Release, Debug, RelWithDebInfo or "
"MinSizeRel builds")
build_libcxx = False
if "build_libcxx" in config:
build_libcxx = config["build_libcxx"]
@@ -708,17 +656,13 @@ if __name__ == "__main__":
if build_clang_tidy and "build_clang_tidy_alpha" in config:
build_clang_tidy_alpha = config["build_clang_tidy_alpha"]
if build_clang_tidy_alpha not in (True, False):
raise ValueError(
"Only boolean values are accepted for build_clang_tidy_alpha."
)
raise ValueError("Only boolean values are accepted for build_clang_tidy_alpha.")
build_clang_tidy_external = False
# check for build_clang_tidy_external only if build_clang_tidy is true
if build_clang_tidy and "build_clang_tidy_external" in config:
build_clang_tidy_external = config["build_clang_tidy_external"]
if build_clang_tidy_external not in (True, False):
raise ValueError(
"Only boolean values are accepted for build_clang_tidy_external."
)
raise ValueError("Only boolean values are accepted for build_clang_tidy_external.")
osx_cross_compile = False
if "osx_cross_compile" in config:
osx_cross_compile = config["osx_cross_compile"]
@@ -747,10 +691,8 @@ if __name__ == "__main__":
for attr in ("ndk_toolchain", "ndk_sysroot", "ndk_includes", "api_level"):
for target, cfg in android_targets.items():
if attr not in cfg:
raise ValueError(
"must specify '%s' as a key for android target: %s"
% (attr, target)
)
raise ValueError("must specify '%s' as a key for android target: %s" %
(attr, target))
extra_targets = None
if "extra_targets" in config:
extra_targets = config["extra_targets"]
@@ -763,7 +705,7 @@ if __name__ == "__main__":
raise ValueError("Config file needs to set gcc_dir")
if is_darwin() or osx_cross_compile:
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.11"
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.11'
cc = get_tool(config, "cc")
cxx = get_tool(config, "cxx")
@@ -783,14 +725,17 @@ if __name__ == "__main__":
compiler_rt_source_link = llvm_source_dir + "/projects/compiler-rt"
symlinks = [
(clang_source_dir, llvm_source_dir + "/tools/clang"),
(extra_source_dir, llvm_source_dir + "/tools/clang/tools/extra"),
(lld_source_dir, llvm_source_dir + "/tools/lld"),
(compiler_rt_source_dir, compiler_rt_source_link),
(libcxx_source_dir, llvm_source_dir + "/projects/libcxx"),
(libcxxabi_source_dir, llvm_source_dir + "/projects/libcxxabi"),
]
symlinks = [(clang_source_dir,
llvm_source_dir + "/tools/clang"),
(extra_source_dir,
llvm_source_dir + "/tools/clang/tools/extra"),
(lld_source_dir,
llvm_source_dir + "/tools/lld"),
(compiler_rt_source_dir, compiler_rt_source_link),
(libcxx_source_dir,
llvm_source_dir + "/projects/libcxx"),
(libcxxabi_source_dir,
llvm_source_dir + "/projects/libcxxabi")]
for l in symlinks:
# On Windows, we have to re-copy the whole directory every time.
if not is_windows() and os.path.islink(l[1]):
@@ -807,10 +752,11 @@ if __name__ == "__main__":
if not os.path.exists(build_dir):
os.makedirs(build_dir)
libcxx_include_dir = os.path.join(llvm_source_dir, "projects", "libcxx", "include")
libcxx_include_dir = os.path.join(llvm_source_dir, "projects",
"libcxx", "include")
stage1_dir = build_dir + "/stage1"
stage1_inst_dir = stage1_dir + "/" + package_name
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/' + package_name
final_stage_dir = stage1_dir
final_inst_dir = stage1_inst_dir
@@ -829,31 +775,24 @@ if __name__ == "__main__":
# up whatever headers were installed from the gcc we used to build stage1,
# always, rather than the system headers. Providing -gcc-toolchain
# encourages clang to do that.
extra_cflags2 = ["-fPIC", "-gcc-toolchain", stage1_inst_dir]
extra_cflags2 = ["-fPIC", '-gcc-toolchain', stage1_inst_dir]
# Silence clang's warnings about arguments not being used in compilation.
extra_cxxflags2 = [
"-fPIC",
"-Qunused-arguments",
"-gcc-toolchain",
stage1_inst_dir,
]
extra_cxxflags2 = ["-fPIC", '-Qunused-arguments', '-gcc-toolchain', stage1_inst_dir]
extra_asmflags = []
# Avoid libLLVM internal function calls going through the PLT.
extra_ldflags = ["-Wl,-Bsymbolic-functions"]
extra_ldflags = ['-Wl,-Bsymbolic-functions']
# For whatever reason, LLVM's build system will set things up to turn
# on -ffunction-sections and -fdata-sections, but won't turn on the
# corresponding option to strip unused sections. We do it explicitly
# here. LLVM's build system is also picky about turning on ICF, so
# we do that explicitly here, too.
extra_ldflags += ["-fuse-ld=gold", "-Wl,--gc-sections", "-Wl,--icf=safe"]
extra_ldflags += ['-fuse-ld=gold', '-Wl,--gc-sections', '-Wl,--icf=safe']
if "LD_LIBRARY_PATH" in os.environ:
os.environ["LD_LIBRARY_PATH"] = "%s/lib64/:%s" % (
gcc_dir,
os.environ["LD_LIBRARY_PATH"],
)
if 'LD_LIBRARY_PATH' in os.environ:
os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' %
(gcc_dir, os.environ['LD_LIBRARY_PATH']))
else:
os.environ["LD_LIBRARY_PATH"] = "%s/lib64/" % gcc_dir
os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
elif is_windows():
extra_cflags = []
extra_cxxflags = []
@@ -861,11 +800,7 @@ if __name__ == "__main__":
# by looking at an MSVC install, but we don't really have that here.
# Force things on.
extra_cflags2 = []
extra_cxxflags2 = [
"-fms-compatibility-version=19.13.26128",
"-Xclang",
"-std=c++14",
]
extra_cxxflags2 = ['-fms-compatibility-version=19.13.26128', '-Xclang', '-std=c++14']
extra_asmflags = []
extra_ldflags = []
@@ -876,186 +811,124 @@ if __name__ == "__main__":
extra_cxxflags = ["-stdlib=libc++"]
extra_cxxflags2 = ["-stdlib=libc++"]
extra_flags = [
"-target",
"x86_64-apple-darwin",
"-mlinker-version=137",
"-B",
"%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"),
"-isysroot",
os.getenv("CROSS_SYSROOT"),
# technically the sysroot flag there should be enough to deduce this,
# but clang needs some help to figure this out.
"-I%s/usr/include" % os.getenv("CROSS_SYSROOT"),
"-iframework",
"%s/System/Library/Frameworks" % os.getenv("CROSS_SYSROOT"),
]
extra_flags = ["-target", "x86_64-apple-darwin", "-mlinker-version=137",
"-B", "%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"),
"-isysroot", os.getenv("CROSS_SYSROOT"),
# technically the sysroot flag there should be enough to deduce this,
# but clang needs some help to figure this out.
"-I%s/usr/include" % os.getenv("CROSS_SYSROOT"),
"-iframework", "%s/System/Library/Frameworks" % os.getenv("CROSS_SYSROOT")]
extra_cflags += extra_flags
extra_cxxflags += extra_flags
extra_cflags2 += extra_flags
extra_cxxflags2 += extra_flags
extra_asmflags += extra_flags
extra_ldflags = [
"-Wl,-syslibroot,%s" % os.getenv("CROSS_SYSROOT"),
"-Wl,-dead_strip",
]
extra_ldflags = ["-Wl,-syslibroot,%s" % os.getenv("CROSS_SYSROOT"),
"-Wl,-dead_strip"]
upload_dir = os.getenv("UPLOAD_DIR")
upload_dir = os.getenv('UPLOAD_DIR')
if assertions and upload_dir:
extra_cflags2 += ["-fcrash-diagnostics-dir=%s" % upload_dir]
extra_cxxflags2 += ["-fcrash-diagnostics-dir=%s" % upload_dir]
extra_cflags2 += ['-fcrash-diagnostics-dir=%s' % upload_dir]
extra_cxxflags2 += ['-fcrash-diagnostics-dir=%s' % upload_dir]
build_one_stage(
[cc] + extra_cflags,
[cxx] + extra_cxxflags,
[asm] + extra_asmflags,
[ld] + extra_ldflags,
ar,
ranlib,
libtool,
llvm_source_dir,
stage1_dir,
package_name,
build_libcxx,
osx_cross_compile,
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
is_final_stage=(stages == 1),
)
ar, ranlib, libtool,
llvm_source_dir, stage1_dir, package_name, build_libcxx, osx_cross_compile,
build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm,
is_final_stage=(stages == 1))
runtimes_source_link = llvm_source_dir + "/runtimes/compiler-rt"
if stages >= 2:
stage2_dir = build_dir + "/stage2"
stage2_inst_dir = stage2_dir + "/" + package_name
stage2_dir = build_dir + '/stage2'
stage2_inst_dir = stage2_dir + '/' + package_name
final_stage_dir = stage2_dir
final_inst_dir = stage2_inst_dir
pgo_phase = "gen" if pgo else None
build_one_stage(
[stage1_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2,
[stage1_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2,
[stage1_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags,
[stage1_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_cflags2,
[stage1_inst_dir + "/bin/%s%s" %
(cxx_name, exe_ext)] + extra_cxxflags2,
[stage1_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_asmflags,
[ld] + extra_ldflags,
ar,
ranlib,
libtool,
llvm_source_dir,
stage2_dir,
package_name,
build_libcxx,
osx_cross_compile,
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,
runtimes_source_link,
compiler_rt_source_link,
is_final_stage=(stages == 2),
android_targets=android_targets,
extra_targets=extra_targets,
pgo_phase=pgo_phase,
)
ar, ranlib, libtool,
llvm_source_dir, stage2_dir, package_name, build_libcxx, osx_cross_compile,
build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm,
compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link,
is_final_stage=(stages == 2), android_targets=android_targets,
extra_targets=extra_targets, pgo_phase=pgo_phase)
if stages >= 3:
stage3_dir = build_dir + "/stage3"
stage3_inst_dir = stage3_dir + "/" + package_name
stage3_dir = build_dir + '/stage3'
stage3_inst_dir = stage3_dir + '/' + package_name
final_stage_dir = stage3_dir
final_inst_dir = stage3_inst_dir
build_one_stage(
[stage2_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2,
[stage2_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2,
[stage2_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags,
[stage2_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_cflags2,
[stage2_inst_dir + "/bin/%s%s" %
(cxx_name, exe_ext)] + extra_cxxflags2,
[stage2_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_asmflags,
[ld] + extra_ldflags,
ar,
ranlib,
libtool,
llvm_source_dir,
stage3_dir,
package_name,
build_libcxx,
osx_cross_compile,
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,
runtimes_source_link,
compiler_rt_source_link,
(stages == 3),
extra_targets=extra_targets,
)
ar, ranlib, libtool,
llvm_source_dir, stage3_dir, package_name, build_libcxx, osx_cross_compile,
build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm,
compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link,
(stages == 3), extra_targets=extra_targets)
if stages >= 4:
stage4_dir = build_dir + "/stage4"
stage4_inst_dir = stage4_dir + "/" + package_name
stage4_dir = build_dir + '/stage4'
stage4_inst_dir = stage4_dir + '/' + package_name
final_stage_dir = stage4_dir
final_inst_dir = stage4_inst_dir
pgo_phase = None
if pgo:
pgo_phase = "use"
llvm_profdata = stage3_inst_dir + "/bin/llvm-profdata%s" % exe_ext
merge_cmd = [llvm_profdata, "merge", "-o", "merged.profdata"]
profraw_files = glob.glob(
os.path.join(stage2_dir, "build", "profiles", "*.profraw")
)
merge_cmd = [llvm_profdata, 'merge', '-o', 'merged.profdata']
profraw_files = glob.glob(os.path.join(stage2_dir, 'build',
'profiles', '*.profraw'))
if not os.path.exists(stage4_dir):
os.mkdir(stage4_dir)
run_in(stage4_dir, merge_cmd + profraw_files)
build_one_stage(
[stage3_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2,
[stage3_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2,
[stage3_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags,
[stage3_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_cflags2,
[stage3_inst_dir + "/bin/%s%s" %
(cxx_name, exe_ext)] + extra_cxxflags2,
[stage3_inst_dir + "/bin/%s%s" %
(cc_name, exe_ext)] + extra_asmflags,
[ld] + extra_ldflags,
ar,
ranlib,
libtool,
llvm_source_dir,
stage4_dir,
package_name,
build_libcxx,
osx_cross_compile,
build_type,
assertions,
python_path,
gcc_dir,
libcxx_include_dir,
build_wasm,
compiler_rt_source_dir,
runtimes_source_link,
compiler_rt_source_link,
(stages == 4),
extra_targets=extra_targets,
pgo_phase=pgo_phase,
)
ar, ranlib, libtool,
llvm_source_dir, stage4_dir, package_name, build_libcxx, osx_cross_compile,
build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm,
compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link,
(stages == 4), extra_targets=extra_targets, pgo_phase=pgo_phase)
if build_clang_tidy:
prune_final_dir_for_clang_tidy(
os.path.join(final_stage_dir, package_name), osx_cross_compile
)
prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, package_name),
osx_cross_compile)
# 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")
):
os.path.join(sysroot, "lib", "clang", "*", "lib", "wasi")):
print("Copying from wasi-sysroot 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"
)
version = os.path.basename(os.path.dirname(os.path.dirname(
srcdir)))
destdir = os.path.join(final_inst_dir, "lib", "clang", version,
"lib", "wasi")
mkdir_p(destdir)
copy_tree(srcdir, destdir)