forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgif.BUILD
65 lines (59 loc) · 1.64 KB
/
gif.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SOURCES = [
"dgif_lib.c",
"egif_lib.c",
"gif_font.c",
"gif_hash.c",
"gifalloc.c",
"openbsd-reallocarray.c",
"gif_err.c",
"quantize.c",
]
HEADERS = [
"gif_hash.h",
"gif_lib.h",
"gif_lib_private.h",
]
config_setting(
name = "windows",
values = {
"cpu": "x64_windows_msvc",
},
visibility = ["//visibility:public"],
)
prefix_dir = "giflib-5.1.4/lib"
prefix_dir_windows = "windows/giflib-5.1.4/lib"
genrule(
name = "srcs_without_unistd",
srcs = [prefix_dir + "/" + source for source in SOURCES],
outs = [prefix_dir_windows + "/" + source for source in SOURCES],
cmd = "for f in $(SRCS); do " +
" sed 's/#include <unistd.h>//g' $$f > $(@D)/%s/$$(basename $$f);" % prefix_dir_windows +
"done",
)
genrule(
name = "hdrs_without_unistd",
srcs = [prefix_dir + "/" + hdrs for hdrs in HEADERS],
outs = [prefix_dir_windows + "/" + hdrs for hdrs in HEADERS],
cmd = "for f in $(SRCS); do " +
" sed 's/#include <unistd.h>//g' $$f > $(@D)/%s/$$(basename $$f);" % prefix_dir_windows +
"done",
)
cc_library(
name = "gif",
srcs = select({
"//conditions:default" : [prefix_dir + "/" + source for source in SOURCES],
":windows" : [":srcs_without_unistd"],
}),
hdrs = select({
"//conditions:default" : [prefix_dir + "/" + hdrs for hdrs in HEADERS],
":windows" : [":hdrs_without_unistd"],
}),
includes = select({
"//conditions:default" : [prefix_dir],
":windows" : [prefix_dir_windows],
}),
defines = [
"HAVE_CONFIG_H",
],
visibility = ["//visibility:public"],
)