Bob Badour | be00cb1 | 2021-03-05 15:59:28 -0800 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["external_libpcap_license"], |
| 3 | } |
| 4 | |
| 5 | license { |
| 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 Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 19 | |
| 20 | cc_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 | |
| 38 | cc_library { |
| 39 | name: "libpcap", |
Aaron Huang | e7597b8 | 2018-11-16 20:18:03 +0800 | [diff] [blame] | 40 | host_supported: true, |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 41 | vendor_available: true, |
Lorenzo Colitti | 738c96f | 2020-02-03 12:34:27 +0900 | [diff] [blame] | 42 | // 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 Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 47 | 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 Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 56 | "gencode.c", |
| 57 | "optimize.c", |
| 58 | "nametoaddr.c", |
| 59 | "etherent.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 60 | "fmtutils.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 61 | "savefile.c", |
| 62 | "sf-pcap.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 63 | "sf-pcapng.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 64 | "pcap-common.c", |
| 65 | "bpf_image.c", |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 66 | "bpf_filter.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 67 | "bpf_dump.c", |
| 68 | "scanner.c", |
| 69 | "grammar.c", |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 70 | ], |
| 71 | |
Aaron Huang | e7597b8 | 2018-11-16 20:18:03 +0800 | [diff] [blame] | 72 | target: { |
Haibo Huang | 4ccd683 | 2020-04-23 18:03:48 -0700 | [diff] [blame] | 73 | linux: { |
| 74 | srcs: [ |
| 75 | "missing/strlcpy.c", |
| 76 | ], |
| 77 | }, |
Aaron Huang | e7597b8 | 2018-11-16 20:18:03 +0800 | [diff] [blame] | 78 | darwin: { |
| 79 | enabled: false, |
| 80 | }, |
| 81 | }, |
| 82 | |
Elliott Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 83 | export_include_dirs: ["."], |
| 84 | } |
| 85 | |
| 86 | // |
| 87 | // Tests. |
| 88 | // |
| 89 | |
| 90 | cc_test { |
| 91 | name: "libpcap_test", |
| 92 | defaults: ["libpcap_defaults"], |
| 93 | gtest: false, |
| 94 | // (Matches order in libpcap's Makefile.) |
| 95 | srcs: [ |
Haibo Huang | 165065a | 2018-07-23 17:26:52 -0700 | [diff] [blame] | 96 | "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 Hughes | 22ad79b | 2018-04-10 22:44:35 -0700 | [diff] [blame] | 105 | ], |
| 106 | static_libs: ["libpcap"], |
| 107 | test_per_src: true, |
| 108 | } |