• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#This library is free software; you can redistribute it and/or
2#modify it under the terms of the GNU Lesser General Public
3#License as published by the Free Software Foundation version 2.1
4#of the License.
5#
6#Copyright(c) 2021-2022 Huawei Device Co., Ltd.
7
8if (!defined(ohos_lite)) {
9  import("//build/ohos.gni")
10}
11
12action("build_grammar") {
13  script = "/usr/bin/env"
14  outputs = [ "$target_out_dir/gen/lib/route/pktloc_grammar.c" ]
15  grammer_hh = rebase_path("$target_out_dir/gen/lib/route/pktloc_grammar.h")
16  args = [
17    "flex",
18    "--header-file=$grammer_hh",
19    "-o",
20    rebase_path("$target_out_dir/gen/lib/route/pktloc_grammar.c"),
21    rebase_path("lib/route/pktloc_grammar.l"),
22  ]
23}
24
25action("pktloc_syntax") {
26  script = "/usr/bin/env"
27  outputs = [ "$target_out_dir/gen/lib/route/pktloc_syntax.c" ]
28  args = [
29    "bison",
30    "-y",
31    "-d",
32    "-o",
33    rebase_path("$target_out_dir/gen/lib/route/pktloc_syntax.c"),
34    rebase_path("lib/route/pktloc_syntax.y"),
35  ]
36}
37
38action("ematch_grammar") {
39  script = "/usr/bin/env"
40  outputs = [ "$target_out_dir/gen/lib/route/cls/ematch_grammar.c" ]
41  grammer_hh = rebase_path("$target_out_dir/gen/lib/route/cls/ematch_grammar.h")
42  args = [
43    "flex",
44    "--header-file=$grammer_hh",
45    "-o",
46    rebase_path("$target_out_dir/gen/lib/route/cls/ematch_grammar.c"),
47    rebase_path("lib/route/cls/ematch_grammar.l"),
48  ]
49}
50
51action("ematch_syntax") {
52  script = "/usr/bin/env"
53  outputs = [ "$target_out_dir/gen/lib/route/cls/ematch_syntax.c" ]
54  args = [
55    "bison",
56    "-y",
57    "-d",
58    "-o",
59    rebase_path("$target_out_dir/gen/lib/route/cls/ematch_syntax.c"),
60    rebase_path("lib/route/cls/ematch_syntax.y"),
61  ]
62}
63if (!defined(ohos_lite)) {
64  ohos_shared_library("libnl_share") {
65    grammer_outputs = get_target_outputs(":build_grammar")
66    grammer_path = get_path_info(grammer_outputs[0], "dir")
67    pktloc_outputs = get_target_outputs(":pktloc_syntax")
68    pktloc_path = get_path_info(pktloc_outputs[0], "dir")
69    ematch_outputs = get_target_outputs(":ematch_grammar")
70    ematch_path = get_path_info(ematch_outputs[0], "dir")
71    syntax_outputs = get_target_outputs(":ematch_syntax")
72    syntax_path = get_path_info(syntax_outputs[0], "dir")
73
74    include_dirs = [
75      "include",
76      "lib",
77      "lib/route/cls",
78      "lib/route",
79    ]
80
81    include_dirs += [
82      rebase_path("$grammer_path"),
83      rebase_path("$pktloc_path"),
84      rebase_path("$ematch_path"),
85      rebase_path("$syntax_path"),
86    ]
87
88    sources = [
89      "lib/addr.c",
90      "lib/attr.c",
91      "lib/cache.c",
92      "lib/cache_mngr.c",
93      "lib/cache_mngt.c",
94      "lib/data.c",
95      "lib/error.c",
96      "lib/handlers.c",
97      "lib/hash.c",
98      "lib/hashtable.c",
99      "lib/mpls.c",
100      "lib/msg.c",
101      "lib/nl.c",
102      "lib/object.c",
103      "lib/socket.c",
104      "lib/utils.c",
105      "lib/version.c",
106      "lib/fib_lookup/lookup.c",
107      "lib/fib_lookup/request.c",
108      "lib/genl/ctrl.c",
109      "lib/genl/family.c",
110      "lib/genl/genl.c",
111      "lib/genl/mngt.c",
112      "lib/idiag/idiag.c",
113      "lib/idiag/idiag_meminfo_obj.c",
114      "lib/idiag/idiag_msg_obj.c",
115      "lib/idiag/idiag_req_obj.c",
116      "lib/idiag/idiag_vegasinfo_obj.c",
117      "lib/netfilter/ct.c",
118      "lib/netfilter/ct_obj.c",
119      "lib/netfilter/exp.c",
120      "lib/netfilter/exp_obj.c",
121      "lib/netfilter/log.c",
122      "lib/netfilter/log_msg.c",
123      "lib/netfilter/log_msg_obj.c",
124      "lib/netfilter/log_obj.c",
125      "lib/netfilter/netfilter.c",
126      "lib/netfilter/nfnl.c",
127      "lib/netfilter/queue.c",
128      "lib/netfilter/queue_msg.c",
129      "lib/netfilter/queue_msg_obj.c",
130      "lib/netfilter/queue_obj.c",
131      "lib/route/act.c",
132      "lib/route/addr.c",
133      "lib/route/class.c",
134      "lib/route/classid.c",
135      "lib/route/cls.c",
136      "lib/route/link.c",
137      "lib/route/neigh.c",
138      "lib/route/neightbl.c",
139      "lib/route/netconf.c",
140      "lib/route/nexthop.c",
141      "lib/route/nexthop_encap.c",
142      "lib/route/nh_encap_mpls.c",
143      "lib/route/pktloc.c",
144      rebase_path("$grammer_path/pktloc_grammar.c"),
145      rebase_path("$pktloc_path/pktloc_syntax.c"),
146      "lib/route/qdisc.c",
147      "lib/route/route.c",
148      "lib/route/route_obj.c",
149      "lib/route/route_utils.c",
150      "lib/route/rtnl.c",
151      "lib/route/rule.c",
152      "lib/route/tc.c",
153      "lib/route/act/gact.c",
154      "lib/route/act/mirred.c",
155      "lib/route/act/skbedit.c",
156      "lib/route/act/vlan.c",
157      "lib/route/cls/basic.c",
158      "lib/route/cls/cgroup.c",
159      "lib/route/cls/ematch.c",
160      rebase_path("$ematch_path/ematch_grammar.c"),
161      rebase_path("$syntax_path/ematch_syntax.c"),
162      "lib/route/cls/fw.c",
163      "lib/route/cls/mall.c",
164      "lib/route/cls/police.c",
165      "lib/route/cls/u32.c",
166      "lib/route/cls/ematch/cmp.c",
167      "lib/route/cls/ematch/container.c",
168      "lib/route/cls/ematch/meta.c",
169      "lib/route/cls/ematch/nbyte.c",
170      "lib/route/cls/ematch/text.c",
171      "lib/route/link/api.c",
172      "lib/route/link/bonding.c",
173      "lib/route/link/bridge.c",
174      "lib/route/link/can.c",
175      "lib/route/link/dummy.c",
176      "lib/route/link/geneve.c",
177      "lib/route/link/ifb.c",
178      "lib/route/link/inet6.c",
179      "lib/route/link/inet.c",
180      "lib/route/link/ip6tnl.c",
181      "lib/route/link/ipgre.c",
182      "lib/route/link/ipip.c",
183      "lib/route/link/ipvlan.c",
184      "lib/route/link/ipvti.c",
185      "lib/route/link/macsec.c",
186      "lib/route/link/macvlan.c",
187      "lib/route/link/ppp.c",
188      "lib/route/link/sit.c",
189      "lib/route/link/sriov.c",
190      "lib/route/link/veth.c",
191      "lib/route/link/vlan.c",
192      "lib/route/link/vrf.c",
193      "lib/route/link/vxlan.c",
194      "lib/route/link/xfrmi.c",
195      "lib/route/qdisc/blackhole.c",
196      "lib/route/qdisc/cbq.c",
197      "lib/route/qdisc/dsmark.c",
198      "lib/route/qdisc/fifo.c",
199      "lib/route/qdisc/fq_codel.c",
200      "lib/route/qdisc/hfsc.c",
201      "lib/route/qdisc/htb.c",
202      "lib/route/qdisc/ingress.c",
203      "lib/route/qdisc/mqprio.c",
204      "lib/route/qdisc/netem.c",
205      "lib/route/qdisc/plug.c",
206      "lib/route/qdisc/prio.c",
207      "lib/route/qdisc/red.c",
208      "lib/route/qdisc/sfq.c",
209      "lib/route/qdisc/tbf.c",
210      "lib/xfrm/ae.c",
211      "lib/xfrm/lifetime.c",
212      "lib/xfrm/sa.c",
213      "lib/xfrm/selector.c",
214      "lib/xfrm/sp.c",
215      "lib/xfrm/template.c",
216      "lib/cli/cls/basic.c",
217      "lib/cli/cls/cgroup.c",
218      "lib/cli/qdisc/bfifo.c",
219      "lib/cli/qdisc/blackhole.c",
220      "lib/cli/qdisc/fq_codel.c",
221      "lib/cli/qdisc/hfsc.c",
222      "lib/cli/qdisc/htb.c",
223      "lib/cli/qdisc/ingress.c",
224      "lib/cli/qdisc/pfifo.c",
225      "lib/cli/qdisc/plug.c",
226      "src/lib/addr.c",
227      "src/lib/class.c",
228      "src/lib/cls.c",
229      "src/lib/ct.c",
230      "src/lib/exp.c",
231      "src/lib/link.c",
232      "src/lib/neigh.c",
233      "src/lib/qdisc.c",
234      "src/lib/route.c",
235      "src/lib/rule.c",
236      "src/lib/tc.c",
237      "src/lib/utils.c",
238    ]
239
240    deps = [
241      ":build_grammar",
242      ":ematch_grammar",
243      ":ematch_syntax",
244      ":pktloc_syntax",
245    ]
246    defines = [ "NL_DEBUG" ]
247    cflags = [
248      "-Wno-error",
249      "-D_BSD_SOURCE",
250      "-D_GNU_SOURCE",
251      "-DNL_DEBUG",
252
253      #"-UNDEBUG",
254      "-DSYSCONFDIR=\"\\\"/etc/libnl\\\"\"",
255    ]
256    subsystem_name = "wpa_supplicant-2.9"
257    install_images = [ "system" ]
258  }
259}
260