1*8b26181fSAndroid Build Coastguard Workerpackage { 2*8b26181fSAndroid Build Coastguard Worker default_applicable_licenses: ["external_libpcap_license"], 3*8b26181fSAndroid Build Coastguard Worker} 4*8b26181fSAndroid Build Coastguard Worker 5*8b26181fSAndroid Build Coastguard Workerlicense { 6*8b26181fSAndroid Build Coastguard Worker name: "external_libpcap_license", 7*8b26181fSAndroid Build Coastguard Worker visibility: [":__subpackages__"], 8*8b26181fSAndroid Build Coastguard Worker license_kinds: [ 9*8b26181fSAndroid Build Coastguard Worker "SPDX-license-identifier-Apache-2.0", 10*8b26181fSAndroid Build Coastguard Worker "SPDX-license-identifier-BSD", 11*8b26181fSAndroid Build Coastguard Worker "SPDX-license-identifier-ISC", 12*8b26181fSAndroid Build Coastguard Worker "SPDX-license-identifier-MIT", 13*8b26181fSAndroid Build Coastguard Worker ], 14*8b26181fSAndroid Build Coastguard Worker license_text: [ 15*8b26181fSAndroid Build Coastguard Worker "LICENSE", 16*8b26181fSAndroid Build Coastguard Worker "NOTICE", 17*8b26181fSAndroid Build Coastguard Worker ], 18*8b26181fSAndroid Build Coastguard Worker} 19*8b26181fSAndroid Build Coastguard Worker 20*8b26181fSAndroid Build Coastguard Workercc_defaults { 21*8b26181fSAndroid Build Coastguard Worker name: "libpcap_defaults", 22*8b26181fSAndroid Build Coastguard Worker cflags: [ 23*8b26181fSAndroid Build Coastguard Worker "-D_BSD_SOURCE", 24*8b26181fSAndroid Build Coastguard Worker "-DHAVE_CONFIG_H", 25*8b26181fSAndroid Build Coastguard Worker "-Dlint", 26*8b26181fSAndroid Build Coastguard Worker "-D_U_=__attribute__((__unused__))", 27*8b26181fSAndroid Build Coastguard Worker "-Wall", 28*8b26181fSAndroid Build Coastguard Worker "-Werror", 29*8b26181fSAndroid Build Coastguard Worker "-Wno-macro-redefined", 30*8b26181fSAndroid Build Coastguard Worker "-Wno-pointer-arith", 31*8b26181fSAndroid Build Coastguard Worker "-Wno-sign-compare", 32*8b26181fSAndroid Build Coastguard Worker "-Wno-unused-parameter", 33*8b26181fSAndroid Build Coastguard Worker "-Wno-unused-result", 34*8b26181fSAndroid Build Coastguard Worker "-Wno-tautological-compare", 35*8b26181fSAndroid Build Coastguard Worker ], 36*8b26181fSAndroid Build Coastguard Worker} 37*8b26181fSAndroid Build Coastguard Worker 38*8b26181fSAndroid Build Coastguard Workercc_library { 39*8b26181fSAndroid Build Coastguard Worker name: "libpcap", 40*8b26181fSAndroid Build Coastguard Worker host_supported: true, 41*8b26181fSAndroid Build Coastguard Worker vendor_available: true, 42*8b26181fSAndroid Build Coastguard Worker // Build against the NDK 29 because it's used by the network stack mainline module tests, which 43*8b26181fSAndroid Build Coastguard Worker // need to support Q. 44*8b26181fSAndroid Build Coastguard Worker // TODO(b/148792341): stop hardcoding sdk_version integers in libraries all over the tree and 45*8b26181fSAndroid Build Coastguard Worker // define a min_apex_sdk_version property that all module code can use. 46*8b26181fSAndroid Build Coastguard Worker sdk_version: "29", 47*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 48*8b26181fSAndroid Build Coastguard Worker 49*8b26181fSAndroid Build Coastguard Worker // (Matches order in libpcap's Makefile.) 50*8b26181fSAndroid Build Coastguard Worker srcs: [ 51*8b26181fSAndroid Build Coastguard Worker "bpf_dump.c", 52*8b26181fSAndroid Build Coastguard Worker "bpf_filter.c", 53*8b26181fSAndroid Build Coastguard Worker "bpf_image.c", 54*8b26181fSAndroid Build Coastguard Worker "etherent.c", 55*8b26181fSAndroid Build Coastguard Worker "fad-getad.c", 56*8b26181fSAndroid Build Coastguard Worker "fmtutils.c", 57*8b26181fSAndroid Build Coastguard Worker "gencode.c", 58*8b26181fSAndroid Build Coastguard Worker "grammar.c", 59*8b26181fSAndroid Build Coastguard Worker "nametoaddr.c", 60*8b26181fSAndroid Build Coastguard Worker "optimize.c", 61*8b26181fSAndroid Build Coastguard Worker "pcap-common.c", 62*8b26181fSAndroid Build Coastguard Worker "pcap-linux.c", 63*8b26181fSAndroid Build Coastguard Worker "pcap-netfilter-linux-android.c", 64*8b26181fSAndroid Build Coastguard Worker "pcap-usb-linux-common.c", 65*8b26181fSAndroid Build Coastguard Worker "pcap-usb-linux.c", 66*8b26181fSAndroid Build Coastguard Worker "pcap-util.c", 67*8b26181fSAndroid Build Coastguard Worker "pcap.c", 68*8b26181fSAndroid Build Coastguard Worker "savefile.c", 69*8b26181fSAndroid Build Coastguard Worker "scanner.c", 70*8b26181fSAndroid Build Coastguard Worker "sf-pcap.c", 71*8b26181fSAndroid Build Coastguard Worker "sf-pcapng.c", 72*8b26181fSAndroid Build Coastguard Worker ], 73*8b26181fSAndroid Build Coastguard Worker 74*8b26181fSAndroid Build Coastguard Worker target: { 75*8b26181fSAndroid Build Coastguard Worker linux: { 76*8b26181fSAndroid Build Coastguard Worker srcs: [ 77*8b26181fSAndroid Build Coastguard Worker "missing/strlcpy.c", 78*8b26181fSAndroid Build Coastguard Worker ], 79*8b26181fSAndroid Build Coastguard Worker }, 80*8b26181fSAndroid Build Coastguard Worker darwin: { 81*8b26181fSAndroid Build Coastguard Worker enabled: false, 82*8b26181fSAndroid Build Coastguard Worker }, 83*8b26181fSAndroid Build Coastguard Worker }, 84*8b26181fSAndroid Build Coastguard Worker 85*8b26181fSAndroid Build Coastguard Worker export_include_dirs: ["."], 86*8b26181fSAndroid Build Coastguard Worker} 87*8b26181fSAndroid Build Coastguard Worker 88*8b26181fSAndroid Build Coastguard Worker// 89*8b26181fSAndroid Build Coastguard Worker// Tests (but not _unit_ tests). 90*8b26181fSAndroid Build Coastguard Worker// 91*8b26181fSAndroid Build Coastguard Worker// It's unlikely anyone's running these manually, but at least compiling them 92*8b26181fSAndroid Build Coastguard Worker// shows we can compile libpcap callers... 93*8b26181fSAndroid Build Coastguard Worker// 94*8b26181fSAndroid Build Coastguard Worker 95*8b26181fSAndroid Build Coastguard Workercc_test { 96*8b26181fSAndroid Build Coastguard Worker name: "libpcap_can_set_rfmon_test", 97*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 98*8b26181fSAndroid Build Coastguard Worker gtest: false, 99*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/can_set_rfmon_test.c"], 100*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 101*8b26181fSAndroid Build Coastguard Worker} 102*8b26181fSAndroid Build Coastguard Worker 103*8b26181fSAndroid Build Coastguard Workercc_test { 104*8b26181fSAndroid Build Coastguard Worker name: "libpcap_capture_test", 105*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 106*8b26181fSAndroid Build Coastguard Worker gtest: false, 107*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/capturetest.c"], 108*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 109*8b26181fSAndroid Build Coastguard Worker} 110*8b26181fSAndroid Build Coastguard Worker 111*8b26181fSAndroid Build Coastguard Workercc_test { 112*8b26181fSAndroid Build Coastguard Worker name: "libpcap_filter_test", 113*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 114*8b26181fSAndroid Build Coastguard Worker gtest: false, 115*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/filtertest.c"], 116*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 117*8b26181fSAndroid Build Coastguard Worker} 118*8b26181fSAndroid Build Coastguard Worker 119*8b26181fSAndroid Build Coastguard Workercc_test { 120*8b26181fSAndroid Build Coastguard Worker name: "libpcap_findalldevs_test", 121*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 122*8b26181fSAndroid Build Coastguard Worker gtest: false, 123*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/findalldevstest.c"], 124*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 125*8b26181fSAndroid Build Coastguard Worker} 126*8b26181fSAndroid Build Coastguard Worker 127*8b26181fSAndroid Build Coastguard Workercc_test { 128*8b26181fSAndroid Build Coastguard Worker name: "libpcap_open_test", 129*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 130*8b26181fSAndroid Build Coastguard Worker gtest: false, 131*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/opentest.c"], 132*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 133*8b26181fSAndroid Build Coastguard Worker} 134*8b26181fSAndroid Build Coastguard Worker 135*8b26181fSAndroid Build Coastguard Workercc_test { 136*8b26181fSAndroid Build Coastguard Worker name: "libpcap_reactivate_test", 137*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 138*8b26181fSAndroid Build Coastguard Worker gtest: false, 139*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/reactivatetest.c"], 140*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 141*8b26181fSAndroid Build Coastguard Worker} 142*8b26181fSAndroid Build Coastguard Worker 143*8b26181fSAndroid Build Coastguard Workercc_test { 144*8b26181fSAndroid Build Coastguard Worker name: "libpcap_selpoll_test", 145*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 146*8b26181fSAndroid Build Coastguard Worker gtest: false, 147*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/selpolltest.c"], 148*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 149*8b26181fSAndroid Build Coastguard Worker} 150*8b26181fSAndroid Build Coastguard Worker 151*8b26181fSAndroid Build Coastguard Workercc_test { 152*8b26181fSAndroid Build Coastguard Worker name: "libpcap_threadsignal_test", 153*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 154*8b26181fSAndroid Build Coastguard Worker gtest: false, 155*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/threadsignaltest.c"], 156*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 157*8b26181fSAndroid Build Coastguard Worker} 158*8b26181fSAndroid Build Coastguard Worker 159*8b26181fSAndroid Build Coastguard Workercc_test { 160*8b26181fSAndroid Build Coastguard Worker name: "libpcap_valgrind_test", 161*8b26181fSAndroid Build Coastguard Worker defaults: ["libpcap_defaults"], 162*8b26181fSAndroid Build Coastguard Worker gtest: false, 163*8b26181fSAndroid Build Coastguard Worker srcs: ["testprogs/valgrindtest.c"], 164*8b26181fSAndroid Build Coastguard Worker static_libs: ["libpcap"], 165*8b26181fSAndroid Build Coastguard Worker} 166