blob: 1495f39365d84f0dff3efbdbf3cd085a85033bb5 [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,
59 defaults: ["libziparchive_defaults", "libziparchive_flags"],
60 static_libs: ["libutils"],
61 shared_libs: ["liblog", "libbase"],
62 target: {
63 android: {
64 static_libs: ["libz"],
65 },
Dan Willemsenab34b472016-11-29 13:32:55 -080066 linux_bionic: {
67 static_libs: ["libz"],
68 enabled: true,
69 },
70 linux: {
71 shared_libs: ["libz-host"],
72 },
73 darwin: {
74 shared_libs: ["libz-host"],
75 },
76 windows: {
Colin Cross45566ba2016-07-12 18:45:19 -070077 shared_libs: ["libz-host"],
78 },
79 },
80}
81
82// Also provide libziparchive-host until everything is switched over to using libziparchive
83cc_library {
84 name: "libziparchive-host",
85 host_supported: true,
86 device_supported: false,
87 defaults: ["libziparchive_defaults", "libziparchive_flags"],
88 shared_libs: ["libz-host"],
89 static_libs: ["libutils"],
90}
91
92// Tests.
93cc_test {
94 name: "ziparchive-tests",
95 host_supported: true,
96 defaults: ["libziparchive_flags"],
97
98 srcs: [
99 "entry_name_utils_test.cc",
100 "zip_archive_test.cc",
101 "zip_writer_test.cc",
102 ],
103 shared_libs: [
104 "libbase",
105 "liblog",
106 ],
107
108 static_libs: [
109 "libziparchive",
110 "libz",
111 "libutils",
112 ],
113
114 target: {
115 host: {
116 cppflags: ["-Wno-unnamed-type-template-args"],
117 },
118 windows: {
119 enabled: true,
120 },
121 },
122}