blob: 1084d59e57b37c518a07986a237b40cefc92e9d8 [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 ],
Colin Cross45566ba2016-07-12 18:45:19 -070068 target: {
69 android: {
Elliott Hughes55fd2932017-05-28 22:59:04 -070070 shared_libs: [
71 "libz",
72 "libutils",
73 ],
Jaekyun Seok86e80b92016-12-21 14:22:00 +090074 },
75 host: {
76 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070077 },
Dan Willemsenab34b472016-11-29 13:32:55 -080078 linux_bionic: {
79 static_libs: ["libz"],
80 enabled: true,
81 },
82 linux: {
83 shared_libs: ["libz-host"],
84 },
85 darwin: {
86 shared_libs: ["libz-host"],
87 },
88 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070089 shared_libs: ["libz-host"],
90 },
91 },
92}
93
94// Also provide libziparchive-host until everything is switched over to using libziparchive
95cc_library {
96 name: "libziparchive-host",
97 host_supported: true,
98 device_supported: false,
Elliott Hughes55fd2932017-05-28 22:59:04 -070099 defaults: [
100 "libziparchive_defaults",
101 "libziparchive_flags",
102 ],
Colin Cross45566ba2016-07-12 18:45:19 -0700103 shared_libs: ["libz-host"],
104 static_libs: ["libutils"],
105}
106
107// Tests.
108cc_test {
109 name: "ziparchive-tests",
110 host_supported: true,
111 defaults: ["libziparchive_flags"],
112
113 srcs: [
114 "entry_name_utils_test.cc",
115 "zip_archive_test.cc",
116 "zip_writer_test.cc",
117 ],
118 shared_libs: [
119 "libbase",
120 "liblog",
121 ],
122
123 static_libs: [
124 "libziparchive",
125 "libz",
126 "libutils",
127 ],
128
129 target: {
130 host: {
131 cppflags: ["-Wno-unnamed-type-template-args"],
132 },
133 windows: {
134 enabled: true,
135 },
136 },
137}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500138
139// Performance benchmarks.
140cc_benchmark {
141 name: "ziparchive-benchmarks",
142 defaults: ["libziparchive_flags"],
143
144 srcs: [
145 "zip_archive_benchmark.cpp",
146 ],
147 shared_libs: [
148 "libbase",
149 "liblog",
150 ],
151
152 static_libs: [
153 "libziparchive",
154 "libz",
155 "libutils",
156 ],
157
158 target: {
159 host: {
160 cppflags: ["-Wno-unnamed-type-template-args"],
161 },
162 },
163}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700164
165cc_binary {
166 name: "unzip",
167 defaults: ["libziparchive_flags"],
168 srcs: ["unzip.cpp"],
169 shared_libs: [
170 "libbase",
171 "libziparchive",
172 ],
173}