• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cc_defaults {
2    name: "libz_defaults",
3
4    cflags: [
5        "-O3",
6        "-DHAVE_HIDDEN",
7        "-DZLIB_CONST",
8        "-Wall",
9        "-Werror",
10        "-Wno-unused",
11        "-Wno-unused-parameter",
12    ],
13    stl: "none",
14    export_include_dirs: ["."],
15    srcs: [
16        "adler32.c",
17        "compress.c",
18        "cpu_features.c",
19        "crc32.c",
20        "deflate.c",
21        "gzclose.c",
22        "gzlib.c",
23        "gzread.c",
24        "gzwrite.c",
25        "infback.c",
26        "inflate.c",
27        "inftrees.c",
28        "inffast.c",
29        "trees.c",
30        "uncompr.c",
31        "zutil.c",
32    ],
33
34    arch: {
35        arm: {
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
41            // TODO: This is to work around b/24465209. Remove after root cause
42            // is fixed.
43            pack_relocations: false,
44            ldflags: ["-Wl,--hash-style=both"],
45        },
46    },
47}
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    },
62    ramdisk_available: true,
63    recovery_available: true,
64    native_bridge_supported: true,
65
66    target: {
67        linux_bionic: {
68            enabled: true,
69        },
70        windows: {
71            enabled: true,
72        },
73    },
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    ],
88}
89
90cc_binary_host {
91    name: "minigzip",
92    srcs: ["contrib/minigzip/minigzip.c"],
93    cflags: ["-Wall", "-Werror", "-DUSE_MMAP"],
94    static_libs: ["libz"],
95    stl: "none",
96}
97
98cc_binary {
99    name: "zlib_bench",
100    srcs: ["contrib/bench/zlib_bench.cc"],
101    cflags: ["-Wall", "-Werror"],
102    host_supported: true,
103    shared_libs: ["libz"],
104}
105
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",
122//     ],
123//     license: "NOTICE",
124// }
125
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.
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
141ndk_library {
142    name: "libz",
143    symbol_file: "libz.map.txt",
144    first_version: "9",
145    unversioned_until: "current",
146}
147