1# Description:
2#   libpng is the official PNG reference library.
3
4licenses(["notice"])  # BSD/MIT-like license
5
6exports_files(["LICENSE"])
7
8cc_library(
9    name = "png",
10    srcs = [
11        "png.c",
12        "pngdebug.h",
13        "pngerror.c",
14        "pngget.c",
15        "pnginfo.h",
16        "pnglibconf.h",
17        "pngmem.c",
18        "pngpread.c",
19        "pngpriv.h",
20        "pngread.c",
21        "pngrio.c",
22        "pngrtran.c",
23        "pngrutil.c",
24        "pngset.c",
25        "pngstruct.h",
26        "pngtrans.c",
27        "pngwio.c",
28        "pngwrite.c",
29        "pngwtran.c",
30        "pngwutil.c",
31    ] + select({
32        ":windows": [
33            "intel/intel_init.c",
34            "intel/filter_sse2_intrinsics.c",
35        ],
36        "@org_tensorflow//tensorflow:linux_ppc64le": [
37            "powerpc/powerpc_init.c",
38            "powerpc/filter_vsx_intrinsics.c",
39        ],
40        "//conditions:default": [
41        ],
42    }),
43    hdrs = [
44        "png.h",
45        "pngconf.h",
46    ],
47    copts = select({
48        ":windows": ["-DPNG_INTEL_SSE_OPT=1"],
49        "//conditions:default": [],
50    }),
51    includes = ["."],
52    linkopts = select({
53        ":windows": [],
54        "//conditions:default": ["-lm"],
55    }),
56    visibility = ["//visibility:public"],
57    deps = ["@zlib"],
58)
59
60genrule(
61    name = "snappy_stubs_public_h",
62    srcs = ["scripts/pnglibconf.h.prebuilt"],
63    outs = ["pnglibconf.h"],
64    cmd = "sed -e 's/PNG_ZLIB_VERNUM 0/PNG_ZLIB_VERNUM 0x12b0/' $< >$@",
65)
66
67config_setting(
68    name = "windows",
69    values = {"cpu": "x64_windows"},
70)
71