mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Backed out 2 changesets (bug 1820947) for causing build bustage CLOSED TREE
Backed out changeset eb6419bb8748 (bug 1820947) Backed out changeset 9990083e8ea2 (bug 1820947)
This commit is contained in:
parent
0eabfe04d0
commit
4a35828e21
@ -11,7 +11,7 @@ case "$target" in
|
|||||||
LDFLAGS="$extra_android_flags $LDFLAGS"
|
LDFLAGS="$extra_android_flags $LDFLAGS"
|
||||||
CPPFLAGS="$extra_android_flags $CPPFLAGS"
|
CPPFLAGS="$extra_android_flags $CPPFLAGS"
|
||||||
CFLAGS="-fno-short-enums $CFLAGS"
|
CFLAGS="-fno-short-enums $CFLAGS"
|
||||||
CXXFLAGS="-fno-short-enums $CXXFLAGS"
|
CXXFLAGS="-fno-short-enums $CXXFLAGS $stlport_cppflags"
|
||||||
ASFLAGS="$extra_android_flags -DANDROID $ASFLAGS"
|
ASFLAGS="$extra_android_flags -DANDROID $ASFLAGS"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -121,50 +121,84 @@ set_config("ANDROID_NDK_MAJOR_VERSION", ndk_version.major)
|
|||||||
set_config("ANDROID_NDK_MINOR_VERSION", ndk_version.minor)
|
set_config("ANDROID_NDK_MINOR_VERSION", ndk_version.minor)
|
||||||
|
|
||||||
|
|
||||||
|
@depends(target, android_version, ndk)
|
||||||
|
@checking("for android platform directory")
|
||||||
@imports(_from="os.path", _import="isdir")
|
@imports(_from="os.path", _import="isdir")
|
||||||
@imports(_from="mozbuild.shellutil", _import="quote")
|
def android_platform(target, android_version, ndk):
|
||||||
def host_dir(host, base_dir):
|
if target.os != "Android":
|
||||||
dir_format = "%s/%s-%s"
|
return
|
||||||
host_kernel = "windows" if host.kernel == "WINNT" else host.kernel.lower()
|
|
||||||
|
|
||||||
dir = dir_format % (base_dir, host_kernel, host.cpu)
|
if "aarch64" == target.cpu:
|
||||||
log.debug("Trying %s" % quote(dir))
|
target_dir_name = "arm64"
|
||||||
if not isdir(dir) and host.cpu == "x86_64":
|
else:
|
||||||
dir = dir_format % (base_dir, host_kernel, "x86")
|
target_dir_name = target.cpu
|
||||||
log.debug("Trying %s" % quote(dir))
|
|
||||||
if not isdir(dir) and host.kernel == "Darwin" and host.cpu == "aarch64":
|
# Not all Android releases have their own platform release. We use
|
||||||
dir = dir_format % (base_dir, host_kernel, "x86_64")
|
# the next lower platform version in these cases.
|
||||||
log.debug("Trying %s" % quote(dir))
|
if android_version in (11, 10):
|
||||||
if isdir(dir):
|
platform_version = 9
|
||||||
return dir
|
elif android_version in (20, 22):
|
||||||
|
platform_version = android_version - 1
|
||||||
|
else:
|
||||||
|
platform_version = android_version
|
||||||
|
|
||||||
|
platform_dir = os.path.join(
|
||||||
|
ndk, "platforms", "android-%s" % platform_version, "arch-%s" % target_dir_name
|
||||||
|
)
|
||||||
|
|
||||||
|
if not isdir(platform_dir):
|
||||||
|
die(
|
||||||
|
"Android platform directory not found. With the current "
|
||||||
|
"configuration, it should be in %s" % platform_dir
|
||||||
|
)
|
||||||
|
|
||||||
|
return platform_dir
|
||||||
|
|
||||||
|
|
||||||
@depends(ndk, target, host)
|
@depends(ndk, target)
|
||||||
@checking("for android sysroot directory")
|
@checking("for android sysroot directory")
|
||||||
@imports(_from="os.path", _import="isdir")
|
@imports(_from="os.path", _import="isdir")
|
||||||
def android_sysroot(ndk, target, host):
|
def android_sysroot(ndk, target):
|
||||||
if target.os != "Android":
|
if target.os != "Android":
|
||||||
return
|
return
|
||||||
|
|
||||||
search_dirs = [
|
search_dirs = [
|
||||||
os.path.join(
|
# (<if this directory exists>, <return this directory>)
|
||||||
host_dir(host, os.path.join(ndk, "toolchains", "llvm", "prebuilt")),
|
(os.path.join(ndk, "sysroot"), os.path.join(ndk, "sysroot")),
|
||||||
"sysroot",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
for sysroot_dir in search_dirs:
|
for test_dir, sysroot_dir in search_dirs:
|
||||||
if isdir(sysroot_dir):
|
if isdir(test_dir):
|
||||||
return sysroot_dir
|
return sysroot_dir
|
||||||
|
|
||||||
die(
|
die(
|
||||||
"Android sysroot directory not found in %s."
|
"Android sysroot directory not found in %s."
|
||||||
% str([sysroot_dir for sysroot_dir in search_dirs])
|
% str([sysroot_dir for test_dir, sysroot_dir in search_dirs])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@depends(ndk, target)
|
||||||
|
@checking("for android system directory")
|
||||||
|
@imports(_from="os.path", _import="isdir")
|
||||||
|
def android_system(ndk, target):
|
||||||
|
if target.os != "Android":
|
||||||
|
return
|
||||||
|
|
||||||
|
search_dirs = [
|
||||||
|
os.path.join(ndk, "sysroot", "usr", "include", target.toolchain),
|
||||||
|
]
|
||||||
|
|
||||||
|
for system_dir in search_dirs:
|
||||||
|
if isdir(system_dir):
|
||||||
|
return system_dir
|
||||||
|
|
||||||
|
die("Android system directory not found in %s." % str(search_dirs))
|
||||||
|
|
||||||
|
|
||||||
@depends(target, host, ndk, "--with-android-toolchain")
|
@depends(target, host, ndk, "--with-android-toolchain")
|
||||||
@checking("for the Android toolchain directory", lambda x: x or "not found")
|
@checking("for the Android toolchain directory", lambda x: x or "not found")
|
||||||
|
@imports(_from="os.path", _import="isdir")
|
||||||
|
@imports(_from="mozbuild.shellutil", _import="quote")
|
||||||
def android_toolchain(target, host, ndk, toolchain):
|
def android_toolchain(target, host, ndk, toolchain):
|
||||||
if not ndk:
|
if not ndk:
|
||||||
return
|
return
|
||||||
@ -182,8 +216,18 @@ def android_toolchain(target, host, ndk, toolchain):
|
|||||||
else:
|
else:
|
||||||
die("Target cpu is not supported.")
|
die("Target cpu is not supported.")
|
||||||
|
|
||||||
toolchain = host_dir(host, "%s/toolchains/%s-4.9/prebuilt" % (ndk, target_base))
|
toolchain_format = "%s/toolchains/%s-4.9/prebuilt/%s-%s"
|
||||||
if toolchain:
|
host_kernel = "windows" if host.kernel == "WINNT" else host.kernel.lower()
|
||||||
|
|
||||||
|
toolchain = toolchain_format % (ndk, target_base, host_kernel, host.cpu)
|
||||||
|
log.debug("Trying %s" % quote(toolchain))
|
||||||
|
if not isdir(toolchain) and host.cpu == "x86_64":
|
||||||
|
toolchain = toolchain_format % (ndk, target_base, host_kernel, "x86")
|
||||||
|
log.debug("Trying %s" % quote(toolchain))
|
||||||
|
if not isdir(toolchain) and host.kernel == "Darwin" and host.cpu == "aarch64":
|
||||||
|
toolchain = toolchain_format % (ndk, target_base, host_kernel, "x86_64")
|
||||||
|
log.debug("Trying %s" % quote(toolchain))
|
||||||
|
if isdir(toolchain):
|
||||||
return toolchain
|
return toolchain
|
||||||
die("You have to specify --with-android-toolchain=" "/path/to/ndk/toolchain.")
|
die("You have to specify --with-android-toolchain=" "/path/to/ndk/toolchain.")
|
||||||
|
|
||||||
@ -237,6 +281,58 @@ def android_lldb_server(target, host, ndk, lldb):
|
|||||||
set_config("ANDROID_LLDB_SERVER", android_lldb_server)
|
set_config("ANDROID_LLDB_SERVER", android_lldb_server)
|
||||||
|
|
||||||
|
|
||||||
|
option(
|
||||||
|
env="STLPORT_CPPFLAGS",
|
||||||
|
nargs=1,
|
||||||
|
help="Options compiler should pass for standard C++ library",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@depends("STLPORT_CPPFLAGS", ndk)
|
||||||
|
@imports(_from="os.path", _import="isdir")
|
||||||
|
def stlport_cppflags(value, ndk):
|
||||||
|
if value and len(value):
|
||||||
|
return value.split()
|
||||||
|
if not ndk:
|
||||||
|
return
|
||||||
|
|
||||||
|
ndk_base = os.path.join(ndk, "sources", "cxx-stl")
|
||||||
|
cxx_base = os.path.join(ndk_base, "llvm-libc++")
|
||||||
|
cxx_include = os.path.join(cxx_base, "libcxx", "include")
|
||||||
|
cxxabi_base = os.path.join(ndk_base, "llvm-libc++abi")
|
||||||
|
cxxabi_include = os.path.join(cxxabi_base, "libcxxabi", "include")
|
||||||
|
|
||||||
|
if not isdir(cxx_include):
|
||||||
|
# NDK r13 removes the inner "libcxx" directory.
|
||||||
|
cxx_include = os.path.join(cxx_base, "include")
|
||||||
|
if not isdir(cxx_include):
|
||||||
|
die("Couldn't find path to libc++ includes in the android ndk")
|
||||||
|
|
||||||
|
if not isdir(cxxabi_include):
|
||||||
|
# NDK r13 removes the inner "libcxxabi" directory.
|
||||||
|
cxxabi_include = os.path.join(cxxabi_base, "include")
|
||||||
|
if not isdir(cxxabi_include):
|
||||||
|
die("Couldn't find path to libc++abi includes in the android ndk")
|
||||||
|
|
||||||
|
# Add android/support/include/ for prototyping long double math
|
||||||
|
# functions, locale-specific C library functions, multibyte support,
|
||||||
|
# etc.
|
||||||
|
return [
|
||||||
|
# You'd think we'd want to use -stdlib=libc++, but this doesn't work
|
||||||
|
# (cf. https://bugzilla.mozilla.org/show_bug.cgi?id=1510897#c2)
|
||||||
|
# Using -stdlib=libc++ and removing some of the -I below also doesn't
|
||||||
|
# work because not everything that is in cxx_include comes in the C++
|
||||||
|
# header directory that comes with clang.
|
||||||
|
"-stdlib=libstdc++",
|
||||||
|
"-I%s" % cxx_include,
|
||||||
|
"-I%s" % os.path.join(ndk, "sources", "android", "support", "include"),
|
||||||
|
"-I%s" % cxxabi_include,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
add_old_configure_assignment("stlport_cppflags", stlport_cppflags)
|
||||||
|
|
||||||
|
|
||||||
option(
|
option(
|
||||||
env="STLPORT_LIBS",
|
env="STLPORT_LIBS",
|
||||||
nargs=1,
|
nargs=1,
|
||||||
@ -244,27 +340,48 @@ option(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@depends("STLPORT_LIBS", ndk)
|
@depends("STLPORT_LIBS", ndk, android_cpu_arch)
|
||||||
@imports(_from="os.path", _import="isfile")
|
@imports(_from="os.path", _import="isfile")
|
||||||
def stlport_libs(value, ndk):
|
def stlport_libs(value, ndk, android_cpu_arch):
|
||||||
if value and len(value):
|
if value and len(value):
|
||||||
return value.split()
|
return value.split()
|
||||||
if not ndk:
|
if not ndk:
|
||||||
return
|
return
|
||||||
|
|
||||||
return ["-static-libstdc++"]
|
cxx_libs = os.path.join(
|
||||||
|
ndk, "sources", "cxx-stl", "llvm-libc++", "libs", android_cpu_arch
|
||||||
|
)
|
||||||
|
if not isfile(os.path.join(cxx_libs, "libc++_static.a")):
|
||||||
|
die("Couldn't find path to llvm-libc++ in the android ndk")
|
||||||
|
|
||||||
|
libs = [
|
||||||
|
"-L%s" % cxx_libs,
|
||||||
|
"-lc++_static",
|
||||||
|
]
|
||||||
|
|
||||||
|
for lib in ("c++abi", "unwind", "android_support"):
|
||||||
|
if isfile(os.path.join(cxx_libs, "lib%s.a" % lib)):
|
||||||
|
libs.append("-l%s" % lib)
|
||||||
|
|
||||||
|
return libs
|
||||||
|
|
||||||
|
|
||||||
set_config("STLPORT_LIBS", stlport_libs)
|
set_config("STLPORT_LIBS", stlport_libs)
|
||||||
|
|
||||||
|
|
||||||
@depends(android_sysroot, android_toolchain)
|
@depends(android_system, android_sysroot, android_toolchain, android_version)
|
||||||
def extra_toolchain_flags(android_sysroot, toolchain_dir):
|
def extra_toolchain_flags(
|
||||||
|
android_system, android_sysroot, toolchain_dir, android_version
|
||||||
|
):
|
||||||
if not android_sysroot:
|
if not android_sysroot:
|
||||||
return []
|
return []
|
||||||
flags = [
|
flags = [
|
||||||
"--sysroot={}".format(android_sysroot),
|
"-isystem",
|
||||||
|
android_system,
|
||||||
|
"-isystem",
|
||||||
|
os.path.join(android_sysroot, "usr", "include"),
|
||||||
"--gcc-toolchain={}".format(toolchain_dir),
|
"--gcc-toolchain={}".format(toolchain_dir),
|
||||||
|
"-D__ANDROID_API__=%d" % android_version,
|
||||||
]
|
]
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
@ -272,9 +389,12 @@ def extra_toolchain_flags(android_sysroot, toolchain_dir):
|
|||||||
add_old_configure_assignment("extra_android_flags", extra_toolchain_flags)
|
add_old_configure_assignment("extra_android_flags", extra_toolchain_flags)
|
||||||
|
|
||||||
|
|
||||||
@depends(extra_toolchain_flags)
|
@depends(extra_toolchain_flags, stlport_cppflags)
|
||||||
def bindgen_cflags_android(toolchain_flags):
|
def bindgen_cflags_android(toolchain_flags, stlport_flags):
|
||||||
return toolchain_flags
|
if not toolchain_flags:
|
||||||
|
return
|
||||||
|
|
||||||
|
return toolchain_flags + stlport_flags
|
||||||
|
|
||||||
|
|
||||||
@depends("--with-android-googlevr-sdk", target)
|
@depends("--with-android-googlevr-sdk", target)
|
||||||
|
@ -123,7 +123,6 @@ option(
|
|||||||
clang_search_path,
|
clang_search_path,
|
||||||
target,
|
target,
|
||||||
target_sysroot.path,
|
target_sysroot.path,
|
||||||
android_version,
|
|
||||||
)
|
)
|
||||||
@checking("for clang for bindgen", lambda x: x.path if x else "not found")
|
@checking("for clang for bindgen", lambda x: x.path if x else "not found")
|
||||||
def bindgen_clang_compiler(
|
def bindgen_clang_compiler(
|
||||||
@ -134,7 +133,6 @@ def bindgen_clang_compiler(
|
|||||||
clang_search_path,
|
clang_search_path,
|
||||||
target,
|
target,
|
||||||
sysroot_path,
|
sysroot_path,
|
||||||
android_version,
|
|
||||||
):
|
):
|
||||||
# When the target compiler is clang, use that, including flags.
|
# When the target compiler is clang, use that, including flags.
|
||||||
if cxx_compiler.type == "clang":
|
if cxx_compiler.type == "clang":
|
||||||
@ -174,18 +172,14 @@ def bindgen_clang_compiler(
|
|||||||
flags = []
|
flags = []
|
||||||
if sysroot_path:
|
if sysroot_path:
|
||||||
flags.extend(("--sysroot", sysroot_path))
|
flags.extend(("--sysroot", sysroot_path))
|
||||||
info = check_compiler(
|
info = check_compiler(configure_cache, [clang_path] + flags, "C++", target)
|
||||||
configure_cache, [clang_path] + flags, "C++", target, android_version
|
|
||||||
)
|
|
||||||
# Usually, one check_compiler pass would be enough, but when cross-compiling
|
# Usually, one check_compiler pass would be enough, but when cross-compiling
|
||||||
# and the host and target don't use the same default C++ standard, we don't
|
# and the host and target don't use the same default C++ standard, we don't
|
||||||
# get the --std flag, so try again. This is the same thing as valid_compiler()
|
# get the --std flag, so try again. This is the same thing as valid_compiler()
|
||||||
# does in toolchain.configure.
|
# does in toolchain.configure.
|
||||||
if info.flags:
|
if info.flags:
|
||||||
flags += info.flags
|
flags += info.flags
|
||||||
info = check_compiler(
|
info = check_compiler(configure_cache, [clang_path] + flags, "C++", target)
|
||||||
configure_cache, [clang_path] + flags, "C++", target, android_version
|
|
||||||
)
|
|
||||||
return namespace(
|
return namespace(
|
||||||
path=clang_path,
|
path=clang_path,
|
||||||
flags=flags + info.flags,
|
flags=flags + info.flags,
|
||||||
|
@ -105,6 +105,7 @@ def compiler_class(compiler, host_or_target):
|
|||||||
self,
|
self,
|
||||||
dependable(flags),
|
dependable(flags),
|
||||||
extra_toolchain_flags,
|
extra_toolchain_flags,
|
||||||
|
stlport_cppflags,
|
||||||
dependable(header),
|
dependable(header),
|
||||||
onerror,
|
onerror,
|
||||||
configure_cache,
|
configure_cache,
|
||||||
@ -115,6 +116,7 @@ def compiler_class(compiler, host_or_target):
|
|||||||
compiler,
|
compiler,
|
||||||
flags,
|
flags,
|
||||||
extra_flags,
|
extra_flags,
|
||||||
|
stlport_flags,
|
||||||
header,
|
header,
|
||||||
onerror,
|
onerror,
|
||||||
configure_cache,
|
configure_cache,
|
||||||
@ -122,6 +124,8 @@ def compiler_class(compiler, host_or_target):
|
|||||||
flags = list(flags or [])
|
flags = list(flags or [])
|
||||||
if is_target:
|
if is_target:
|
||||||
flags += extra_flags or []
|
flags += extra_flags or []
|
||||||
|
if compiler.language == "C++":
|
||||||
|
flags += stlport_flags or []
|
||||||
header = header or ""
|
header = header or ""
|
||||||
if isinstance(header, (list, tuple)):
|
if isinstance(header, (list, tuple)):
|
||||||
header = "\n".join(header)
|
header = "\n".join(header)
|
||||||
|
@ -410,7 +410,7 @@ def same_arch_different_bits():
|
|||||||
|
|
||||||
@imports(_from="mozbuild.shellutil", _import="quote")
|
@imports(_from="mozbuild.shellutil", _import="quote")
|
||||||
@imports(_from="mozbuild.configure.constants", _import="OS_preprocessor_checks")
|
@imports(_from="mozbuild.configure.constants", _import="OS_preprocessor_checks")
|
||||||
def check_compiler(configure_cache, compiler, language, target, android_version):
|
def check_compiler(configure_cache, compiler, language, target):
|
||||||
info = get_compiler_info(configure_cache, compiler, language)
|
info = get_compiler_info(configure_cache, compiler, language)
|
||||||
|
|
||||||
flags = []
|
flags = []
|
||||||
@ -445,13 +445,6 @@ def check_compiler(configure_cache, compiler, language, target, android_version)
|
|||||||
# Check compiler target
|
# Check compiler target
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
has_target = False
|
has_target = False
|
||||||
if target.os == "Android" and android_version:
|
|
||||||
# This makes clang define __ANDROID_API__ and use versioned library
|
|
||||||
# directories from the NDK.
|
|
||||||
toolchain = "%s%d" % (target.toolchain, android_version)
|
|
||||||
else:
|
|
||||||
toolchain = target.toolchain
|
|
||||||
|
|
||||||
if info.type == "clang":
|
if info.type == "clang":
|
||||||
# Add the target explicitly when the target is aarch64 macosx, because
|
# Add the target explicitly when the target is aarch64 macosx, because
|
||||||
# the Xcode clang target is named differently, and we need to work around
|
# the Xcode clang target is named differently, and we need to work around
|
||||||
@ -470,7 +463,7 @@ def check_compiler(configure_cache, compiler, language, target, android_version)
|
|||||||
or not info.endianness
|
or not info.endianness
|
||||||
or info.endianness != target.endianness
|
or info.endianness != target.endianness
|
||||||
):
|
):
|
||||||
flags.append("--target=%s" % toolchain)
|
flags.append("--target=%s" % target.toolchain)
|
||||||
has_target = True
|
has_target = True
|
||||||
|
|
||||||
# Add target flag when there is an OS mismatch (e.g. building for Android on
|
# Add target flag when there is an OS mismatch (e.g. building for Android on
|
||||||
@ -479,7 +472,7 @@ def check_compiler(configure_cache, compiler, language, target, android_version)
|
|||||||
elif target.os in OS_preprocessor_checks and (
|
elif target.os in OS_preprocessor_checks and (
|
||||||
not info.os or info.os != target.os
|
not info.os or info.os != target.os
|
||||||
):
|
):
|
||||||
flags.append("--target=%s" % toolchain)
|
flags.append("--target=%s" % target.toolchain)
|
||||||
has_target = True
|
has_target = True
|
||||||
|
|
||||||
if not has_target and (not info.cpu or info.cpu != target.cpu):
|
if not has_target and (not info.cpu or info.cpu != target.cpu):
|
||||||
@ -489,9 +482,9 @@ def check_compiler(configure_cache, compiler, language, target, android_version)
|
|||||||
elif (info.cpu, target.cpu) in same_arch:
|
elif (info.cpu, target.cpu) in same_arch:
|
||||||
flags.append("-m64")
|
flags.append("-m64")
|
||||||
elif info.type == "clang-cl" and target.cpu == "aarch64":
|
elif info.type == "clang-cl" and target.cpu == "aarch64":
|
||||||
flags.append("--target=%s" % toolchain)
|
flags.append("--target=%s" % target.toolchain)
|
||||||
elif info.type == "clang":
|
elif info.type == "clang":
|
||||||
flags.append("--target=%s" % toolchain)
|
flags.append("--target=%s" % target.toolchain)
|
||||||
|
|
||||||
return namespace(
|
return namespace(
|
||||||
type=info.type,
|
type=info.type,
|
||||||
@ -1206,7 +1199,6 @@ def compiler(
|
|||||||
host_or_target,
|
host_or_target,
|
||||||
sysroot,
|
sysroot,
|
||||||
macos_target,
|
macos_target,
|
||||||
android_version,
|
|
||||||
multiarch_dir,
|
multiarch_dir,
|
||||||
winsysroot,
|
winsysroot,
|
||||||
host,
|
host,
|
||||||
@ -1222,7 +1214,6 @@ def compiler(
|
|||||||
host_or_target,
|
host_or_target,
|
||||||
sysroot,
|
sysroot,
|
||||||
macos_target,
|
macos_target,
|
||||||
android_version,
|
|
||||||
multiarch_dir,
|
multiarch_dir,
|
||||||
winsysroot,
|
winsysroot,
|
||||||
host,
|
host,
|
||||||
@ -1244,11 +1235,7 @@ def compiler(
|
|||||||
flags.extend(provided_compiler.flags)
|
flags.extend(provided_compiler.flags)
|
||||||
|
|
||||||
info = check_compiler(
|
info = check_compiler(
|
||||||
configure_cache,
|
configure_cache, wrapper + [compiler] + flags, language, host_or_target
|
||||||
wrapper + [compiler] + flags,
|
|
||||||
language,
|
|
||||||
host_or_target,
|
|
||||||
android_version,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if info.type == "clang" and language == "C++" and host_or_target.os == "OSX":
|
if info.type == "clang" and language == "C++" and host_or_target.os == "OSX":
|
||||||
@ -1271,7 +1258,6 @@ def compiler(
|
|||||||
wrapper + [compiler] + flags,
|
wrapper + [compiler] + flags,
|
||||||
language,
|
language,
|
||||||
host_or_target,
|
host_or_target,
|
||||||
android_version,
|
|
||||||
)
|
)
|
||||||
except FatalCheckError:
|
except FatalCheckError:
|
||||||
pass
|
pass
|
||||||
@ -1397,15 +1383,6 @@ def compiler(
|
|||||||
% (host_or_target.alias, info.version)
|
% (host_or_target.alias, info.version)
|
||||||
)
|
)
|
||||||
|
|
||||||
if host_or_target.os == "Android":
|
|
||||||
# Need at least clang 8 for support for __ANDROID_API__ and versioned
|
|
||||||
# library directories from the NDK.
|
|
||||||
if info.type == "clang" and info.version < "8.0":
|
|
||||||
raise FatalCheckError(
|
|
||||||
"Only clang/llvm 8.0 or newer is supported for %s (found version %s)."
|
|
||||||
% (host_or_target.alias, info.version)
|
|
||||||
)
|
|
||||||
|
|
||||||
if info.flags:
|
if info.flags:
|
||||||
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
||||||
|
|
||||||
@ -1838,8 +1815,7 @@ def linker_ldflags_tmpl(host_or_target):
|
|||||||
target,
|
target,
|
||||||
target_sysroot,
|
target_sysroot,
|
||||||
target_multiarch_dir,
|
target_multiarch_dir,
|
||||||
android_sysroot,
|
android_platform,
|
||||||
android_version,
|
|
||||||
c_compiler,
|
c_compiler,
|
||||||
developer_options,
|
developer_options,
|
||||||
)
|
)
|
||||||
@ -1850,7 +1826,6 @@ def linker_ldflags_tmpl(host_or_target):
|
|||||||
host_sysroot,
|
host_sysroot,
|
||||||
host_multiarch_dir,
|
host_multiarch_dir,
|
||||||
dependable(None),
|
dependable(None),
|
||||||
dependable(None),
|
|
||||||
host_c_compiler,
|
host_c_compiler,
|
||||||
developer_options,
|
developer_options,
|
||||||
)
|
)
|
||||||
@ -1862,8 +1837,7 @@ def linker_ldflags_tmpl(host_or_target):
|
|||||||
target,
|
target,
|
||||||
sysroot,
|
sysroot,
|
||||||
multiarch_dir,
|
multiarch_dir,
|
||||||
android_sysroot,
|
android_platform,
|
||||||
android_version,
|
|
||||||
c_compiler,
|
c_compiler,
|
||||||
developer_options,
|
developer_options,
|
||||||
):
|
):
|
||||||
@ -1889,17 +1863,11 @@ def linker_ldflags_tmpl(host_or_target):
|
|||||||
sysroot.path, multiarch_dir, sysroot.stdcxx_version
|
sysroot.path, multiarch_dir, sysroot.stdcxx_version
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if android_sysroot:
|
if android_platform:
|
||||||
# BFD/gold linkers need a manual --rpath-link for indirect
|
flags.append("-L{}/usr/lib".format(android_platform))
|
||||||
# dependencies.
|
flags.append("-Wl,--rpath-link={}/usr/lib".format(android_platform))
|
||||||
flags += [
|
flags.append("--sysroot")
|
||||||
"-Wl,--rpath-link={}/usr/lib/{}".format(
|
flags.append(android_platform)
|
||||||
android_sysroot, target.toolchain
|
|
||||||
),
|
|
||||||
"-Wl,--rpath-link={}/usr/lib/{}/{}".format(
|
|
||||||
android_sysroot, target.toolchain, android_version
|
|
||||||
),
|
|
||||||
]
|
|
||||||
if (
|
if (
|
||||||
developer_options
|
developer_options
|
||||||
and linker
|
and linker
|
||||||
|
@ -29,7 +29,7 @@ for v in ("OS_CPPFLAGS", "OS_CFLAGS", "DEBUG", "CLANG_PLUGIN", "OPTIMIZE", "FRAM
|
|||||||
for flag in COMPILE_FLAGS[v]:
|
for flag in COMPILE_FLAGS[v]:
|
||||||
if flag == "-isystem":
|
if flag == "-isystem":
|
||||||
flags.append("".join(COMPILE_FLAGS[v][idx : idx + 2]))
|
flags.append("".join(COMPILE_FLAGS[v][idx : idx + 2]))
|
||||||
elif flag.startswith(("-m", "-I", "-isystem", "--sysroot=")) or flag == "-fPIC":
|
elif flag.startswith(("-m", "-I", "-isystem")) or flag == "-fPIC":
|
||||||
flags.append(flag)
|
flags.append(flag)
|
||||||
idx += 1
|
idx += 1
|
||||||
COMPILE_FLAGS[v] = flags
|
COMPILE_FLAGS[v] = flags
|
||||||
|
@ -56,6 +56,10 @@ class BaseCompileChecks(unittest.TestCase):
|
|||||||
def extra_toolchain_flags():
|
def extra_toolchain_flags():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@depends(when=True)
|
||||||
|
def stlport_cppflags():
|
||||||
|
return []
|
||||||
|
|
||||||
@depends(when=True)
|
@depends(when=True)
|
||||||
def linker_ldflags():
|
def linker_ldflags():
|
||||||
return []
|
return []
|
||||||
|
@ -29,11 +29,29 @@ x86_64-apple-darwin)
|
|||||||
arch=x86_64
|
arch=x86_64
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.12
|
export MACOSX_DEPLOYMENT_TARGET=10.12
|
||||||
;;
|
;;
|
||||||
armv7-linux-android|i686-linux-android)
|
armv7-linux-android)
|
||||||
api_level=16
|
api_level=16
|
||||||
|
ndk_target=arm-linux-androideabi
|
||||||
|
ndk_prefix=arm-linux-androideabi
|
||||||
|
ndk_arch=arm
|
||||||
;;
|
;;
|
||||||
aarch64-linux-android|x86_64-linux-android)
|
aarch64-linux-android)
|
||||||
api_level=21
|
api_level=21
|
||||||
|
ndk_target=aarch64-linux-android
|
||||||
|
ndk_prefix=aarch64-linux-android
|
||||||
|
ndk_arch=arm64
|
||||||
|
;;
|
||||||
|
i686-linux-android)
|
||||||
|
api_level=16
|
||||||
|
ndk_target=i686-linux-android
|
||||||
|
ndk_prefix=x86
|
||||||
|
ndk_arch=x86
|
||||||
|
;;
|
||||||
|
x86_64-linux-android)
|
||||||
|
api_level=21
|
||||||
|
ndk_target=x86_64-linux-android
|
||||||
|
ndk_prefix=x86_64
|
||||||
|
ndk_arch=x86_64
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -67,18 +85,25 @@ case "$target" in
|
|||||||
PATH="$PATH:$PWD"
|
PATH="$PATH:$PWD"
|
||||||
;;
|
;;
|
||||||
*-linux-android)
|
*-linux-android)
|
||||||
target=$target$api_level
|
cflags="
|
||||||
# These flags are only necessary to pass the cmake tests. They don't end up
|
--gcc-toolchain=$MOZ_FETCHES_DIR/android-ndk/toolchains/$ndk_prefix-4.9/prebuilt/linux-x86_64
|
||||||
# actually using libgcc, so use an empty library instead of trying to find
|
-isystem $MOZ_FETCHES_DIR/android-ndk/sysroot/usr/include/$ndk_target
|
||||||
# where it is in the NDK.
|
-isystem $MOZ_FETCHES_DIR/android-ndk/sysroot/usr/include
|
||||||
if [ "$what" = "compiler-rt" ]; then
|
-D__ANDROID_API__=$api_level
|
||||||
exe_linker_flags="--rtlib=libgcc -L$PWD"
|
"
|
||||||
touch libgcc.a
|
# These flags are only necessary to pass the cmake tests.
|
||||||
fi
|
exe_linker_flags="
|
||||||
|
--rtlib=libgcc
|
||||||
|
-L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target/$api_level
|
||||||
|
-L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target
|
||||||
|
"
|
||||||
EXTRA_CMAKE_FLAGS="
|
EXTRA_CMAKE_FLAGS="
|
||||||
$EXTRA_CMAKE_FLAGS
|
$EXTRA_CMAKE_FLAGS
|
||||||
-DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
|
-DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/android-ndk/platforms/android-$api_level/arch-$ndk_arch
|
||||||
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/ld.lld
|
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/ld.lld
|
||||||
|
-DCMAKE_C_FLAGS='-fPIC $cflags'
|
||||||
|
-DCMAKE_ASM_FLAGS='$cflags'
|
||||||
|
-DCMAKE_CXX_FLAGS='-fPIC -Qunused-arguments $cflags'
|
||||||
-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld $exe_linker_flags'
|
-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld $exe_linker_flags'
|
||||||
-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld
|
-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld
|
||||||
-DANDROID=1
|
-DANDROID=1
|
||||||
|
Loading…
Reference in New Issue
Block a user