Openwrt/package/network/utils/iptables/patches/600-shared-libext.patch
Jo-Philipp Wich 1c00b6bc7f iptables: reduce binary size
* drop unused lenient restore patch
 * instead of statically linking core extensions, build shared libraries
   for reuse in fw3
 * strip outdated match revisions and aliases to trim down library size

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 45758
2015-05-26 09:16:50 +00:00

79 lines
3.3 KiB
Diff

Index: iptables-1.4.21/extensions/GNUmakefile.in
===================================================================
--- iptables-1.4.21.orig/extensions/GNUmakefile.in
+++ iptables-1.4.21/extensions/GNUmakefile.in
@@ -71,7 +71,7 @@ pf6_solibs := $(patsubst %,libip6t_%.
#
# Building blocks
#
-targets := libext.a libext4.a libext6.a matches.man targets.man
+targets := libiptext.so libiptext4.so libiptext6.so matches.man targets.man
targets_install :=
libext_objs := ${pfx_objs}
libext4_objs := ${pf4_objs}
@@ -96,7 +96,7 @@ clean:
distclean: clean
init%.o: init%.c
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<;
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
-include .*.d
@@ -130,16 +130,16 @@ xt_statistic_LIBADD = -lm
# handling code in the Makefiles.
#
lib%.o: ${srcdir}/lib%.c
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<;
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
-libext.a: initext.o ${libext_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext.so: initext.o ${libext_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
-libext4.a: initext4.o ${libext4_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext4.so: initext4.o ${libext4_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
-libext6.a: initext6.o ${libext6_objs}
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
+libiptext6.so: initext6.o ${libext6_objs}
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables ${$*_LIBADD};
initext_func := $(addprefix xt_,${pfx_build_static})
initext4_func := $(addprefix ipt_,${pf4_build_static})
Index: iptables-1.4.21/iptables/Makefile.am
===================================================================
--- iptables-1.4.21.orig/iptables/Makefile.am
+++ iptables-1.4.21/iptables/Makefile.am
@@ -5,7 +5,8 @@ AM_CPPFLAGS = ${regular_CPPFLAGS} -
xtables_multi_SOURCES = xtables-multi.c iptables-xml.c
xtables_multi_CFLAGS = ${AM_CFLAGS}
-xtables_multi_LDADD = ../extensions/libext.a
+xtables_multi_LDADD =
+xtables_multi_LDFLAGS = -L../extensions/ -liptext
if ENABLE_STATIC
xtables_multi_CFLAGS += -DALL_INCLUSIVE
endif
@@ -13,13 +14,15 @@ if ENABLE_IPV4
xtables_multi_SOURCES += iptables-save.c iptables-restore.c \
iptables-standalone.c iptables.c
xtables_multi_CFLAGS += -DENABLE_IPV4
-xtables_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a
+xtables_multi_LDADD += ../libiptc/libip4tc.la
+xtables_multi_LDFLAGS += -liptext4
endif
if ENABLE_IPV6
xtables_multi_SOURCES += ip6tables-save.c ip6tables-restore.c \
ip6tables-standalone.c ip6tables.c
xtables_multi_CFLAGS += -DENABLE_IPV6
-xtables_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a
+xtables_multi_LDADD += ../libiptc/libip6tc.la
+xtables_multi_LDFLAGS += -liptext6
endif
xtables_multi_SOURCES += xshared.c
xtables_multi_LDADD += ../libxtables/libxtables.la -lm