[RFCLAT#15] Static link libc++
Static link libc++ can save the apex size 700KiB+ (libc++.so).
before:
$ deapexer extract out/target/product/raven/system/apex/com.google.android.tethering.apex apex_default
$ ls -all out/target/product/raven/system/apex/com.google.android.tethering.apex
-rw-r--r-- 1 nuccachen primarygroup 3719168 Jan 5 18:40 out/target/product/raven/system/apex/com.google.android.tethering.apex
after:
$ deapexer extract out/target/product/raven/system/apex/com.google.android.tethering.apex apex_stl_static
$ ls -all out/target/product/raven/system/apex/com.google.android.tethering.apex
-rw-r--r-- 1 nuccachen primarygroup 2998272 Jan 6 22:50 out/target/product/raven/system/apex/com.google.android.tethering.apex
libc++.so is removed from the apex which uses clatd with static link
libc++:
$ diff -r apex_default/ apex_stl_static/
Only in apex_default/lib64: libc++.so
$ ls -all apex_default/lib64/libc++.so
-rw-r--r-- 1 nuccachen primarygroup 716664 Jan 1 1970 libc++.so
Bug: 212345928
Bug: 213123047
Test: atest clatd_test
Change-Id: I7f71eac09e659355781ecd275fcc70bef262f3d0
diff --git a/Android.bp b/Android.bp
index 4e3c162..3ef0115 100644
--- a/Android.bp
+++ b/Android.bp
@@ -68,6 +68,10 @@
"liblog",
],
+ // Static libc++ for smaller apex size while shipping clatd in the mainline module.
+ // See b/213123047
+ stl: "libc++_static",
+
// Only enable clang-tidy for the daemon, not the tests, because enabling it for the
// tests substantially increases build/compile cycle times and doesn't really provide a
// security benefit.