blob: 84a9a2f9bcd13e361cebe19d5d62c4e88809be63 [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 ],
53}
54
Colin Cross45566ba2016-07-12 18:45:19 -070055cc_library {
56 name: "libziparchive",
57 host_supported: true,
Elliott Hughes55fd2932017-05-28 22:59:04 -070058 vendor_available: true,
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070059
Elliott Hughes55fd2932017-05-28 22:59:04 -070060 defaults: [
61 "libziparchive_defaults",
62 "libziparchive_flags",
63 ],
64 shared_libs: [
65 "liblog",
66 "libbase",
67 ],
Jiyong Parkcdf7ff82017-07-02 11:52:40 +090068 export_include_dirs: ["include"],
Colin Cross45566ba2016-07-12 18:45:19 -070069 target: {
70 android: {
Elliott Hughes55fd2932017-05-28 22:59:04 -070071 shared_libs: [
72 "libz",
73 "libutils",
74 ],
Jaekyun Seok86e80b92016-12-21 14:22:00 +090075 },
76 host: {
77 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070078 },
Dan Willemsenab34b472016-11-29 13:32:55 -080079 linux_bionic: {
80 static_libs: ["libz"],
81 enabled: true,
82 },
83 linux: {
84 shared_libs: ["libz-host"],
85 },
86 darwin: {
87 shared_libs: ["libz-host"],
88 },
89 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070090 shared_libs: ["libz-host"],
91 },
92 },
93}
94
95// Also provide libziparchive-host until everything is switched over to using libziparchive
96cc_library {
97 name: "libziparchive-host",
98 host_supported: true,
99 device_supported: false,
Elliott Hughes55fd2932017-05-28 22:59:04 -0700100 defaults: [
101 "libziparchive_defaults",
102 "libziparchive_flags",
103 ],
Colin Cross45566ba2016-07-12 18:45:19 -0700104 shared_libs: ["libz-host"],
105 static_libs: ["libutils"],
106}
107
108// Tests.
109cc_test {
110 name: "ziparchive-tests",
111 host_supported: true,
112 defaults: ["libziparchive_flags"],
113
114 srcs: [
115 "entry_name_utils_test.cc",
116 "zip_archive_test.cc",
117 "zip_writer_test.cc",
118 ],
119 shared_libs: [
120 "libbase",
121 "liblog",
122 ],
123
124 static_libs: [
125 "libziparchive",
126 "libz",
127 "libutils",
128 ],
129
130 target: {
131 host: {
132 cppflags: ["-Wno-unnamed-type-template-args"],
133 },
134 windows: {
135 enabled: true,
136 },
137 },
138}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500139
140// Performance benchmarks.
141cc_benchmark {
142 name: "ziparchive-benchmarks",
143 defaults: ["libziparchive_flags"],
144
145 srcs: [
146 "zip_archive_benchmark.cpp",
147 ],
148 shared_libs: [
149 "libbase",
150 "liblog",
151 ],
152
153 static_libs: [
154 "libziparchive",
155 "libz",
156 "libutils",
157 ],
158
159 target: {
160 host: {
161 cppflags: ["-Wno-unnamed-type-template-args"],
162 },
163 },
164}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700165
166cc_binary {
167 name: "unzip",
168 defaults: ["libziparchive_flags"],
169 srcs: ["unzip.cpp"],
170 shared_libs: [
171 "libbase",
172 "libziparchive",
173 ],
174}