| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 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", | 
| Christian Poetzsch | 3081c5e | 2016-12-20 16:13:41 +0000 | [diff] [blame] | 23 |         "-D_FILE_OFFSET_BITS=64", | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 24 |     ], | 
 | 25 |     cppflags: [ | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 26 |         // Incorrectly warns when C++11 empty brace {} initializer is used. | 
 | 27 |         // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489 | 
 | 28 |         "-Wno-missing-field-initializers", | 
 | 29 |     ], | 
| Pirama Arumuga Nainar | 53f5945 | 2018-09-18 14:58:17 -0700 | [diff] [blame] | 30 |  | 
 | 31 |     // Enable -Wold-style-cast only for non-Windows targets.  _islower_l, | 
 | 32 |     // _isupper_l etc. in MinGW locale_win32.h (included from | 
 | 33 |     // libcxx/include/__locale) has an old-style-cast. | 
 | 34 |     target: { | 
 | 35 |         not_windows: { | 
 | 36 |             cppflags: [ | 
 | 37 |                 "-Wold-style-cast", | 
 | 38 |             ], | 
 | 39 |         }, | 
 | 40 |     }, | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 41 | } | 
 | 42 |  | 
 | 43 | cc_defaults { | 
 | 44 |     name: "libziparchive_defaults", | 
 | 45 |     srcs: [ | 
 | 46 |         "zip_archive.cc", | 
 | 47 |         "zip_archive_stream_entry.cc", | 
 | 48 |         "zip_writer.cc", | 
 | 49 |     ], | 
 | 50 |  | 
 | 51 |     target: { | 
 | 52 |         windows: { | 
 | 53 |             cflags: ["-mno-ms-bitfields"], | 
 | 54 |  | 
 | 55 |             enabled: true, | 
 | 56 |         }, | 
 | 57 |     }, | 
 | 58 |  | 
 | 59 |     shared_libs: [ | 
 | 60 |         "libbase", | 
 | 61 |         "liblog", | 
 | 62 |     ], | 
| Andreas Gampe | a10a7e7 | 2017-07-05 22:02:54 -0700 | [diff] [blame] | 63 |  | 
 | 64 |     export_include_dirs: ["include"], | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 65 | } | 
 | 66 |  | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 67 | cc_library { | 
 | 68 |     name: "libziparchive", | 
 | 69 |     host_supported: true, | 
| Elliott Hughes | 55fd293 | 2017-05-28 22:59:04 -0700 | [diff] [blame] | 70 |     vendor_available: true, | 
| Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 71 |     recovery_available: true, | 
| Justin Yun | 096114d | 2017-08-03 15:51:33 +0900 | [diff] [blame] | 72 |     vndk: { | 
 | 73 |         enabled: true, | 
 | 74 |     }, | 
| Jiyong Park | 9168787 | 2018-04-09 12:20:48 +0900 | [diff] [blame] | 75 |     double_loadable: true, | 
| Elliott Hughes | a56a729 | 2018-10-26 10:34:53 -0700 | [diff] [blame] | 76 |     export_shared_lib_headers: ["libbase"], | 
| Jayant Chowdhary | 2c87bcc | 2017-05-16 13:09:54 -0700 | [diff] [blame] | 77 |  | 
| Elliott Hughes | 55fd293 | 2017-05-28 22:59:04 -0700 | [diff] [blame] | 78 |     defaults: [ | 
 | 79 |         "libziparchive_defaults", | 
 | 80 |         "libziparchive_flags", | 
 | 81 |     ], | 
 | 82 |     shared_libs: [ | 
 | 83 |         "liblog", | 
 | 84 |         "libbase", | 
| Dan Willemsen | 5cfa006 | 2017-09-27 16:24:45 -0700 | [diff] [blame] | 85 |         "libz", | 
| Elliott Hughes | 55fd293 | 2017-05-28 22:59:04 -0700 | [diff] [blame] | 86 |     ], | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 87 |     target: { | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 88 |         linux_bionic: { | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 89 |             enabled: true, | 
 | 90 |         }, | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 91 |     }, | 
 | 92 | } | 
 | 93 |  | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 94 | // Tests. | 
 | 95 | cc_test { | 
 | 96 |     name: "ziparchive-tests", | 
 | 97 |     host_supported: true, | 
 | 98 |     defaults: ["libziparchive_flags"], | 
 | 99 |  | 
| Elliott Hughes | bde0ec9 | 2018-04-25 12:49:19 -0700 | [diff] [blame] | 100 |     data: [ | 
 | 101 |         "testdata/**/*", | 
 | 102 |     ], | 
 | 103 |  | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 104 |     srcs: [ | 
 | 105 |         "entry_name_utils_test.cc", | 
 | 106 |         "zip_archive_test.cc", | 
 | 107 |         "zip_writer_test.cc", | 
 | 108 |     ], | 
 | 109 |     shared_libs: [ | 
 | 110 |         "libbase", | 
 | 111 |         "liblog", | 
 | 112 |     ], | 
 | 113 |  | 
 | 114 |     static_libs: [ | 
 | 115 |         "libziparchive", | 
 | 116 |         "libz", | 
 | 117 |         "libutils", | 
 | 118 |     ], | 
 | 119 |  | 
 | 120 |     target: { | 
 | 121 |         host: { | 
 | 122 |             cppflags: ["-Wno-unnamed-type-template-args"], | 
 | 123 |         }, | 
 | 124 |         windows: { | 
 | 125 |             enabled: true, | 
 | 126 |         }, | 
 | 127 |     }, | 
| Elliott Hughes | e038f49 | 2018-10-29 12:29:34 -0700 | [diff] [blame] | 128 |     test_suites: ["device-tests"], | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 129 | } | 
| Sebastian Pop | 0a94c56 | 2017-05-30 09:14:20 -0500 | [diff] [blame] | 130 |  | 
 | 131 | // Performance benchmarks. | 
 | 132 | cc_benchmark { | 
 | 133 |     name: "ziparchive-benchmarks", | 
 | 134 |     defaults: ["libziparchive_flags"], | 
 | 135 |  | 
 | 136 |     srcs: [ | 
 | 137 |         "zip_archive_benchmark.cpp", | 
 | 138 |     ], | 
 | 139 |     shared_libs: [ | 
 | 140 |         "libbase", | 
 | 141 |         "liblog", | 
 | 142 |     ], | 
 | 143 |  | 
 | 144 |     static_libs: [ | 
 | 145 |         "libziparchive", | 
 | 146 |         "libz", | 
 | 147 |         "libutils", | 
 | 148 |     ], | 
 | 149 |  | 
 | 150 |     target: { | 
 | 151 |         host: { | 
 | 152 |             cppflags: ["-Wno-unnamed-type-template-args"], | 
 | 153 |         }, | 
 | 154 |     }, | 
 | 155 | } | 
| Elliott Hughes | 55fd293 | 2017-05-28 22:59:04 -0700 | [diff] [blame] | 156 |  | 
 | 157 | cc_binary { | 
 | 158 |     name: "unzip", | 
 | 159 |     defaults: ["libziparchive_flags"], | 
 | 160 |     srcs: ["unzip.cpp"], | 
 | 161 |     shared_libs: [ | 
 | 162 |         "libbase", | 
 | 163 |         "libziparchive", | 
 | 164 |     ], | 
| Elliott Hughes | ab08933 | 2018-09-04 13:33:30 -0700 | [diff] [blame] | 165 |     recovery_available: true, | 
| Elliott Hughes | 55fd293 | 2017-05-28 22:59:04 -0700 | [diff] [blame] | 166 | } |