ipset: size optimizations
authorDeng Qingfang <dengqf6@mail2.sysu.edu.cn>
Sat, 23 Feb 2019 16:46:54 +0000 (00:46 +0800)
committerHans Dedecker <dedeckeh@gmail.com>
Sun, 17 Mar 2019 21:17:48 +0000 (22:17 +0100)
ipset utility was linked statically to libipset. Disable static library for dynamic linking to save space.
Add -Wl,--gc-sections,--as-needed for further reduction

MIPS ipk size:
ipset: 29KiB -> 2KiB
libipset: 39KiB -> 38KiB

Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
package/network/utils/ipset/Makefile

index 37cff3aca4b48397766e096a7517c6af0fa30111..69953c2e2309157b9ac91baf2e07f7a0f8ebce1e 100644 (file)
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ipset
 PKG_VERSION:=7.1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://ipset.netfilter.org
@@ -43,8 +43,11 @@ $(call Package/ipset/Default)
 endef
 
 CONFIGURE_ARGS += \
+       --disable-static \
        --with-kbuild="$(LINUX_DIR)"
 
+TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
+
 MAKE_FLAGS += \
        ARCH="$(LINUX_KARCH)" \
        SHELL="$(BASH)"
@@ -52,7 +55,7 @@ MAKE_FLAGS += \
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/include/libipset $(1)/usr/include/
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset.{a,so*} $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset.so* $(1)/usr/lib/
        $(CP) $(PKG_BUILD_DIR)/lib/libipset.pc $(1)/usr/lib/pkgconfig/
 endef