| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 1 | // | 
|  | 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 |  | 
|  | 16 | cc_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 Poetzsch | 3081c5e | 2016-12-20 16:13:41 +0000 | [diff] [blame] | 23 | "-D_FILE_OFFSET_BITS=64", | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 24 | ], | 
|  | 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 |  | 
|  | 33 | cc_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 |  | 
|  | 56 | cc_library { | 
|  | 57 | name: "libziparchive", | 
|  | 58 | host_supported: true, | 
|  | 59 | defaults: ["libziparchive_defaults", "libziparchive_flags"], | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 60 | shared_libs: ["liblog", "libbase"], | 
|  | 61 | target: { | 
|  | 62 | android: { | 
| Jaekyun Seok | 86e80b9 | 2016-12-21 14:22:00 +0900 | [diff] [blame] | 63 | shared_libs: ["libz", "libutils"], | 
|  | 64 | }, | 
|  | 65 | host: { | 
|  | 66 | static_libs: ["libutils"], | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 67 | }, | 
| Dan Willemsen | ab34b47 | 2016-11-29 13:32:55 -0800 | [diff] [blame] | 68 | linux_bionic: { | 
|  | 69 | static_libs: ["libz"], | 
|  | 70 | enabled: true, | 
|  | 71 | }, | 
|  | 72 | linux: { | 
|  | 73 | shared_libs: ["libz-host"], | 
|  | 74 | }, | 
|  | 75 | darwin: { | 
|  | 76 | shared_libs: ["libz-host"], | 
|  | 77 | }, | 
|  | 78 | windows: { | 
| Colin Cross | 45566ba | 2016-07-12 18:45:19 -0700 | [diff] [blame] | 79 | shared_libs: ["libz-host"], | 
|  | 80 | }, | 
|  | 81 | }, | 
|  | 82 | } | 
|  | 83 |  | 
|  | 84 | // Also provide libziparchive-host until everything is switched over to using libziparchive | 
|  | 85 | cc_library { | 
|  | 86 | name: "libziparchive-host", | 
|  | 87 | host_supported: true, | 
|  | 88 | device_supported: false, | 
|  | 89 | defaults: ["libziparchive_defaults", "libziparchive_flags"], | 
|  | 90 | shared_libs: ["libz-host"], | 
|  | 91 | static_libs: ["libutils"], | 
|  | 92 | } | 
|  | 93 |  | 
|  | 94 | // Tests. | 
|  | 95 | cc_test { | 
|  | 96 | name: "ziparchive-tests", | 
|  | 97 | host_supported: true, | 
|  | 98 | defaults: ["libziparchive_flags"], | 
|  | 99 |  | 
|  | 100 | srcs: [ | 
|  | 101 | "entry_name_utils_test.cc", | 
|  | 102 | "zip_archive_test.cc", | 
|  | 103 | "zip_writer_test.cc", | 
|  | 104 | ], | 
|  | 105 | shared_libs: [ | 
|  | 106 | "libbase", | 
|  | 107 | "liblog", | 
|  | 108 | ], | 
|  | 109 |  | 
|  | 110 | static_libs: [ | 
|  | 111 | "libziparchive", | 
|  | 112 | "libz", | 
|  | 113 | "libutils", | 
|  | 114 | ], | 
|  | 115 |  | 
|  | 116 | target: { | 
|  | 117 | host: { | 
|  | 118 | cppflags: ["-Wno-unnamed-type-template-args"], | 
|  | 119 | }, | 
|  | 120 | windows: { | 
|  | 121 | enabled: true, | 
|  | 122 | }, | 
|  | 123 | }, | 
|  | 124 | } |