blob: 608afb7fdd84e101e3bcc160db695a88baec4437 [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,
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070076
Elliott Hughes55fd2932017-05-28 22:59:04 -070077 defaults: [
78 "libziparchive_defaults",
79 "libziparchive_flags",
80 ],
81 shared_libs: [
82 "liblog",
83 "libbase",
Dan Willemsen5cfa0062017-09-27 16:24:45 -070084 "libz",
Elliott Hughes55fd2932017-05-28 22:59:04 -070085 ],
Colin Cross45566ba2016-07-12 18:45:19 -070086 target: {
Dan Willemsenab34b472016-11-29 13:32:55 -080087 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080088 enabled: true,
89 },
Colin Cross45566ba2016-07-12 18:45:19 -070090 },
91}
92
Colin Cross45566ba2016-07-12 18:45:19 -070093// Tests.
94cc_test {
95 name: "ziparchive-tests",
96 host_supported: true,
97 defaults: ["libziparchive_flags"],
98
Elliott Hughesbde0ec92018-04-25 12:49:19 -070099 data: [
100 "testdata/**/*",
101 ],
102
Colin Cross45566ba2016-07-12 18:45:19 -0700103 srcs: [
104 "entry_name_utils_test.cc",
105 "zip_archive_test.cc",
106 "zip_writer_test.cc",
107 ],
108 shared_libs: [
109 "libbase",
110 "liblog",
111 ],
112
113 static_libs: [
114 "libziparchive",
115 "libz",
116 "libutils",
117 ],
118
119 target: {
120 host: {
121 cppflags: ["-Wno-unnamed-type-template-args"],
122 },
123 windows: {
124 enabled: true,
125 },
126 },
127}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500128
129// Performance benchmarks.
130cc_benchmark {
131 name: "ziparchive-benchmarks",
132 defaults: ["libziparchive_flags"],
133
134 srcs: [
135 "zip_archive_benchmark.cpp",
136 ],
137 shared_libs: [
138 "libbase",
139 "liblog",
140 ],
141
142 static_libs: [
143 "libziparchive",
144 "libz",
145 "libutils",
146 ],
147
148 target: {
149 host: {
150 cppflags: ["-Wno-unnamed-type-template-args"],
151 },
152 },
153}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700154
155cc_binary {
156 name: "unzip",
157 defaults: ["libziparchive_flags"],
158 srcs: ["unzip.cpp"],
159 shared_libs: [
160 "libbase",
161 "libziparchive",
162 ],
Elliott Hughesab089332018-09-04 13:33:30 -0700163 recovery_available: true,
Elliott Hughes55fd2932017-05-28 22:59:04 -0700164}