Dan Albert | ca7b415 | 2019-06-11 16:32:07 -0700 | [diff] [blame] | 1 | cc_defaults { |
| 2 | name: "libz_defaults", |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 3 | |
| 4 | cflags: [ |
Elliott Hughes | 18e812d | 2020-02-13 16:31:48 +0000 | [diff] [blame] | 5 | "-O3", |
Elliott Hughes | 35329cd | 2019-04-10 14:56:06 -0700 | [diff] [blame] | 6 | "-DHAVE_HIDDEN", |
Tao Bao | 5604dec | 2016-12-19 13:29:53 -0800 | [diff] [blame] | 7 | "-DZLIB_CONST", |
Chih-Hung Hsieh | 3e5deb4 | 2017-09-29 11:41:33 -0700 | [diff] [blame] | 8 | "-Wall", |
| 9 | "-Werror", |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 10 | "-Wno-unused", |
| 11 | "-Wno-unused-parameter", |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 12 | ], |
| 13 | stl: "none", |
| 14 | export_include_dirs: ["."], |
| 15 | srcs: [ |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 16 | "adler32.c", |
| 17 | "compress.c", |
Elliott Hughes | 18e812d | 2020-02-13 16:31:48 +0000 | [diff] [blame] | 18 | "cpu_features.c", |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 19 | "crc32.c", |
| 20 | "deflate.c", |
| 21 | "gzclose.c", |
| 22 | "gzlib.c", |
| 23 | "gzread.c", |
| 24 | "gzwrite.c", |
| 25 | "infback.c", |
Zhen Zhang | fed86a7 | 2020-01-16 20:15:30 +0000 | [diff] [blame] | 26 | "inflate.c", |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 27 | "inftrees.c", |
Elliott Hughes | 18e812d | 2020-02-13 16:31:48 +0000 | [diff] [blame] | 28 | "inffast.c", |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 29 | "trees.c", |
| 30 | "uncompr.c", |
| 31 | "zutil.c", |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 32 | ], |
| 33 | |
| 34 | arch: { |
| 35 | arm: { |
Elliott Hughes | 18e812d | 2020-02-13 16:31:48 +0000 | [diff] [blame] | 36 | // measurements show that the ARM version of ZLib is about x1.17 faster |
| 37 | // than the thumb one... |
| 38 | // TODO: re-test with zlib_bench after SIMD is enabled. |
| 39 | instruction_set: "arm", |
| 40 | |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 41 | // TODO: This is to work around b/24465209. Remove after root cause |
| 42 | // is fixed. |
Chih-Hung Hsieh | 19b536b | 2018-05-23 18:52:18 -0700 | [diff] [blame] | 43 | pack_relocations: false, |
Ian Pedowitz | cca7bd4 | 2018-01-18 16:22:54 -0800 | [diff] [blame] | 44 | ldflags: ["-Wl,--hash-style=both"], |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 45 | }, |
| 46 | }, |
Dan Albert | ca7b415 | 2019-06-11 16:32:07 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | cc_library { |
| 50 | name: "libz", |
| 51 | defaults: ["libz_defaults"], |
| 52 | |
| 53 | host_supported: true, |
| 54 | unique_host_soname: true, |
| 55 | static_ndk_lib: true, |
| 56 | |
| 57 | vendor_available: true, |
| 58 | vndk: { |
| 59 | enabled: true, |
| 60 | support_system_process: true, |
| 61 | }, |
Yifan Hong | d4b6e52 | 2020-01-21 19:28:33 -0800 | [diff] [blame] | 62 | ramdisk_available: true, |
Dan Albert | ca7b415 | 2019-06-11 16:32:07 -0700 | [diff] [blame] | 63 | recovery_available: true, |
| 64 | native_bridge_supported: true, |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 65 | |
| 66 | target: { |
Dan Willemsen | 0bb579c | 2016-11-04 12:27:30 -0700 | [diff] [blame] | 67 | linux_bionic: { |
| 68 | enabled: true, |
| 69 | }, |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 70 | windows: { |
| 71 | enabled: true, |
| 72 | }, |
| 73 | }, |
Jiyong Park | 2f2a03f | 2020-04-28 18:23:23 +0900 | [diff] [blame] | 74 | |
| 75 | // TODO(b/155456180): make libz a stub-providing library by uncommenting below |
| 76 | // stubs: { |
| 77 | // versions: ["29", "30"], |
| 78 | // symbol_file: "libz.map.txt", |
| 79 | // }, |
| 80 | |
| 81 | apex_available: [ |
| 82 | "//apex_available:platform", |
| 83 | "com.android.art.debug", // from libdexfile |
| 84 | "com.android.art.release", |
| 85 | "com.android.bluetooth.updatable", |
| 86 | "com.android.runtime", |
| 87 | ], |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 88 | } |
| 89 | |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 90 | cc_binary_host { |
| 91 | name: "minigzip", |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 92 | srcs: ["contrib/minigzip/minigzip.c"], |
| 93 | cflags: ["-Wall", "-Werror", "-DUSE_MMAP"], |
Dan Willemsen | c1b393b | 2016-07-06 19:05:32 -0700 | [diff] [blame] | 94 | static_libs: ["libz"], |
| 95 | stl: "none", |
| 96 | } |
Dan Albert | e405a26 | 2016-09-15 16:24:19 -0700 | [diff] [blame] | 97 | |
Narayan Kamath | 1a14eb3 | 2017-01-06 12:49:24 +0000 | [diff] [blame] | 98 | cc_binary { |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 99 | name: "zlib_bench", |
| 100 | srcs: ["contrib/bench/zlib_bench.cc"], |
Chih-Hung Hsieh | 3e5deb4 | 2017-09-29 11:41:33 -0700 | [diff] [blame] | 101 | cflags: ["-Wall", "-Werror"], |
Elliott Hughes | e7091dd | 2019-06-06 12:47:16 -0700 | [diff] [blame] | 102 | host_supported: true, |
Narayan Kamath | 1a14eb3 | 2017-01-06 12:49:24 +0000 | [diff] [blame] | 103 | shared_libs: ["libz"], |
Narayan Kamath | 1a14eb3 | 2017-01-06 12:49:24 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Dan Albert | b0dca83 | 2016-11-08 11:46:09 -0800 | [diff] [blame] | 106 | // This module is defined in development/ndk/Android.bp. Updating these headers |
| 107 | // to be usable for any API level is going to be some work (at the very least, |
| 108 | // there's a ZLIB_VERNUM that will need to be handled since early versions of |
| 109 | // Android did not have all the APIs that calling code will use if this is set |
| 110 | // to the current value. |
| 111 | // |
| 112 | // The NDK never updated the zlib headers when the platform updated, so until we |
| 113 | // solve this the NDK will continue shipping the old headers. |
| 114 | // |
| 115 | // ndk_headers { |
| 116 | // name: "libz_headers", |
| 117 | // from: "src", |
| 118 | // to: "", |
| 119 | // srcs: [ |
| 120 | // "src/zconf.h", |
| 121 | // "src/zlib.h", |
Dan Albert | b0dca83 | 2016-11-08 11:46:09 -0800 | [diff] [blame] | 122 | // ], |
| 123 | // license: "NOTICE", |
| 124 | // } |
Dan Albert | e405a26 | 2016-09-15 16:24:19 -0700 | [diff] [blame] | 125 | |
Jiyong Park | f644cb8 | 2020-05-19 03:40:11 +0000 | [diff] [blame] | 126 | // TODO(b/155351357) remove this library and let libtextclassifier to use libz |
| 127 | // instead. |
| 128 | // libz_current allows modules building against the NDK to have access to zlib |
| 129 | // API that's not available from the NDK libz. |
| 130 | cc_library_static { |
| 131 | name: "libz_current", |
| 132 | defaults: ["libz_defaults"], |
| 133 | sdk_version: "current", |
| 134 | |
| 135 | apex_available: [ |
| 136 | "//apex_available:platform", // indirectly from GoogleExtServices that gets installed to /system |
| 137 | "com.android.extservices", // indirectly via libtextclassifier |
| 138 | ], |
| 139 | } |
| 140 | |
Dan Albert | e405a26 | 2016-09-15 16:24:19 -0700 | [diff] [blame] | 141 | ndk_library { |
Dan Willemsen | 67ce327 | 2017-04-07 15:34:26 -0700 | [diff] [blame] | 142 | name: "libz", |
Dan Albert | e405a26 | 2016-09-15 16:24:19 -0700 | [diff] [blame] | 143 | symbol_file: "libz.map.txt", |
| 144 | first_version: "9", |
Dan Albert | 40f22ad | 2017-01-05 15:55:02 -0800 | [diff] [blame] | 145 | unversioned_until: "current", |
Dan Albert | e405a26 | 2016-09-15 16:24:19 -0700 | [diff] [blame] | 146 | } |