diff options
author | Dan Albert <danalbert@google.com> | 2021-03-19 12:50:04 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2021-03-29 20:22:47 -0700 |
commit | ea7777b588f24e840c6747452f1795a0d9c54989 (patch) | |
tree | 638cbb4c2933cfa1076b26ddd80aa9ec9dcf344d | |
parent | 50dac6796356ccb97d5e5e889a8aa4c163237bcf (diff) | |
download | ndk-ea7777b588f24e840c6747452f1795a0d9c54989.tar.gz |
Preserve libunwind from the NDK.
Test: ./update.py --branch master-ndk --build 7219278 r23
Bug: None
Change-Id: I14b9d12ca226e3be495401aaf9246f06e0d19761
-rwxr-xr-x | update.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -69,6 +69,11 @@ def remove_old_release(install_dir): shutil.rmtree(install_dir) +LIBUNWIND_GLOB = ( + 'toolchains/llvm/prebuilt/*/lib64/clang/*/lib/linux/*/libunwind.a' +) + + def unzip_single_directory(artifact, destination): # Use cwd so that we can use rename without having to worry about crossing # file systems. @@ -83,6 +88,7 @@ def unzip_single_directory(artifact, destination): '*/sources/android/support/*', '*/sources/cxx-stl/*', '*/source.properties', + os.path.join('*', LIBUNWIND_GLOB), ] check_call(cmd) @@ -94,6 +100,23 @@ def unzip_single_directory(artifact, destination): os.path.join(destination, child)) +def relocate_libunwind(install_dir): + unwinds = glob.glob(os.path.join(install_dir, LIBUNWIND_GLOB)) + dest_base = os.path.join(install_dir, 'sources/cxx-stl/llvm-libc++/libs') + for libunwind in unwinds: + arch = os.path.basename(os.path.dirname(libunwind)) + abi = { + 'arm': 'armeabi-v7a', + 'aarch64': 'arm64-v8a', + 'i386': 'x86', + 'x86_64': 'x86_64', + }[arch] + dest_dir = os.path.join(dest_base, abi) + dest = os.path.join(dest_dir, 'libunwind.a') + logger().info('Relocating %s to %s', libunwind, dest) + os.rename(libunwind, dest) + + def install_new_release(branch, build, install_dir): os.makedirs(install_dir) @@ -108,6 +131,7 @@ def install_new_release(branch, build, install_dir): logger().info('Extracting release') unzip_single_directory(artifact, install_dir) + relocate_libunwind(install_dir) finally: for artifact in artifacts: os.unlink(artifact) |