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