1 cc_defaults { 2 name: "zlib_defaults", 3 4 cflags: [ 5 "-O3", 6 "-DUSE_MMAP", 7 "-DZLIB_CONST", 8 ], 9 stl: "none", 10 export_include_dirs: ["."], 11 srcs: [ 12 "src/adler32.c", 13 "src/compress.c", 14 "src/crc32.c", 15 "src/deflate.c", 16 "src/gzclose.c", 17 "src/gzlib.c", 18 "src/gzread.c", 19 "src/gzwrite.c", 20 "src/infback.c", 21 "src/inflate.c", 22 "src/inftrees.c", 23 "src/inffast.c", 24 "src/trees.c", 25 "src/uncompr.c", 26 "src/zutil.c", 27 ], 28 29 arch: { 30 arm: { 31 // measurements show that the ARM version of ZLib is about x1.17 faster 32 // than the thumb one... 33 instruction_set: "arm", 34 35 // TODO: This is to work around b/24465209. Remove after root cause is fixed 36 ldflags: ["-Wl,--hash-style=both"], 37 }, 38 }, 39 40 target: { 41 linux_bionic: { 42 enabled: true, 43 }, 44 windows: { 45 enabled: true, 46 }, 47 }, 48 } 49 50 cc_library { 51 name: "libz", 52 defaults: ["zlib_defaults"], 53 54 host_supported: true, 55 vendor_available : true, 56 57 target: { 58 host: { 59 shared: { 60 // The host shared library is built as libz-host 61 enabled: false, 62 }, 63 }, 64 }, 65 } 66 67 // Separate host shared library definition, since we don't want to conflict 68 // with the host-supplied libz 69 cc_library_host_shared { 70 name: "libz-host", 71 defaults: ["zlib_defaults"], 72 } 73 74 cc_binary { 75 name: "gzip", 76 srcs: ["src/test/minigzip.c"], 77 shared_libs: ["libz"], 78 stl: "none", 79 } 80 81 cc_binary_host { 82 name: "minigzip", 83 srcs: ["src/test/minigzip.c"], 84 static_libs: ["libz"], 85 stl: "none", 86 } 87 88 cc_binary { 89 name: "zlib_example", 90 srcs: ["src/test/example.c"], 91 shared_libs: ["libz"], 92 stl: "none", 93 } 94 95 cc_binary_host { 96 name: "zlib_example_host", 97 srcs: ["src/test/example.c"], 98 static_libs: ["libz"], 99 stl: "none", 100 } 101 102 // This module is defined in development/ndk/Android.bp. Updating these headers 103 // to be usable for any API level is going to be some work (at the very least, 104 // there's a ZLIB_VERNUM that will need to be handled since early versions of 105 // Android did not have all the APIs that calling code will use if this is set 106 // to the current value. 107 // 108 // The NDK never updated the zlib headers when the platform updated, so until we 109 // solve this the NDK will continue shipping the old headers. 110 // 111 // ndk_headers { 112 // name: "libz_headers", 113 // from: "src", 114 // to: "", 115 // srcs: [ 116 // "src/zconf.h", 117 // "src/zlib.h", 118 // ], 119 // license: "NOTICE", 120 // } 121 122 ndk_library { 123 name: "libz", 124 symbol_file: "libz.map.txt", 125 first_version: "9", 126 unversioned_until: "current", 127 } 128