e88c288be609a870696b72c0a6e6a87b155c791d
[openwrt/openwrt.git] / package / network / utils / iptables / patches / 600-shared-libext.patch
1 --- a/extensions/GNUmakefile.in
2 +++ b/extensions/GNUmakefile.in
3 @@ -85,7 +85,7 @@ pf6_solibs := $(patsubst %,libip6t_%.
4 #
5 # Building blocks
6 #
7 -targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
8 +targets := libiptext.so libiptext4.so libiptext6.so libiptext_ebt.so libiptext_arpt.so matches.man targets.man
9 targets_install :=
10 libext_objs := ${pfx_objs}
11 libext_ebt_objs := ${pfb_objs}
12 @@ -112,7 +112,7 @@ clean:
13 distclean: clean
14
15 init%.o: init%.c
16 - ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<;
17 + ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
18
19 -include .*.d
20
21 @@ -144,22 +144,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn
22 # handling code in the Makefiles.
23 #
24 lib%.o: ${srcdir}/lib%.c
25 - ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<;
26 + ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
27
28 -libext.a: initext.o ${libext_objs}
29 - ${AM_VERBOSE_AR} ${AR} crs $@ $^;
30 +libiptext.so: initext.o ${libext_objs}
31 + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
32
33 -libext_ebt.a: initextb.o ${libext_ebt_objs}
34 - ${AM_VERBOSE_AR} ${AR} crs $@ $^;
35 +libiptext_ebt.so: initextb.o ${libext_ebt_objs}
36 + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
37
38 -libext_arpt.a: initexta.o ${libext_arpt_objs}
39 - ${AM_VERBOSE_AR} ${AR} crs $@ $^;
40 +libiptext_arpt.so: initexta.o ${libext_arpt_objs}
41 + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
42
43 -libext4.a: initext4.o ${libext4_objs}
44 - ${AM_VERBOSE_AR} ${AR} crs $@ $^;
45 +libiptext4.so: initext4.o ${libext4_objs}
46 + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
47
48 -libext6.a: initext6.o ${libext6_objs}
49 - ${AM_VERBOSE_AR} ${AR} crs $@ $^;
50 +libiptext6.so: initext6.o ${libext6_objs}
51 + ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
52
53 initext_func := $(addprefix xt_,${pfx_build_static})
54 initextb_func := $(addprefix ebt_,${pfb_build_static})
55 --- a/iptables/Makefile.am
56 +++ b/iptables/Makefile.am
57 @@ -8,7 +8,8 @@ BUILT_SOURCES =
58
59 xtables_legacy_multi_SOURCES = xtables-legacy-multi.c iptables-xml.c
60 xtables_legacy_multi_CFLAGS = ${AM_CFLAGS}
61 -xtables_legacy_multi_LDADD = ../extensions/libext.a
62 +xtables_legacy_multi_LDADD =
63 +xtables_legacy_multi_LDFLAGS = -L../extensions/ -liptext
64 if ENABLE_STATIC
65 xtables_legacy_multi_CFLAGS += -DALL_INCLUSIVE
66 endif
67 @@ -16,13 +17,15 @@ if ENABLE_IPV4
68 xtables_legacy_multi_SOURCES += iptables-save.c iptables-restore.c \
69 iptables-standalone.c iptables.c
70 xtables_legacy_multi_CFLAGS += -DENABLE_IPV4
71 -xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a
72 +xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la
73 +xtables_legacy_multi_LDFLAGS += -liptext4
74 endif
75 if ENABLE_IPV6
76 xtables_legacy_multi_SOURCES += ip6tables-save.c ip6tables-restore.c \
77 ip6tables-standalone.c ip6tables.c
78 xtables_legacy_multi_CFLAGS += -DENABLE_IPV6
79 -xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a
80 +xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la
81 +xtables_legacy_multi_LDFLAGS += -liptext6
82 endif
83 xtables_legacy_multi_SOURCES += xshared.c
84 xtables_legacy_multi_LDADD += ../libxtables/libxtables.la -lm
85 @@ -32,7 +35,8 @@ if ENABLE_NFTABLES
86 BUILT_SOURCES += xtables-config-parser.h
87 xtables_nft_multi_SOURCES = xtables-nft-multi.c iptables-xml.c
88 xtables_nft_multi_CFLAGS = ${AM_CFLAGS}
89 -xtables_nft_multi_LDADD = ../extensions/libext.a ../extensions/libext_ebt.a
90 +xtables_nft_multi_LDADD =
91 +xtables_nft_multi_LDFLAGS = -L../extensions/ -liptext -liptext_ebt
92 if ENABLE_STATIC
93 xtables_nft_multi_CFLAGS += -DALL_INCLUSIVE
94 endif
95 @@ -47,7 +51,8 @@ xtables_nft_multi_SOURCES += xtables-sav
96 xtables-eb-standalone.c xtables-eb.c \
97 xtables-eb-translate.c \
98 xtables-translate.c
99 -xtables_nft_multi_LDADD += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS} ../extensions/libext4.a ../extensions/libext6.a ../extensions/libext_ebt.a ../extensions/libext_arpt.a
100 +xtables_nft_multi_LDADD += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS}
101 +xtables_nft_multi_LDFLAGS += -liptext4 -liptext6 -liptext_arpt
102 # yacc and lex generate dirty code
103 xtables_nft_multi-xtables-config-parser.o xtables_nft_multi-xtables-config-syntax.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls
104 xtables_nft_multi_SOURCES += xshared.c