blob: f87591511ef2857e70236ea57ff163eee0c2c2fb [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",
23 ],
24 cppflags: [
25 "-Wold-style-cast",
26 // Incorrectly warns when C++11 empty brace {} initializer is used.
27 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489
28 "-Wno-missing-field-initializers",
29 ],
30}
31
32cc_defaults {
33 name: "libziparchive_defaults",
34 srcs: [
35 "zip_archive.cc",
36 "zip_archive_stream_entry.cc",
37 "zip_writer.cc",
38 ],
39
40 target: {
41 windows: {
42 cflags: ["-mno-ms-bitfields"],
43
44 enabled: true,
45 },
46 },
47
48 shared_libs: [
49 "libbase",
50 "liblog",
51 ],
52}
53
54
55cc_library {
56 name: "libziparchive",
57 host_supported: true,
58 defaults: ["libziparchive_defaults", "libziparchive_flags"],
Colin Cross45566ba2016-07-12 18:45:19 -070059 shared_libs: ["liblog", "libbase"],
60 target: {
61 android: {
Jaekyun Seok86e80b92016-12-21 14:22:00 +090062 shared_libs: ["libz", "libutils"],
63 },
64 host: {
65 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070066 },
Dan Willemsenab34b472016-11-29 13:32:55 -080067 linux_bionic: {
68 static_libs: ["libz"],
69 enabled: true,
70 },
71 linux: {
72 shared_libs: ["libz-host"],
73 },
74 darwin: {
75 shared_libs: ["libz-host"],
76 },
77 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070078 shared_libs: ["libz-host"],
79 },
80 },
81}
82
83// Also provide libziparchive-host until everything is switched over to using libziparchive
84cc_library {
85 name: "libziparchive-host",
86 host_supported: true,
87 device_supported: false,
88 defaults: ["libziparchive_defaults", "libziparchive_flags"],
89 shared_libs: ["libz-host"],
90 static_libs: ["libutils"],
91}
92
93// Tests.
94cc_test {
95 name: "ziparchive-tests",
96 host_supported: true,
97 defaults: ["libziparchive_flags"],
98
99 srcs: [
100 "entry_name_utils_test.cc",
101 "zip_archive_test.cc",
102 "zip_writer_test.cc",
103 ],
104 shared_libs: [
105 "libbase",
106 "liblog",
107 ],
108
109 static_libs: [
110 "libziparchive",
111 "libz",
112 "libutils",
113 ],
114
115 target: {
116 host: {
117 cppflags: ["-Wno-unnamed-type-template-args"],
118 },
119 windows: {
120 enabled: true,
121 },
122 },
123}