Export libc++abi headers for musl sysroot
Export the libc++abi headers for inclusion in the musl sysroot so that
the clang runtimes can link against them.
Bug: 215802826
Test: musl llvm build
Change-Id: Ie78cce4c63014c35fb6f1fca308ff4bdf84ec4d7
diff --git a/Android.bp b/Android.bp
index 8d298ab..13951ff 100644
--- a/Android.bp
+++ b/Android.bp
@@ -176,3 +176,30 @@
"src/cxa_demangle.cpp",
],
}
+
+// Export libc++abi headers for inclusion in the musl sysroot.
+genrule {
+ name: "libc_musl_sysroot_libc++abi_headers",
+ visibility: ["//external/musl"],
+ srcs: [
+ "NOTICE",
+ "include/**/*",
+ ],
+ out: ["libc_musl_sysroot_libc++abi_headers.zip"],
+ tools: [
+ "soong_zip",
+ "zip2zip",
+ ],
+ cmd: "LIBCXXABI_DIR=$$(dirname $(location NOTICE)) && " +
+ "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
+ // NOTICE
+ " -j -f $(location NOTICE) " +
+ // headers
+ " -P include/c++ " +
+ " -C $${LIBCXXABI_DIR}/include " +
+ " -D $${LIBCXXABI_DIR}/include " +
+ " && " +
+ "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(out) " +
+ " include/**/*:include " +
+ " NOTICE:NOTICE.libc++abi",
+}