-
Notifications
You must be signed in to change notification settings - Fork 2
/
png.BUILD
40 lines (36 loc) · 999 Bytes
/
png.BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package(default_visibility = ["//visibility:public"])
prefix_dir = "libpng-1.2.53"
PNG_SOURCES = [
"png.c",
"pngerror.c",
"pngget.c",
"pngmem.c",
"pngpread.c",
"pngread.c",
"pngrio.c",
"pngrtran.c",
"pngrutil.c",
"pngset.c",
"pngtrans.c",
"pngwio.c",
"pngwrite.c",
"pngwtran.c",
"pngwutil.c",
]
genrule(
name = "configure",
srcs = glob(
["**/*"],
exclude = [prefix_dir + "/config.h"],
),
outs = [prefix_dir + "/config.h"],
cmd = "pushd external/png_archive/%s; workdir=$$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $$workdir; pushd $$workdir; ./configure --enable-shared=no --with-pic=no; popd; popd; cp $$workdir/config.h $(@D); rm -rf $$workdir;" % prefix_dir,
)
cc_library(
name = "png",
srcs = [prefix_dir + "/" + source for source in PNG_SOURCES],
hdrs = glob(["**/*.h"]) + [":configure"],
includes = [prefix_dir],
linkopts = ["-lz"],
visibility = ["//visibility:public"],
)