1package { 2 // See: http://go/android-license-faq 3 // A large-scale-change added 'default_applicable_licenses' to import 4 // all of the 'license_kinds' from "external_iptables_license" 5 // to get the below license kinds: 6 // SPDX-license-identifier-GPL 7 // SPDX-license-identifier-GPL-2.0 8 default_applicable_licenses: ["external_iptables_license"], 9} 10 11cc_defaults { 12 name: "libext_defaults", 13 defaults: ["iptables_defaults"], 14 15 header_libs: ["iptables_config_header"], 16 17 cflags: [ 18 "-DNO_SHARED_LIBS=1", 19 "-DXTABLES_INTERNAL", 20 21 "-Wno-format", 22 "-Wno-missing-field-initializers", 23 // libxt_recent.c:202:11: error: address of array 'info->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] 24 "-Wno-pointer-bool-conversion", 25 "-Wno-tautological-pointer-compare", 26 ], 27} 28 29// All of the extension source files have the same function name (_init). Since we don't support 30// per-file cflags that upstream uses, instead: 31// 32// 1. Rewrite the source files with filter_init to have per-file function names. (libext*_srcs) 33// 2. Create a new source file that defines a function (init_extensions*) with gen_init that calls 34// all of the renamed _init functions (libext*_init) 35// 36// This all happens three times -- once each for libext, libext4, libext6 37 38genrule { 39 name: "libext_init", 40 cmd: "$(location gen_init) '' $(locations libxt_*.c) > $(out)", 41 srcs: [ 42 "gen_init", 43 "libxt_*.c", 44 ], 45 out: ["initext.c"], 46 exclude_srcs: [ 47 // Exclude some modules that are problematic to compile (types/headers) 48 "libxt_TCPOPTSTRIP.c", 49 "libxt_connlabel.c", 50 "libxt_cgroup.c", 51 52 "libxt_dccp.c", 53 "libxt_ipvs.c", 54 ], 55} 56 57gensrcs { 58 name: "libext_srcs", 59 tool_files: ["filter_init"], 60 cmd: "$(location filter_init) $(in) > $(out)", 61 output_extension: "c", 62 srcs: ["libxt_*.c"], 63 exclude_srcs: [ 64 // Exclude some modules that are problematic to compile (types/headers) 65 "libxt_TCPOPTSTRIP.c", 66 "libxt_connlabel.c", 67 "libxt_cgroup.c", 68 69 "libxt_dccp.c", 70 "libxt_ipvs.c", 71 ], 72} 73 74cc_library_static { 75 name: "libext", 76 defaults: ["libext_defaults"], 77 srcs: [ 78 ":libext_init", 79 ":libext_srcs", 80 ], 81} 82 83//////////////////////////////////////////////////////////////////////////////////////////////////// 84 85genrule { 86 name: "libext4_init", 87 cmd: "$(location gen_init) '4' $(locations libipt_*.c) > $(out)", 88 srcs: [ 89 "gen_init", 90 "libipt_*.c", 91 ], 92 out: ["initext.c"], 93} 94 95gensrcs { 96 name: "libext4_srcs", 97 tool_files: ["filter_init"], 98 cmd: "$(location filter_init) $(in) > $(out)", 99 output_extension: "c", 100 srcs: ["libipt_*.c"], 101} 102 103cc_library_static { 104 name: "libext4", 105 defaults: ["libext_defaults"], 106 srcs: [ 107 ":libext4_init", 108 ":libext4_srcs", 109 ], 110} 111 112//////////////////////////////////////////////////////////////////////////////////////////////////// 113 114genrule { 115 name: "libext6_init", 116 cmd: "$(location gen_init) '6' $(locations libip6t_*.c) > $(out)", 117 srcs: [ 118 "gen_init", 119 "libip6t_*.c", 120 ], 121 out: ["initext.c"], 122} 123 124gensrcs { 125 name: "libext6_srcs", 126 tool_files: ["filter_init"], 127 cmd: "$(location filter_init) $(in) > $(out)", 128 output_extension: "c", 129 srcs: ["libip6t_*.c"], 130} 131 132cc_library_static { 133 name: "libext6", 134 defaults: ["libext_defaults"], 135 srcs: [ 136 ":libext6_init", 137 ":libext6_srcs", 138 ], 139} 140