-
Notifications
You must be signed in to change notification settings - Fork 3
/
BUILD
145 lines (128 loc) · 2.9 KB
/
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("//:install.bzl", "install")
load("//:subst.bzl", "subst_template")
package(default_visibility = [":__subpackages__"])
cc_library(
name = "filter",
srcs = ["filter.c"],
hdrs = ["filter.h"],
deps = [
":error",
":util",
"//input:sourcefile",
"//input:sourcepos",
],
)
cc_library(
name = "error",
srcs = ["error.c"],
hdrs = ["error.h"],
deps = ["//input:sourcepos"],
)
cc_library(
name = "factoriser",
srcs = ["factoriser.c"],
hdrs = ["factoriser.h"],
)
cc_library(
name = "icmpent",
srcs = ["icmpent.c"],
hdrs = ["icmpent.h"],
)
cc_library(
name = "util",
srcs = [
"fg-util.c",
],
hdrs = [
"fg-util.h",
"util.h",
],
)
genrule(
name = "gen_version",
outs = ["version.h"],
cmd = "sed -E 's/(\\S+) (\\S*)/#define \\1 \"\\2\"/' < bazel-out/stable-status.txt > $@",
stamp = True,
)
cc_library(
name = "version",
hdrs = ["version.h"],
)
cc_binary(
name = "filtergen",
srcs = [
"filtergen.c",
"gen.c",
],
local_defines = [
"HAVE_GETOPT_H",
],
deps = [
":version",
"//input/filtergen:in_filtergen",
"//input/iptables-save:in_iptables_save",
"//output/cisco:out_cisco",
"//output/filtergen:out_filtergen",
"//output/ipchains:out_ipchains",
"//output/ipfilter:out_ipfilter",
"//output/iptables:out_iptables",
"//output/iptablesrestore:out_iptablesrestore",
],
)
SUBSTITUTIONS = {
"@sysconfdir@": "/etc/filtergen",
"@pkgexdir@": "/usr/share/doc/filtergen/examples",
"@sbindir@": "/usr/sbin",
"@VERSION@": "TODO",
}
subst_template(
name = "fgadm",
src = "fgadm.in",
executable = True,
substitutions = SUBSTITUTIONS,
)
subst_template(
name = "fgadm.conf",
src = "fgadm.conf.in",
substitutions = SUBSTITUTIONS,
)
subst_template(
name = "rules.filter",
src = "rules.filter.in",
substitutions = SUBSTITUTIONS,
)
subst_template(
name = "filtergen.spec",
src = "filtergen.spec.in",
substitutions = SUBSTITUTIONS,
)
string_flag(
name = "DESTDIR",
build_setting_default = "/usr/local",
)
install(
name = "install",
prefix = ":DESTDIR",
targets = {
":fgadm": "/sbin",
":filtergen": "/sbin",
":fgadm.conf": "/etc/filtergen",
":rules.filter": "/etc/filtergen",
"filter_syntax.5": "/man/man5",
"filter_backends.7": "/man/man7",
"filtergen.8": "/man/man8",
"fgadm.8": "/man/man8",
"//examples:examples": "/doc/filtergen/examples",
"//doc:doc": "/doc/filtergen",
},
)
buildifier(
name = "buildifier",
exclude_patterns = [
"./.git/*",
],
lint_mode = "fix",
mode = "fix",
)