diff options
author | Dan Albert <danalbert@google.com> | 2022-04-19 23:52:27 +0000 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2022-04-19 23:58:36 +0000 |
commit | b414fe679a70a1823de0596cd7fbcbf4c40abbc6 (patch) | |
tree | 6e39ada1ddc93ab1f5f67a5358bdd6d952c2aff8 | |
parent | 3d47783efb767c5406acbbbb03fe1dc656694fe1 (diff) | |
download | ndk-b414fe679a70a1823de0596cd7fbcbf4c40abbc6.tar.gz |
Relocate libc++ libraries to keep Soong happy.
These were removed from sources/ in the NDK because they're duplicate
bloat. Rather than fixing up Soong to handle this, just relocate them
to the place Soong expects them. This directory should be gone soon
anyway.
Bug: None
Test: None
Change-Id: I2ae26513bfbda2f0b206ea24a8a8904ee85de5d8
-rwxr-xr-x | update.py | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -89,6 +89,13 @@ def remove_old_release(install_dir: Path) -> None: LIBUNWIND_GLOB = "toolchains/llvm/prebuilt/*/lib64/clang/*/lib/linux/*/libunwind.a" +LIBCXX_SHARED_GLOB = ( + "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++_shared.so" +) +LIBCXX_STATIC_GLOB = ( + "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++_static.a" +) +LIBCXXABI_GLOB = "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++abi.a" def unzip_single_directory(artifact: Path, destination: Path) -> None: @@ -106,6 +113,9 @@ def unzip_single_directory(artifact: Path, destination: Path) -> None: "*/sources/cxx-stl/*", "*/source.properties", os.path.join("*", LIBUNWIND_GLOB), + os.path.join("*", LIBCXX_SHARED_GLOB), + os.path.join("*", LIBCXX_STATIC_GLOB), + os.path.join("*", LIBCXXABI_GLOB), ] check_call(cmd) @@ -116,6 +126,32 @@ def unzip_single_directory(artifact: Path, destination: Path) -> None: child.rename(destination / child.name) +def relocate_libcxx(install_dir: Path) -> None: + """Copies the libc++ libraries from the toolchain to sources. + + New versions of the NDK have removed the libraries in the sources directory because + they are duplicates and they aren't needed in typical builds. Soong still expects to + find them in that directory though. We could fix Soong, but since this whole + directory should be dead soon we'll just fix-up the install for now. + """ + dest_base = install_dir / "sources/cxx-stl/llvm-libc++/libs" + for glob in {LIBCXX_SHARED_GLOB, LIBCXX_STATIC_GLOB, LIBCXXABI_GLOB}: + file_name = Path(glob).name + for file_path in install_dir.glob(glob): + triple = file_path.parent.name + abi = { + "arm-linux-androideabi": "armeabi-v7a", + "aarch64-linux-android": "arm64-v8a", + "i686-linux-android": "x86", + "x86_64-linux-android": "x86_64", + }[triple] + dest_dir = dest_base / abi + dest_dir.mkdir(parents=True, exist_ok=True) + dest = dest_dir / file_name + logger().info("Relocating %s to %s", file_path, dest) + file_path.rename(dest) + + def relocate_libunwind(install_dir: Path) -> None: dest_base = install_dir / "sources/cxx-stl/llvm-libc++/libs" for libunwind in install_dir.glob(LIBUNWIND_GLOB): @@ -152,6 +188,7 @@ def install_new_release(branch: str, build: str, install_dir: Path) -> None: logger().info("Extracting release") unzip_single_directory(artifact, install_dir) + relocate_libcxx(install_dir) relocate_libunwind(install_dir) delete_android_mks(install_dir) finally: |