| # Copied from https://github.com/google-deepmind/lab2d/blob/09474439959534b1de3fce3d4a4ed35d565ea230/bazel/png.BUILD |
| # with minor modifications available under Apache 2.0 License |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # Description: |
| # libpng is the official PNG reference library. |
| |
| load("@rules_cc//cc:cc_library.bzl", "cc_library") |
| load("@rules_license//rules:license.bzl", "license") |
| |
| package( |
| default_applicable_licenses = [":license"], |
| ) |
| |
| exports_files([ |
| "LICENSE", |
| ]) |
| |
| license( |
| name = "license", |
| license_kinds = ["@rules_license//licenses/spdx:libpng-2.0"], |
| license_text = "LICENSE", |
| ) |
| |
| genrule( |
| name = "pnglibconf", |
| srcs = ["scripts/pnglibconf.h.prebuilt"], |
| outs = ["pnglibconf.h"], |
| cmd = "cp $(location scripts/pnglibconf.h.prebuilt) $(location pnglibconf.h)", |
| ) |
| |
| cc_library( |
| name = "png", |
| srcs = [ |
| "png.c", |
| "pngdebug.h", |
| "pngerror.c", |
| "pngget.c", |
| "pnginfo.h", |
| "pnglibconf.h", |
| "pngmem.c", |
| "pngpread.c", |
| "pngpriv.h", |
| "pngread.c", |
| "pngrio.c", |
| "pngrtran.c", |
| "pngrutil.c", |
| "pngset.c", |
| "pngstruct.h", |
| "pngtrans.c", |
| "pngwio.c", |
| "pngwrite.c", |
| "pngwtran.c", |
| "pngwutil.c", |
| ] + select({ |
| "@platforms//cpu:arm64": [ |
| "arm/arm_init.c", |
| "arm/filter_neon_intrinsics.c", |
| "arm/palette_neon_intrinsics.c", |
| ], |
| "//conditions:default": [], |
| }), |
| hdrs = [ |
| "png.h", |
| "pngconf.h", |
| ], |
| includes = ["."], |
| linkopts = ["-lm"], |
| visibility = ["//visibility:public"], |
| deps = ["@zlib"], |
| ) |
| |
| alias( |
| name = "libpng", |
| actual = ":png", |
| visibility = ["//visibility:public"], |
| ) |