blob: e3a7a1be0ba6a778b533989b4666d2fc1bfd79d5 [file] [log] [blame]
Bob Badourbe00cb12021-03-05 15:59:28 -08001package {
2 default_applicable_licenses: ["external_libpcap_license"],
3}
4
5license {
6 name: "external_libpcap_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 ],
14 license_text: [
15 "LICENSE",
16 "NOTICE",
17 ],
18}
Elliott Hughes22ad79b2018-04-10 22:44:35 -070019
20cc_defaults {
21 name: "libpcap_defaults",
22 cflags: [
23 "-D_BSD_SOURCE",
24 "-DHAVE_CONFIG_H",
25 "-Dlint",
26 "-D_U_=__attribute__((__unused__))",
27 "-Wall",
28 "-Werror",
29 "-Wno-macro-redefined",
30 "-Wno-pointer-arith",
31 "-Wno-sign-compare",
32 "-Wno-unused-parameter",
33 "-Wno-unused-result",
34 "-Wno-tautological-compare",
35 ],
36}
37
38cc_library {
39 name: "libpcap",
Aaron Huange7597b82018-11-16 20:18:03 +080040 host_supported: true,
Elliott Hughes22ad79b2018-04-10 22:44:35 -070041 vendor_available: true,
Lorenzo Colitti738c96f2020-02-03 12:34:27 +090042 // Build against the NDK 29 because it's used by the network stack mainline module tests, which
43 // need to support Q.
44 // TODO(b/148792341): stop hardcoding sdk_version integers in libraries all over the tree and
45 // define a min_apex_sdk_version property that all module code can use.
46 sdk_version: "29",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070047 defaults: ["libpcap_defaults"],
48
49 // (Matches order in libpcap's Makefile.)
50 srcs: [
51 "pcap-linux.c",
52 "pcap-usb-linux.c",
53 "pcap-netfilter-linux-android.c",
54 "fad-getad.c",
55 "pcap.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070056 "gencode.c",
57 "optimize.c",
58 "nametoaddr.c",
59 "etherent.c",
Haibo Huang165065a2018-07-23 17:26:52 -070060 "fmtutils.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070061 "savefile.c",
62 "sf-pcap.c",
Haibo Huang165065a2018-07-23 17:26:52 -070063 "sf-pcapng.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070064 "pcap-common.c",
65 "bpf_image.c",
Haibo Huang165065a2018-07-23 17:26:52 -070066 "bpf_filter.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070067 "bpf_dump.c",
68 "scanner.c",
69 "grammar.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -070070 ],
71
Aaron Huange7597b82018-11-16 20:18:03 +080072 target: {
Haibo Huang4ccd6832020-04-23 18:03:48 -070073 linux: {
74 srcs: [
75 "missing/strlcpy.c",
76 ],
77 },
Aaron Huange7597b82018-11-16 20:18:03 +080078 darwin: {
79 enabled: false,
80 },
81 },
82
Elliott Hughes22ad79b2018-04-10 22:44:35 -070083 export_include_dirs: ["."],
84}
85
86//
87// Tests.
88//
89
90cc_test {
91 name: "libpcap_test",
92 defaults: ["libpcap_defaults"],
93 gtest: false,
94 // (Matches order in libpcap's Makefile.)
95 srcs: [
Haibo Huang165065a2018-07-23 17:26:52 -070096 "testprogs/can_set_rfmon_test.c",
97 "testprogs/capturetest.c",
98 "testprogs/filtertest.c",
99 "testprogs/findalldevstest.c",
100 "testprogs/opentest.c",
101 "testprogs/reactivatetest.c",
102 "testprogs/selpolltest.c",
103 "testprogs/threadsignaltest.c",
104 "testprogs/valgrindtest.c",
Elliott Hughes22ad79b2018-04-10 22:44:35 -0700105 ],
106 static_libs: ["libpcap"],
107 test_per_src: true,
108}