Export libc++ headers for musl sysroot am: bdf5fe7af5 am: 0b1ac82ded am: 08d4831267

Original change: https://android-review.googlesource.com/c/platform/external/libcxx/+/2000213

Change-Id: I89ce32c8e22277f6f9d4db841058e4bdc75fb065
diff --git a/Android.bp b/Android.bp
index 2fd04d3..4b01aa2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -294,3 +294,32 @@
         },
     },
 }
+
+// Export libc++ headers for inclusion in the musl sysroot.
+genrule {
+    name: "libc_musl_sysroot_libc++_headers",
+    visibility: ["//external/musl"],
+    srcs: [
+        "NOTICE",
+        "include/**/*",
+    ],
+    out: ["libc_musl_sysroot_libc++_headers.zip"],
+    tools: [
+        "soong_zip",
+        "zip2zip",
+    ],
+    cmd: "LIBCXX_DIR=$$(dirname $(location NOTICE)) && " +
+        "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
+        // NOTICE
+        " -j -f $(location NOTICE) " +
+        // headers
+        " -P include/c++ " +
+        "  -C $${LIBCXX_DIR}/include " +
+        "  -D $${LIBCXX_DIR}/include " +
+        " && " +
+        "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(out) " +
+        " -x include/c++/CMakeLists.txt" +
+        " -x include/c++/module.modulemap " +
+        " include/**/*:include " +
+        " NOTICE:NOTICE.libc++",
+}