[package] iptables: add some musl portability fixes
[openwrt/svn-archive/archive.git] / package / network / utils / iptables / patches / 200-configurable_builtin.patch
1 --- a/extensions/GNUmakefile.in
2 +++ b/extensions/GNUmakefile.in
3 @@ -40,9 +40,24 @@ pfx_build_mod := $(patsubst ${srcdir}/li
4 pfx_build_mod := $(filter-out @blacklist_modules@,${pfx_build_mod})
5 pf4_build_mod := $(filter-out @blacklist_modules@,${pf4_build_mod})
6 pf6_build_mod := $(filter-out @blacklist_modules@,${pf6_build_mod})
7 -pfx_objs := $(patsubst %,libxt_%.o,${pfx_build_mod})
8 -pf4_objs := $(patsubst %,libipt_%.o,${pf4_build_mod})
9 -pf6_objs := $(patsubst %,libip6t_%.o,${pf6_build_mod})
10 +
11 +ifdef BUILTIN_MODULES
12 +pfx_build_static := $(filter $(BUILTIN_MODULES),${pfx_build_mod})
13 +pf4_build_static := $(filter $(BUILTIN_MODULES),${pf4_build_mod})
14 +pf6_build_static := $(filter $(BUILTIN_MODULES),${pf6_build_mod})
15 +else
16 +@ENABLE_STATIC_TRUE@ pfx_build_static := $(pfx_build_mod)
17 +@ENABLE_STATIC_TRUE@ pf4_build_static := $(pf4_build_mod)
18 +@ENABLE_STATIC_TRUE@ pf6_build_static := $(pf6_build_mod)
19 +endif
20 +
21 +pfx_build_mod := $(filter-out $(pfx_build_static),$(pfx_build_mod))
22 +pf4_build_mod := $(filter-out $(pf4_build_static),$(pf4_build_mod))
23 +pf6_build_mod := $(filter-out $(pf6_build_static),$(pf6_build_mod))
24 +
25 +pfx_objs := $(patsubst %,libxt_%.o,${pfx_build_static})
26 +pf4_objs := $(patsubst %,libipt_%.o,${pf4_build_static})
27 +pf6_objs := $(patsubst %,libip6t_%.o,${pf6_build_static})
28 pfx_solibs := $(patsubst %,libxt_%.so,${pfx_build_mod})
29 pf4_solibs := $(patsubst %,libipt_%.so,${pf4_build_mod})
30 pf6_solibs := $(patsubst %,libip6t_%.so,${pf6_build_mod})
31 @@ -54,10 +69,10 @@ pf6_solibs := $(patsubst %,libip6t_%.
32 targets := libext4.a libext6.a matches4.man matches6.man \
33 targets4.man targets6.man
34 targets_install :=
35 -@ENABLE_STATIC_TRUE@ libext4_objs := ${pfx_objs} ${pf4_objs}
36 -@ENABLE_STATIC_TRUE@ libext6_objs := ${pfx_objs} ${pf6_objs}
37 -@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
38 -@ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
39 +libext4_objs := ${pfx_objs} ${pf4_objs}
40 +libext6_objs := ${pfx_objs} ${pf6_objs}
41 +targets += ${pfx_solibs} ${pf4_solibs} ${pf6_solibs}
42 +targets_install := $(strip ${targets_install} ${pfx_solibs} ${pf4_solibs} ${pf6_solibs})
43
44 .SECONDARY:
45
46 @@ -107,8 +122,8 @@ libext4.a: initext4.o ${libext4_objs}
47 libext6.a: initext6.o ${libext6_objs}
48 ${AM_VERBOSE_AR} ${AR} crs $@ $^;
49
50 -initext_func := $(addprefix xt_,${pfx_build_mod}) $(addprefix ipt_,${pf4_build_mod})
51 -initext6_func := $(addprefix xt_,${pfx_build_mod}) $(addprefix ip6t_,${pf6_build_mod})
52 +initext_func := $(addprefix xt_,${pfx_build_static}) $(addprefix ipt_,${pf4_build_static})
53 +initext6_func := $(addprefix xt_,${pfx_build_static}) $(addprefix ip6t_,${pf6_build_static})
54
55 .initext4.dd: FORCE
56 @echo "${initext_func}" >$@.tmp; \