-define Package/iptables/install
- $(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_DATA) ./files/firewall.config $(1)/etc/config/firewall
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/firewall.init $(1)/etc/init.d/firewall
- $(INSTALL_BIN) ./files/firewall.user $(1)/etc/
+define Package/libxtables
+ $(call Package/iptables/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=IPv4/IPv6 firewall - shared xtables library
+endef
+
+define Package/libipq
+ $(call Package/iptables/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=IPv4/IPv6 firewall - shared libipq library
+endef
+
+TARGET_CPPFLAGS := \
+ -I$(PKG_BUILD_DIR)/include \
+ -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include \
+ $(TARGET_CPPFLAGS)
+
+TARGET_CFLAGS += \
+ -I$(PKG_BUILD_DIR)/include \
+ -I$(LINUX_DIR)/arch/$(LINUX_KARCH)/include
+
+CONFIGURE_ARGS += \
+ --enable-shared \
+ --enable-devel \
+ --enable-ipv6 \
+ --enable-libipq \
+ --with-kernel="$(LINUX_DIR)" \
+ --with-xtlibdir=/usr/lib/iptables
+
+MAKE_FLAGS := \
+ $(TARGET_CONFIGURE_OPTS) \
+ COPT_FLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="-rdynamic" \
+ KERNEL_DIR="$(LINUX_DIR)" PREFIX=/usr \
+ KBUILD_OUTPUT="$(LINUX_DIR)" \
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(INSTALL_DIR) $(1)/usr/include/iptables
+ $(INSTALL_DIR) $(1)/usr/include/net/netfilter
+
+ # XXX: iptables header fixup, some headers are not installed by iptables anymore
+ $(CP) $(PKG_BUILD_DIR)/include/net/netfilter/*.h $(1)/usr/include/net/netfilter/
+ $(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
+ $(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
+ $(CP) $(PKG_BUILD_DIR)/include/libipq/libipq.h $(1)/usr/include/
+ $(CP) $(PKG_BUILD_DIR)/include/libipulog $(1)/usr/include/
+ $(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
+
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/