1 // 2 // Copyright (C) 2013 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 cc_defaults { 17 name: "libziparchive_flags", 18 cflags: [ 19 // ZLIB_CONST turns on const for input buffers, which is pretty standard. 20 "-DZLIB_CONST", 21 "-Werror", 22 "-Wall", 23 "-D_FILE_OFFSET_BITS=64", 24 ], 25 cppflags: [ 26 "-Wold-style-cast", 27 // Incorrectly warns when C++11 empty brace {} initializer is used. 28 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489 29 "-Wno-missing-field-initializers", 30 ], 31 } 32 33 cc_defaults { 34 name: "libziparchive_defaults", 35 srcs: [ 36 "zip_archive.cc", 37 "zip_archive_stream_entry.cc", 38 "zip_writer.cc", 39 ], 40 41 target: { 42 windows: { 43 cflags: ["-mno-ms-bitfields"], 44 45 enabled: true, 46 }, 47 }, 48 49 shared_libs: [ 50 "libbase", 51 "liblog", 52 ], 53 54 export_include_dirs: ["include"], 55 } 56 57 cc_library { 58 name: "libziparchive", 59 host_supported: true, 60 vendor_available: true, 61 vndk: { 62 enabled: true, 63 }, 64 65 defaults: [ 66 "libziparchive_defaults", 67 "libziparchive_flags", 68 ], 69 shared_libs: [ 70 "liblog", 71 "libbase", 72 "libz", 73 ], 74 target: { 75 android: { 76 shared_libs: [ 77 "libutils", 78 ], 79 }, 80 host: { 81 static_libs: ["libutils"], 82 }, 83 linux_bionic: { 84 enabled: true, 85 }, 86 }, 87 } 88 89 // Tests. 90 cc_test { 91 name: "ziparchive-tests", 92 host_supported: true, 93 defaults: ["libziparchive_flags"], 94 95 srcs: [ 96 "entry_name_utils_test.cc", 97 "zip_archive_test.cc", 98 "zip_writer_test.cc", 99 ], 100 shared_libs: [ 101 "libbase", 102 "liblog", 103 ], 104 105 static_libs: [ 106 "libziparchive", 107 "libz", 108 "libutils", 109 ], 110 111 target: { 112 host: { 113 cppflags: ["-Wno-unnamed-type-template-args"], 114 }, 115 windows: { 116 enabled: true, 117 }, 118 }, 119 } 120 121 // Performance benchmarks. 122 cc_benchmark { 123 name: "ziparchive-benchmarks", 124 defaults: ["libziparchive_flags"], 125 126 srcs: [ 127 "zip_archive_benchmark.cpp", 128 ], 129 shared_libs: [ 130 "libbase", 131 "liblog", 132 ], 133 134 static_libs: [ 135 "libziparchive", 136 "libz", 137 "libutils", 138 ], 139 140 target: { 141 host: { 142 cppflags: ["-Wno-unnamed-type-template-args"], 143 }, 144 }, 145 } 146 147 cc_binary { 148 name: "unzip", 149 defaults: ["libziparchive_flags"], 150 srcs: ["unzip.cpp"], 151 shared_libs: [ 152 "libbase", 153 "libziparchive", 154 ], 155 } 156