blob: a26de2edc8a8306b50420bb3dfd77af4085d066c [file] [log] [blame]
Dan Albertca7b4152019-06-11 16:32:07 -07001cc_defaults {
2 name: "libz_defaults",
Dan Willemsenc1b393b2016-07-06 19:05:32 -07003
4 cflags: [
Elliott Hughes18e812d2020-02-13 16:31:48 +00005 "-O3",
Elliott Hughes35329cd2019-04-10 14:56:06 -07006 "-DHAVE_HIDDEN",
Tao Bao5604dec2016-12-19 13:29:53 -08007 "-DZLIB_CONST",
Chih-Hung Hsieh3e5deb42017-09-29 11:41:33 -07008 "-Wall",
9 "-Werror",
Elliott Hughese7091dd2019-06-06 12:47:16 -070010 "-Wno-unused",
11 "-Wno-unused-parameter",
Dan Willemsenc1b393b2016-07-06 19:05:32 -070012 ],
13 stl: "none",
14 export_include_dirs: ["."],
15 srcs: [
Elliott Hughese7091dd2019-06-06 12:47:16 -070016 "adler32.c",
17 "compress.c",
Elliott Hughes18e812d2020-02-13 16:31:48 +000018 "cpu_features.c",
Elliott Hughese7091dd2019-06-06 12:47:16 -070019 "crc32.c",
20 "deflate.c",
21 "gzclose.c",
22 "gzlib.c",
23 "gzread.c",
24 "gzwrite.c",
25 "infback.c",
Zhen Zhangfed86a72020-01-16 20:15:30 +000026 "inflate.c",
Elliott Hughese7091dd2019-06-06 12:47:16 -070027 "inftrees.c",
Elliott Hughes18e812d2020-02-13 16:31:48 +000028 "inffast.c",
Elliott Hughese7091dd2019-06-06 12:47:16 -070029 "trees.c",
30 "uncompr.c",
31 "zutil.c",
Dan Willemsenc1b393b2016-07-06 19:05:32 -070032 ],
33
34 arch: {
35 arm: {
Elliott Hughes18e812d2020-02-13 16:31:48 +000036 // 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 Hughese7091dd2019-06-06 12:47:16 -070041 // TODO: This is to work around b/24465209. Remove after root cause
42 // is fixed.
Chih-Hung Hsieh19b536b2018-05-23 18:52:18 -070043 pack_relocations: false,
Ian Pedowitzcca7bd42018-01-18 16:22:54 -080044 ldflags: ["-Wl,--hash-style=both"],
Dan Willemsenc1b393b2016-07-06 19:05:32 -070045 },
46 },
Dan Albertca7b4152019-06-11 16:32:07 -070047}
48
49cc_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 Hongd4b6e522020-01-21 19:28:33 -080062 ramdisk_available: true,
Dan Albertca7b4152019-06-11 16:32:07 -070063 recovery_available: true,
64 native_bridge_supported: true,
Dan Willemsenc1b393b2016-07-06 19:05:32 -070065
66 target: {
Dan Willemsen0bb579c2016-11-04 12:27:30 -070067 linux_bionic: {
68 enabled: true,
69 },
Dan Willemsenc1b393b2016-07-06 19:05:32 -070070 windows: {
71 enabled: true,
72 },
73 },
Jiyong Park2f2a03f2020-04-28 18:23:23 +090074
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 Willemsenc1b393b2016-07-06 19:05:32 -070088}
89
Dan Willemsenc1b393b2016-07-06 19:05:32 -070090cc_binary_host {
91 name: "minigzip",
Elliott Hughese7091dd2019-06-06 12:47:16 -070092 srcs: ["contrib/minigzip/minigzip.c"],
93 cflags: ["-Wall", "-Werror", "-DUSE_MMAP"],
Dan Willemsenc1b393b2016-07-06 19:05:32 -070094 static_libs: ["libz"],
95 stl: "none",
96}
Dan Alberte405a262016-09-15 16:24:19 -070097
Narayan Kamath1a14eb32017-01-06 12:49:24 +000098cc_binary {
Elliott Hughese7091dd2019-06-06 12:47:16 -070099 name: "zlib_bench",
100 srcs: ["contrib/bench/zlib_bench.cc"],
Chih-Hung Hsieh3e5deb42017-09-29 11:41:33 -0700101 cflags: ["-Wall", "-Werror"],
Elliott Hughese7091dd2019-06-06 12:47:16 -0700102 host_supported: true,
Narayan Kamath1a14eb32017-01-06 12:49:24 +0000103 shared_libs: ["libz"],
Narayan Kamath1a14eb32017-01-06 12:49:24 +0000104}
105
Dan Albertb0dca832016-11-08 11:46:09 -0800106// 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 Albertb0dca832016-11-08 11:46:09 -0800122// ],
123// license: "NOTICE",
124// }
Dan Alberte405a262016-09-15 16:24:19 -0700125
Jiyong Parkf644cb82020-05-19 03:40:11 +0000126// 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.
130cc_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 Alberte405a262016-09-15 16:24:19 -0700141ndk_library {
Dan Willemsen67ce3272017-04-07 15:34:26 -0700142 name: "libz",
Dan Alberte405a262016-09-15 16:24:19 -0700143 symbol_file: "libz.map.txt",
144 first_version: "9",
Dan Albert40f22ad2017-01-05 15:55:02 -0800145 unversioned_until: "current",
Dan Alberte405a262016-09-15 16:24:19 -0700146}