| // We need to build this for both the device (as a shared library) | |
| // and the host (as a static library for tools to use). | |
| package { | |
| default_applicable_licenses: ["external_libpng_license"], | |
| } | |
| // Added automatically by a large-scale-change that took the approach of | |
| // 'apply every license found to every target'. While this makes sure we respect | |
| // every license restriction, it may not be entirely correct. | |
| // | |
| // e.g. GPL in an MIT project might only apply to the contrib/ directory. | |
| // | |
| // Please consider splitting the single license below into multiple licenses, | |
| // taking care not to lose any license_kind information, and overriding the | |
| // default license using the 'licenses: [...]' property on targets as needed. | |
| // | |
| // For unused files, consider creating a 'fileGroup' with "//visibility:private" | |
| // to attach the license to, and including a comment whether the files may be | |
| // used in the current project. | |
| // | |
| // large-scale-change filtered out the below license kinds as false-positives: | |
| // SPDX-license-identifier-GPL | |
| // SPDX-license-identifier-GPL-2.0 | |
| // SPDX-license-identifier-LGPL | |
| // See: http://go/android-license-faq | |
| license { | |
| name: "external_libpng_license", | |
| visibility: [":__subpackages__"], | |
| license_kinds: [ | |
| "SPDX-license-identifier-Apache-2.0", | |
| "SPDX-license-identifier-BSD", | |
| "SPDX-license-identifier-CC0-1.0", | |
| "SPDX-license-identifier-MIT", | |
| "SPDX-license-identifier-W3C", | |
| "SPDX-license-identifier-Zlib", | |
| "legacy_notice", | |
| "legacy_unencumbered", | |
| ], | |
| license_text: [ | |
| "LICENSE", | |
| ], | |
| } | |
| cc_defaults { | |
| name: "libpng-defaults", | |
| exclude_srcs: [ | |
| "example.c", | |
| "pngtest.c", | |
| ], | |
| srcs: ["*.c"], | |
| cflags: [ | |
| "-std=gnu89", | |
| "-Wall", | |
| "-Werror", | |
| "-Wno-unused-parameter", | |
| ], | |
| arch: { | |
| arm: { | |
| srcs: ["arm/*"], | |
| cflags: ["-O3"], | |
| }, | |
| arm64: { | |
| srcs: ["arm/*",], | |
| cflags: ["-O3"], | |
| exclude_srcs: [ | |
| "arm/filter_neon.S" | |
| ], | |
| }, | |
| x86: { | |
| srcs: ["intel/*"], | |
| // Disable optimizations because they crash on windows | |
| // cflags: ["-DPNG_INTEL_SSE_OPT=1"], | |
| }, | |
| x86_64: { | |
| srcs: ["intel/*"], | |
| // Disable optimizations because they crash on windows | |
| // cflags: ["-DPNG_INTEL_SSE_OPT=1"], | |
| }, | |
| }, | |
| shared_libs: ["libz"], | |
| target: { | |
| android_x86: { | |
| cflags: ["-DPNG_INTEL_SSE_OPT=1"], | |
| }, | |
| android_x86_64: { | |
| cflags: ["-DPNG_INTEL_SSE_OPT=1"], | |
| }, | |
| }, | |
| export_include_dirs: ["."], | |
| } | |
| // For the host and device platform | |
| // ===================================================== | |
| cc_library { | |
| name: "libpng", | |
| vendor_available: true, | |
| product_available: true, | |
| // TODO(b/153609531): remove when no longer needed. | |
| native_bridge_supported: true, | |
| recovery_available: true, | |
| double_loadable: true, | |
| host_supported: true, | |
| defaults: ["libpng-defaults"], | |
| target: { | |
| windows: { | |
| enabled: true, | |
| }, | |
| }, | |
| sdk_version: "current", | |
| min_sdk_version: "apex_inherit", | |
| apex_available: [ | |
| "com.android.mediaprovider", | |
| "//apex_available:platform" | |
| ], | |
| } | |
| // For the device (static) for NDK | |
| // ===================================================== | |
| cc_library_static { | |
| name: "libpng_ndk", | |
| defaults: ["libpng-defaults"], | |
| cflags: ["-ftrapv"], | |
| shared_libs: ["libz"], | |
| sdk_version: "minimum", | |
| } | |
| // For testing | |
| // ===================================================== | |
| cc_test { | |
| host_supported: true, | |
| gtest: false, | |
| srcs: ["pngtest.c"], | |
| name: "pngtest", | |
| cflags: ["-Wall", "-Werror"], | |
| shared_libs: [ | |
| "libpng", | |
| "libz", | |
| ], | |
| } | |
| cc_fuzz { | |
| name: "libpng_read_fuzzer", | |
| host_supported:true, | |
| static_libs: [ | |
| "libpng", | |
| "libz", | |
| ], | |
| srcs: [ | |
| "contrib/oss-fuzz/libpng_read_fuzzer.cc", | |
| ], | |
| dictionary: "contrib/oss-fuzz/png.dict", | |
| corpus: ["contrib/testpngs/*.png"], | |
| fuzz_config: { | |
| cc: [ | |
| "[email protected]", | |
| ], | |
| componentid: 87896, | |
| }, | |
| } |