blob: 9538bba1022a9100b306be57354583b243cef8cb [file] [log] [blame]
Colin Cross45566ba2016-07-12 18:45:19 -07001//
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
16cc_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 Poetzsch3081c5e2016-12-20 16:13:41 +000023 "-D_FILE_OFFSET_BITS=64",
Colin Cross45566ba2016-07-12 18:45:19 -070024 ],
25 cppflags: [
Colin Cross45566ba2016-07-12 18:45:19 -070026 // 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 Nainar53f59452018-09-18 14:58:17 -070030
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 Cross45566ba2016-07-12 18:45:19 -070041}
42
43cc_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 Gampea10a7e72017-07-05 22:02:54 -070063
64 export_include_dirs: ["include"],
Colin Cross45566ba2016-07-12 18:45:19 -070065}
66
Colin Cross45566ba2016-07-12 18:45:19 -070067cc_library {
68 name: "libziparchive",
69 host_supported: true,
Elliott Hughes55fd2932017-05-28 22:59:04 -070070 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090071 recovery_available: true,
Justin Yun096114d2017-08-03 15:51:33 +090072 vndk: {
73 enabled: true,
74 },
Jiyong Park91687872018-04-09 12:20:48 +090075 double_loadable: true,
Elliott Hughesa56a7292018-10-26 10:34:53 -070076 export_shared_lib_headers: ["libbase"],
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070077
Elliott Hughes55fd2932017-05-28 22:59:04 -070078 defaults: [
79 "libziparchive_defaults",
80 "libziparchive_flags",
81 ],
82 shared_libs: [
83 "liblog",
84 "libbase",
Dan Willemsen5cfa0062017-09-27 16:24:45 -070085 "libz",
Elliott Hughes55fd2932017-05-28 22:59:04 -070086 ],
Colin Cross45566ba2016-07-12 18:45:19 -070087 target: {
Dan Willemsenab34b472016-11-29 13:32:55 -080088 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080089 enabled: true,
90 },
Colin Cross45566ba2016-07-12 18:45:19 -070091 },
92}
93
Colin Cross45566ba2016-07-12 18:45:19 -070094// Tests.
95cc_test {
96 name: "ziparchive-tests",
97 host_supported: true,
98 defaults: ["libziparchive_flags"],
99
Elliott Hughesbde0ec92018-04-25 12:49:19 -0700100 data: [
101 "testdata/**/*",
102 ],
103
Colin Cross45566ba2016-07-12 18:45:19 -0700104 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 Hughese038f492018-10-29 12:29:34 -0700128 test_suites: ["device-tests"],
Colin Cross45566ba2016-07-12 18:45:19 -0700129}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500130
131// Performance benchmarks.
132cc_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 Hughes55fd2932017-05-28 22:59:04 -0700156
157cc_binary {
158 name: "unzip",
159 defaults: ["libziparchive_flags"],
160 srcs: ["unzip.cpp"],
161 shared_libs: [
162 "libbase",
163 "libziparchive",
164 ],
Elliott Hughesab089332018-09-04 13:33:30 -0700165 recovery_available: true,
Elliott Hughes55fd2932017-05-28 22:59:04 -0700166}