Bug 1581971: Part 2 - Add configure support for lldb-server on Android; r=firefox-build-system-reviewers,mhentges

We want to find the full path to the correct `lldb-server` in the NDK.
We reference this variable in a later patch when preparing the device for
debugging.

Differential Revision: https://phabricator.services.mozilla.com/D94380
This commit is contained in:
Aaron Klotz 2021-02-19 21:07:18 +00:00
Родитель 7847613f0d
Коммит 9ed94dd8f0
1 изменённых файлов: 46 добавлений и 0 удалений

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

@ -24,6 +24,10 @@ option(
option("--with-android-toolchain", nargs=1, help="location of the Android toolchain")
option(
"--with-android-lldb-server", nargs=1, help="location of the Android LLDB server"
)
option(
"--with-android-googlevr-sdk", nargs=1, help="location of the Android GoogleVR SDK"
)
@ -248,6 +252,48 @@ def android_toolchain(target, host, ndk, toolchain):
set_config("ANDROID_TOOLCHAIN", android_toolchain)
@depends(target, host, ndk, "--with-android-lldb-server")
@checking("for the Android LLDB server", lambda x: x or "not found")
@imports(_from="os", _import="listdir")
@imports(_from="os.path", _import="isdir")
@imports(_from="os.path", _import="isfile")
@imports(_from="mozbuild.shellutil", _import="quote")
def android_lldb_server(target, host, ndk, lldb):
if not ndk:
return
if lldb:
return lldb[0]
else:
clang_format = "toolchains/llvm/prebuilt/%s-%s/lib64/clang"
llvm_lib = "lib/linux"
host_kernel = "windows" if host.kernel == "WINNT" else host.kernel.lower()
clang_path = os.path.join(ndk, clang_format % (host_kernel, host.cpu))
log.debug("Listing subdirectories of %s" % quote(clang_path))
clang_subdirs = [
x for x in listdir(clang_path) if isdir(os.path.join(clang_path, x))
]
log.debug("Got %r" % clang_subdirs)
if len(clang_subdirs) != 1:
die(
"Could not resolve lldb-server in %s. Please specify --with-android-lldb-server=/path/to/android/lldb-server"
% quote(clang_path)
)
log.debug("Found version %s" % quote(clang_subdirs[0]))
full_path = os.path.join(
clang_path, clang_subdirs[0], llvm_lib, target.cpu, "lldb-server"
)
log.debug("Trying %s" % quote(full_path))
if isfile(full_path):
return full_path
die("Please specify --with-android-lldb-server=/path/to/android/lldb-server")
set_config("ANDROID_LLDB_SERVER", android_lldb_server)
@depends(target)
def android_toolchain_prefix_base(target):
if target.cpu == "x86":