Home | History | Annotate | Download | only in libziparchive
      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",
     23         "-D_FILE_OFFSET_BITS=64",
     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     vendor_available:true,
     60 
     61     defaults: ["libziparchive_defaults", "libziparchive_flags"],
     62     shared_libs: ["liblog", "libbase"],
     63     target: {
     64         android: {
     65             shared_libs: ["libz", "libutils"],
     66         },
     67         host: {
     68             static_libs: ["libutils"],
     69         },
     70         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: {
     81             shared_libs: ["libz-host"],
     82         },
     83     },
     84 }
     85 
     86 // Also provide libziparchive-host until everything is switched over to using libziparchive
     87 cc_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.
     97 cc_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 }
    127