blob: ed1b9bc24f05f143e15f7808ae1c100419b46580 [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 },
Jiyong Park91687872018-04-09 12:20:48 +090064 double_loadable: true,
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070065
Elliott Hughes55fd2932017-05-28 22:59:04 -070066 defaults: [
67 "libziparchive_defaults",
68 "libziparchive_flags",
69 ],
70 shared_libs: [
71 "liblog",
72 "libbase",
Dan Willemsen5cfa0062017-09-27 16:24:45 -070073 "libz",
Elliott Hughes55fd2932017-05-28 22:59:04 -070074 ],
Colin Cross45566ba2016-07-12 18:45:19 -070075 target: {
76 android: {
Elliott Hughes55fd2932017-05-28 22:59:04 -070077 shared_libs: [
Elliott Hughes55fd2932017-05-28 22:59:04 -070078 "libutils",
79 ],
Jaekyun Seok86e80b92016-12-21 14:22:00 +090080 },
81 host: {
82 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070083 },
Dan Willemsenab34b472016-11-29 13:32:55 -080084 linux_bionic: {
Dan Willemsenab34b472016-11-29 13:32:55 -080085 enabled: true,
86 },
Colin Cross45566ba2016-07-12 18:45:19 -070087 },
88}
89
Colin Cross45566ba2016-07-12 18:45:19 -070090// Tests.
91cc_test {
92 name: "ziparchive-tests",
93 host_supported: true,
94 defaults: ["libziparchive_flags"],
95
96 srcs: [
97 "entry_name_utils_test.cc",
98 "zip_archive_test.cc",
99 "zip_writer_test.cc",
100 ],
101 shared_libs: [
102 "libbase",
103 "liblog",
104 ],
105
106 static_libs: [
107 "libziparchive",
108 "libz",
109 "libutils",
110 ],
111
112 target: {
113 host: {
114 cppflags: ["-Wno-unnamed-type-template-args"],
115 },
116 windows: {
117 enabled: true,
118 },
119 },
120}
Sebastian Pop0a94c562017-05-30 09:14:20 -0500121
122// Performance benchmarks.
123cc_benchmark {
124 name: "ziparchive-benchmarks",
125 defaults: ["libziparchive_flags"],
126
127 srcs: [
128 "zip_archive_benchmark.cpp",
129 ],
130 shared_libs: [
131 "libbase",
132 "liblog",
133 ],
134
135 static_libs: [
136 "libziparchive",
137 "libz",
138 "libutils",
139 ],
140
141 target: {
142 host: {
143 cppflags: ["-Wno-unnamed-type-template-args"],
144 },
145 },
146}
Elliott Hughes55fd2932017-05-28 22:59:04 -0700147
148cc_binary {
149 name: "unzip",
150 defaults: ["libziparchive_flags"],
151 srcs: ["unzip.cpp"],
152 shared_libs: [
153 "libbase",
154 "libziparchive",
155 ],
156}