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