Revert "Link compression libs statically into libartbase and use those everywhere."

This reverts commit 8a94003e66f337fe84870ff68d3f6f234555cf06.

Reason for revert: Breaks asan and dex2oats.

Change-Id: Idea760bbd2b25078ecd1ee5a39da94f6b74432a7
bug: 118374951
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 8e4e383..c2f8e3c 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -180,6 +180,7 @@
     shared_libs: [
         "libbase",
         "libcutils",  // for atrace.
+        "liblzma",
     ],
     include_dirs: ["art/disassembler"],
     header_libs: [
@@ -195,6 +196,7 @@
     static_libs: [
         "libbase",
         "libcutils",
+        "liblzma",
     ],
 }
 
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index 2f8275e..666db42 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -71,6 +71,8 @@
     generated_sources: ["art_dex2oat_operator_srcs"],
     shared_libs: [
         "libbase",
+        "liblz4",
+        "liblzma",
     ],
     include_dirs: [
         "external/lz4/lib",
@@ -96,6 +98,8 @@
     },
     static_libs: [
         "libbase",
+        "liblz4",
+        "liblzma",
     ],
 }
 
@@ -243,6 +247,7 @@
         "libdexfile",
         "libartbase",
         "libbase",
+        "liblz4",
         "libsigchain",
     ],
     static_libs: [
@@ -280,6 +285,7 @@
         "libdexfiled",
         "libartbased",
         "libbase",
+        "liblz4",
         "libsigchain",
     ],
     static_libs: [
@@ -309,6 +315,7 @@
     ],
     static_libs: [
         "libbase",
+        "liblz4",
         "libsigchain_dummy",
     ],
 }
@@ -404,12 +411,13 @@
         "external/zlib",
     ],
     shared_libs: [
-        "libartbased",
+        "libprofiled",
         "libartd-compiler",
         "libartd-dexlayout",
         "libbase",
-        "libprofiled",
+        "liblz4",
         "libsigchain",
+        "libziparchive",
     ],
     static_libs: [
         "libartd-dex2oat",
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index 06e949c..24ee5f8 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -29,12 +29,14 @@
     shared_libs: [
         "libbase",
     ],
+    static_libs: ["libz"],
 }
 
 cc_defaults {
     name: "libart-dexlayout_static_base_defaults",
     static_libs: [
         "libbase",
+        "libz",
     ],
 }
 
diff --git a/imgdiag/Android.bp b/imgdiag/Android.bp
index 51add1a..972c8f7 100644
--- a/imgdiag/Android.bp
+++ b/imgdiag/Android.bp
@@ -34,6 +34,9 @@
         android: {
             shared_libs: ["libcutils"],
         },
+        host: {
+            shared_libs: ["libziparchive"],
+        },
     },
     header_libs: [
         "art_cmdlineparser_headers",
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index 44b75e6..0c6b1a2 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -49,15 +49,20 @@
     ],
     target: {
         android: {
+            static_libs: [
+                // ZipArchive support, the order matters here to get all symbols.
+                "libziparchive",
+                "libz",
+            ],
 	    shared_libs: [
 	        // For android::FileMap used by libziparchive.
                 "libutils",
 	    ],
         },
         host: {
-            static_libs: [
-                // For android::FileMap used by libziparchive.
-                "libutils",
+            shared_libs: [
+                "libziparchive",
+                "libz",
             ],
         },
     },
@@ -70,18 +75,6 @@
         // For common macros.
         "libbase",
     ],
-
-    // Utilities used by various ART libs and tools are linked in statically
-    // here to avoid shared lib dependencies outside the ART APEX. No target
-    // there should depend on these separately.
-    whole_static_libs: [
-        "liblz4",
-        "liblzma",
-        // ZipArchive support, the order matters here to get all symbols.
-        "libziparchive",
-        "libz",
-    ],
-
     export_include_dirs: ["."],
     // ART's macros.h depends on libbase's macros.h.
     // Note: runtime_options.h depends on cmdline. But we don't really want to export this
@@ -96,6 +89,8 @@
         "libcutils",
         "liblog",
         "libutils",
+        "libz",
+        "libziparchive",
     ],
 }
 
@@ -134,6 +129,7 @@
     },
     shared_libs: [
         "libbase",
+        "libziparchive",
     ],
     export_shared_lib_headers: ["libbase"],
 }
@@ -144,6 +140,11 @@
         "art_debug_defaults",
         "libartbase_defaults",
     ],
+    shared_libs: [
+        "libbase",
+        "libziparchive",
+    ],
+    export_shared_lib_headers: ["libbase"],
 }
 
 art_cc_library {
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index d7399b3..49b1278 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -39,10 +39,20 @@
 
     target: {
         android: {
+            static_libs: [
+                "libziparchive",
+                "libz",
+            ],
             shared_libs: [
                 "libutils",
             ],
         },
+        host: {
+            shared_libs: [
+                "libziparchive",
+                "libz",
+            ],
+        },
     },
     generated_sources: ["dexfile_operator_srcs"],
     shared_libs: [
@@ -53,6 +63,7 @@
         "libcutils",
         // For common macros.
         "libbase",
+        "libz",
     ],
     export_include_dirs: ["."],
     export_shared_lib_headers: [
@@ -68,6 +79,8 @@
         "libcutils",
         "liblog",
         "libutils",
+        "libz",
+        "libziparchive",
     ],
 }
 
@@ -145,6 +158,7 @@
     ],
     shared_libs: [
         "libbacktrace",
+        "libziparchive",
     ],
     include_dirs: [
         "external/zlib",
diff --git a/libprofile/Android.bp b/libprofile/Android.bp
index 0f8db9c..edd9fa8 100644
--- a/libprofile/Android.bp
+++ b/libprofile/Android.bp
@@ -23,17 +23,27 @@
     ],
     target: {
         android: {
+            static_libs: [
+                // ZipArchive support, the order matters here to get all symbols.
+                "libziparchive",
+                "libz",
+            ],
 	    shared_libs: [
 	        // For android::FileMap used by libziparchive.
                 "libutils",
 	    ],
         },
+        host: {
+            shared_libs: [
+                "libziparchive",
+                "libz",
+            ],
+        },
     },
     //generated_sources: ["art_libartbase_operator_srcs"],
     cflags: ["-DBUILDING_LIBART=1"],
     shared_libs: [
         "libartbase",
-        "libbase",
         "libdexfile",
         "libartbase",
 	// For atrace.
@@ -52,6 +62,8 @@
         "libbase",
         "libcutils",
         "libutils",
+        "libz",
+        "libziparchive",
     ],
 }
 
@@ -85,7 +97,9 @@
     },
     shared_libs: [
         "libbase",
+        "libziparchive",
     ],
+    export_shared_lib_headers: ["libbase"],
 }
 
 art_cc_library {
@@ -96,7 +110,9 @@
     ],
     shared_libs: [
         "libbase",
+        "libziparchive",
     ],
+    export_shared_lib_headers: ["libbase"],
 }
 
 // For now many of these tests still use CommonRuntimeTest, almost universally because of
@@ -114,5 +130,6 @@
         "libartbased",
         "libdexfiled",
         "libartbased",
+        "libziparchive",
     ],
 }
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 5402736..86ee952 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -341,6 +341,9 @@
             shared_libs: [
                 "libtombstoned_client",
             ],
+            static_libs: [
+                "libz",  // For adler32.
+            ],
         },
         android_arm: {
             ldflags: JIT_DEBUG_REGISTER_CODE_LDFLAGS,
@@ -360,6 +363,9 @@
                 "runtime_linux.cc",
                 "thread_linux.cc",
             ],
+            shared_libs: [
+                "libz",  // For adler32.
+            ],
         },
     },
     cflags: ["-DBUILDING_LIBART=1"],
@@ -384,6 +390,7 @@
         "libnativebridge",
         "libnativeloader",
         "libbacktrace",
+        "liblz4",
         "liblog",
         // For atrace, properties, ashmem, set_sched_policy.
         "libcutils",
@@ -415,9 +422,12 @@
         "libbase",
         "libcutils",
         "liblog",
+        "liblz4",
+        "liblzma",
         "libnativebridge",
         "libnativeloader",
         "libunwindstack",
+        "libz",
     ],
 }
 
diff --git a/test/Android.bp b/test/Android.bp
index b729b0d..561f95e 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -70,6 +70,7 @@
         "libicuuc",
         "libicui18n",
         "libnativehelper",
+        "libz",
     ],
     whole_static_libs: [
         "libsigchain",
@@ -92,6 +93,11 @@
                 "-Wno-missing-noreturn",
             ],
         },
+        host: {
+            shared_libs: [
+                "libziparchive",
+            ],
+        },
         android: {
             shared_libs: [
                 "liblog",
@@ -319,6 +325,7 @@
         // "1952-pop-frame-jit/pop_frame.cc",
     ],
     static_libs: [
+        "libz",
         "slicer",
     ],
 }
@@ -361,6 +368,9 @@
     static_libs: [
         "libbase_ndk",
     ],
+    shared_libs: [
+        "libz",  // for slicer (using adler32).
+    ],
     sdk_version: "current",
     stl: "c++_static",
     include_dirs: [
diff --git a/tools/veridex/Android.bp b/tools/veridex/Android.bp
index f0d83a8..92ace03 100644
--- a/tools/veridex/Android.bp
+++ b/tools/veridex/Android.bp
@@ -31,6 +31,8 @@
         "libbase",
         "liblog",
         "libutils",
+        "libz",
+        "libziparchive",
     ],
     stl: "libc++_static",
     header_libs: [