1// We need to build this for both the device (as a shared library) 2// and the host (as a static library for tools to use). 3 4package { 5 default_applicable_licenses: ["external_libpng_license"], 6} 7 8// Added automatically by a large-scale-change that took the approach of 9// 'apply every license found to every target'. While this makes sure we respect 10// every license restriction, it may not be entirely correct. 11// 12// e.g. GPL in an MIT project might only apply to the contrib/ directory. 13// 14// Please consider splitting the single license below into multiple licenses, 15// taking care not to lose any license_kind information, and overriding the 16// default license using the 'licenses: [...]' property on targets as needed. 17// 18// For unused files, consider creating a 'fileGroup' with "//visibility:private" 19// to attach the license to, and including a comment whether the files may be 20// used in the current project. 21// 22// large-scale-change filtered out the below license kinds as false-positives: 23// SPDX-license-identifier-GPL 24// SPDX-license-identifier-GPL-2.0 25// SPDX-license-identifier-LGPL 26// See: http://go/android-license-faq 27license { 28 name: "external_libpng_license", 29 visibility: [":__subpackages__"], 30 license_kinds: [ 31 "SPDX-license-identifier-Apache-2.0", 32 "SPDX-license-identifier-BSD", 33 "SPDX-license-identifier-CC0-1.0", 34 "SPDX-license-identifier-MIT", 35 "SPDX-license-identifier-W3C", 36 "SPDX-license-identifier-Zlib", 37 "legacy_notice", 38 "legacy_unencumbered", 39 ], 40 license_text: [ 41 "LICENSE", 42 ], 43} 44 45cc_defaults { 46 name: "libpng-defaults", 47 exclude_srcs: [ 48 "example.c", 49 "pngtest.c", 50 ], 51 srcs: ["*.c"], 52 cflags: [ 53 "-std=gnu89", 54 "-Wall", 55 "-Werror", 56 "-Wno-unused-parameter", 57 ], 58 arch: { 59 arm: { 60 srcs: ["arm/*"], 61 cflags: ["-O3"], 62 }, 63 arm64: { 64 srcs: ["arm/*",], 65 cflags: ["-O3"], 66 exclude_srcs: [ 67 "arm/filter_neon.S" 68 ], 69 }, 70 x86: { 71 srcs: ["intel/*"], 72 // Disable optimizations because they crash on windows 73 // cflags: ["-DPNG_INTEL_SSE_OPT=1"], 74 }, 75 x86_64: { 76 srcs: ["intel/*"], 77 // Disable optimizations because they crash on windows 78 // cflags: ["-DPNG_INTEL_SSE_OPT=1"], 79 }, 80 }, 81 shared_libs: ["libz"], 82 target: { 83 android_x86: { 84 cflags: ["-DPNG_INTEL_SSE_OPT=1"], 85 }, 86 android_x86_64: { 87 cflags: ["-DPNG_INTEL_SSE_OPT=1"], 88 }, 89 }, 90 export_include_dirs: ["."], 91} 92 93// For the host and device platform 94// ===================================================== 95 96cc_library { 97 name: "libpng", 98 vendor_available: true, 99 product_available: true, 100 // TODO(b/153609531): remove when no longer needed. 101 native_bridge_supported: true, 102 recovery_available: true, 103 vndk: { 104 enabled: true, 105 }, 106 double_loadable: true, 107 host_supported: true, 108 defaults: ["libpng-defaults"], 109 target: { 110 windows: { 111 enabled: true, 112 }, 113 }, 114} 115 116// For the device (static) for NDK 117// ===================================================== 118 119cc_library_static { 120 name: "libpng_ndk", 121 defaults: ["libpng-defaults"], 122 cflags: ["-ftrapv"], 123 124 shared_libs: ["libz"], 125 sdk_version: "minimum", 126} 127 128// For testing 129// ===================================================== 130 131cc_test { 132 host_supported: true, 133 gtest: false, 134 srcs: ["pngtest.c"], 135 name: "pngtest", 136 cflags: ["-Wall", "-Werror"], 137 shared_libs: [ 138 "libpng", 139 "libz", 140 ], 141} 142 143cc_fuzz { 144 name: "libpng_read_fuzzer", 145 host_supported:true, 146 147 static_libs: [ 148 "libpng", 149 "libz", 150 ], 151 152 srcs: [ 153 "contrib/oss-fuzz/libpng_read_fuzzer.cc", 154 ], 155 156 dictionary: "contrib/oss-fuzz/png.dict", 157 158 corpus: ["contrib/testpngs/*.png"], 159 160 fuzz_config: { 161 cc: [ 162 "scroggo@google.com", 163 ], 164 componentid: 87896, 165 }, 166} 167