blob: 0a4f0889177408cd52047159cdb2ea98b63bea09 [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
55
56cc_library {
57 name: "libziparchive",
58 host_supported: true,
Jayant Chowdhary2c87bcc2017-05-16 13:09:54 -070059 vendor_available:true,
60
Colin Cross45566ba2016-07-12 18:45:19 -070061 defaults: ["libziparchive_defaults", "libziparchive_flags"],
Colin Cross45566ba2016-07-12 18:45:19 -070062 shared_libs: ["liblog", "libbase"],
63 target: {
64 android: {
Jaekyun Seok86e80b92016-12-21 14:22:00 +090065 shared_libs: ["libz", "libutils"],
66 },
67 host: {
68 static_libs: ["libutils"],
Colin Cross45566ba2016-07-12 18:45:19 -070069 },
Dan Willemsenab34b472016-11-29 13:32:55 -080070 linux_bionic: {
71 static_libs: ["libz"],
72 enabled: true,
73 },
74 linux: {
75 shared_libs: ["libz-host"],
76 },
77 darwin: {
78 shared_libs: ["libz-host"],
79 },
80 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070081 shared_libs: ["libz-host"],
82 },
83 },
84}
85
86// Also provide libziparchive-host until everything is switched over to using libziparchive
87cc_library {
88 name: "libziparchive-host",
89 host_supported: true,
90 device_supported: false,
91 defaults: ["libziparchive_defaults", "libziparchive_flags"],
92 shared_libs: ["libz-host"],
93 static_libs: ["libutils"],
94}
95
96// Tests.
97cc_test {
98 name: "ziparchive-tests",
99 host_supported: true,
100 defaults: ["libziparchive_flags"],
101
102 srcs: [
103 "entry_name_utils_test.cc",
104 "zip_archive_test.cc",
105 "zip_writer_test.cc",
106 ],
107 shared_libs: [
108 "libbase",
109 "liblog",
110 ],
111
112 static_libs: [
113 "libziparchive",
114 "libz",
115 "libutils",
116 ],
117
118 target: {
119 host: {
120 cppflags: ["-Wno-unnamed-type-template-args"],
121 },
122 windows: {
123 enabled: true,
124 },
125 },
126}