blob: 2606aa9e38234505f1141d67a08f8a97243c8ca3 [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: [
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
33cc_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 ],
Andreas Gampea10a7e72017-07-05 22:02:54 -070053
54 export_include_dirs: ["include"],
Colin Cross45566ba2016-07-12 18:45:19 -070055}
56
Colin Cross45566ba2016-07-12 18:45:19 -070057cc_library {
58 name: "libziparchive",
59 host_supported: true,
Elliott Hughes55fd2932017-05-28 22:59:04 -070060 vendor_available: true,
Jiyong Park011ee122018-05-29 16:41:30 +090061 recovery_available: true,
Justin Yun096114d2017-08-03 15:51:33 +090062 vndk: {
63 enabled: true,
64 },
Jiyong Park91687872018-04-09 12:20:48 +090065 double_loadable: true,
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070066
Elliott Hughes55fd2932017-05-28 22:59:04 -070067 defaults: [
68 "libziparchive_defaults",
69 "libziparchive_flags",
70 ],
71 shared_libs: [
72 "liblog",
73 "libbase",
Dan Willemsen5cfa0062017-09-27 16:24:45 -070074 "libz",
Elliott Hughes55fd2932017-05-28 22:59:04 -070075 ],
Colin Cross45566ba2016-07-12 18:45:19 -070076 target: {
77 android: {
Elliott Hughes55fd2932017-05-28 22:59:04 -070078 shared_libs: [
Elliott Hughes55fd2932017-05-28 22:59:04 -070079 "libutils",
80 ],
Jaekyun Seok86e80b92016-12-21 14:22:00 +090081 },
82 host: {
83 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070084 },
Dan Willemsenab34b472016-11-29 13:32:55 -080085 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080086 enabled: true,
87 },
Colin Cross45566ba2016-07-12 18:45:19 -070088 },
89}
90
Colin Cross45566ba2016-07-12 18:45:19 -070091// Tests.
92cc_test {
93 name: "ziparchive-tests",
94 host_supported: true,
95 defaults: ["libziparchive_flags"],
96
Elliott Hughesbde0ec92018-04-25 12:49:19 -070097 data: [
98 "testdata/**/*",
99 ],
100
Colin Cross45566ba2016-07-12 18:45:19 -0700101 srcs: [
102 "entry_name_utils_test.cc",
103 "zip_archive_test.cc",
104 "zip_writer_test.cc",
105 ],
106 shared_libs: [
107 "libbase",
108 "liblog",
109 ],
110
111 static_libs: [
112 "libziparchive",
113 "libz",
114 "libutils",
115 ],
116
117 target: {
118 host: {
119 cppflags: ["-Wno-unnamed-type-template-args"],
120 },
121 windows: {
122 enabled: true,
123 },
124 },
125}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500126
127// Performance benchmarks.
128cc_benchmark {
129 name: "ziparchive-benchmarks",
130 defaults: ["libziparchive_flags"],
131
132 srcs: [
133 "zip_archive_benchmark.cpp",
134 ],
135 shared_libs: [
136 "libbase",
137 "liblog",
138 ],
139
140 static_libs: [
141 "libziparchive",
142 "libz",
143 "libutils",
144 ],
145
146 target: {
147 host: {
148 cppflags: ["-Wno-unnamed-type-template-args"],
149 },
150 },
151}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700152
153cc_binary {
154 name: "unzip",
155 defaults: ["libziparchive_flags"],
156 srcs: ["unzip.cpp"],
157 shared_libs: [
158 "libbase",
159 "libziparchive",
160 ],
161}