blob: e3faee36c7a6f081dce8a29da31ab8a9c584ee6c [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,
Justin Yun096114d2017-08-03 15:51:33 +090061 vndk: {
62 enabled: true,
63 },
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070064
Elliott Hughes55fd2932017-05-28 22:59:04 -070065 defaults: [
66 "libziparchive_defaults",
67 "libziparchive_flags",
68 ],
69 shared_libs: [
70 "liblog",
71 "libbase",
Dan Willemsen5cfa0062017-09-27 16:24:45 -070072 "libz",
Elliott Hughes55fd2932017-05-28 22:59:04 -070073 ],
Colin Cross45566ba2016-07-12 18:45:19 -070074 target: {
75 android: {
Elliott Hughes55fd2932017-05-28 22:59:04 -070076 shared_libs: [
Elliott Hughes55fd2932017-05-28 22:59:04 -070077 "libutils",
78 ],
Jaekyun Seok86e80b92016-12-21 14:22:00 +090079 },
80 host: {
81 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070082 },
Dan Willemsenab34b472016-11-29 13:32:55 -080083 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080084 enabled: true,
85 },
Colin Cross45566ba2016-07-12 18:45:19 -070086 },
87}
88
89// Also provide libziparchive-host until everything is switched over to using libziparchive
90cc_library {
91 name: "libziparchive-host",
92 host_supported: true,
93 device_supported: false,
Elliott Hughes55fd2932017-05-28 22:59:04 -070094 defaults: [
95 "libziparchive_defaults",
96 "libziparchive_flags",
97 ],
Dan Willemsen5cfa0062017-09-27 16:24:45 -070098 shared_libs: ["libz"],
Colin Cross45566ba2016-07-12 18:45:19 -070099 static_libs: ["libutils"],
100}
101
102// Tests.
103cc_test {
104 name: "ziparchive-tests",
105 host_supported: true,
106 defaults: ["libziparchive_flags"],
107
108 srcs: [
109 "entry_name_utils_test.cc",
110 "zip_archive_test.cc",
111 "zip_writer_test.cc",
112 ],
113 shared_libs: [
114 "libbase",
115 "liblog",
116 ],
117
118 static_libs: [
119 "libziparchive",
120 "libz",
121 "libutils",
122 ],
123
124 target: {
125 host: {
126 cppflags: ["-Wno-unnamed-type-template-args"],
127 },
128 windows: {
129 enabled: true,
130 },
131 },
132}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500133
134// Performance benchmarks.
135cc_benchmark {
136 name: "ziparchive-benchmarks",
137 defaults: ["libziparchive_flags"],
138
139 srcs: [
140 "zip_archive_benchmark.cpp",
141 ],
142 shared_libs: [
143 "libbase",
144 "liblog",
145 ],
146
147 static_libs: [
148 "libziparchive",
149 "libz",
150 "libutils",
151 ],
152
153 target: {
154 host: {
155 cppflags: ["-Wno-unnamed-type-template-args"],
156 },
157 },
158}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700159
160cc_binary {
161 name: "unzip",
162 defaults: ["libziparchive_flags"],
163 srcs: ["unzip.cpp"],
164 shared_libs: [
165 "libbase",
166 "libziparchive",
167 ],
168}