| 1 |
# $FreeWRT$ |
| 2 |
#- |
| 3 |
# This file is part of the FreeWRT project. FreeWRT is copyrighted |
| 4 |
# material, please see the LICENCE file in the top-level directory |
| 5 |
# or at http://www.freewrt.org/licence for details. |
| 6 |
|
| 7 |
include $(TOPDIR)/rules.mk |
| 8 |
|
| 9 |
PKG_NAME:= iptables |
| 10 |
PKG_VERSION:= 1.3.8 |
| 11 |
PKG_RELEASE:= 1 |
| 12 |
PKG_MD5SUM:= 0a9209f928002e5eee9cdff8fef4d4b3 |
| 13 |
PKG_INIT:= 45 |
| 14 |
|
| 15 |
PKG_SOURCE_URL:= http://www.netfilter.org/projects/iptables/files \ |
| 16 |
ftp://ftp.be.netfilter.org/pub/iptables \ |
| 17 |
ftp://ftp.de.netfilter.org/pub/iptables \ |
| 18 |
ftp://ftp.no.netfilter.org/pub/iptables |
| 19 |
PKG_SOURCE:= $(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 20 |
|
| 21 |
|
| 22 |
define IPKG_plugin_template |
| 23 |
|
| 24 |
$$(IPKG_$(1)): |
| 25 |
install -m0755 -d $$(IDIR_$(1))/usr/lib/iptables |
| 26 |
for m in $$(patsubst xt_%,ipt_%,$(2)); do \ |
| 27 |
$(INSTALL_DATA) $(WRKINST)/usr/lib/iptables/lib$$$${m}.so $$(IDIR_$(1))/usr/lib/iptables/ ; \ |
| 28 |
done |
| 29 |
@[ -z "$(3)" ] || $(MAKE) $(3) |
| 30 |
$(RSTRIP) $$(IDIR_$(1)) |
| 31 |
$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR) |
| 32 |
|
| 33 |
endef |
| 34 |
|
| 35 |
include $(TOPDIR)/mk/package.mk |
| 36 |
include $(LINUX_DIR)/.config |
| 37 |
include $(TOPDIR)/mk/netfilter.mk |
| 38 |
|
| 39 |
$(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 40 |
$(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 41 |
$(eval $(call PKG_template,IPTABLES_FIREWALL_SCRIPT,iptables-firewall-script,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 42 |
$(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 43 |
|
| 44 |
$(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 45 |
$(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 46 |
$(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 47 |
$(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-imq,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 48 |
$(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 49 |
$(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 50 |
$(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 51 |
$(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) |
| 52 |
|
| 53 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPT_CONNTRACK-m))) |
| 54 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPT_EXTRA-m))) |
| 55 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPT_FILTER-m),layer7-install)) |
| 56 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPT_IMQ-m))) |
| 57 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPT_IPOPT-m))) |
| 58 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPT_IPSEC-m))) |
| 59 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPT_NAT-m))) |
| 60 |
$(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPT_ULOG-m))) |
| 61 |
|
| 62 |
$(WRKBUILD)/.configured: |
| 63 |
touch $@ |
| 64 |
|
| 65 |
$(WRKBUILD)/.built: |
| 66 |
chmod a+x $(WRKBUILD)/extensions/.*-test* |
| 67 |
$(MAKE) -C $(WRKBUILD) \ |
| 68 |
$(TARGET_CONFIGURE_OPTS) \ |
| 69 |
CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \ |
| 70 |
KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \ |
| 71 |
DESTDIR="$(WRKINST)" \ |
| 72 |
all install install-devel |
| 73 |
touch $@ |
| 74 |
|
| 75 |
$(IPKG_IPTABLES): |
| 76 |
$(INSTALL_DIR) $(IDIR_IPTABLES)/usr/sbin |
| 77 |
$(INSTALL_DIR) $(IDIR_IPTABLES)/usr/lib/iptables |
| 78 |
$(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/ |
| 79 |
(cd $(WRKINST)/usr/lib/iptables ; \ |
| 80 |
$(INSTALL_DATA) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(IDIR_IPTABLES)/usr/lib/iptables/ \ |
| 81 |
) |
| 82 |
$(RSTRIP) $(IDIR_IPTABLES) |
| 83 |
$(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR) |
| 84 |
|
| 85 |
$(IPKG_IPTABLES_FIREWALL_SCRIPT): |
| 86 |
$(INSTALL_DIR) $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d |
| 87 |
$(INSTALL_BIN) ./files/firewall.init $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d/S$(PKG_INIT)firewall |
| 88 |
$(INSTALL_BIN) -m0644 ./files/firewall.conf $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/ |
| 89 |
$(IPKG_BUILD) $(IDIR_IPTABLES_FIREWALL_SCRIPT) $(PACKAGE_DIR) |
| 90 |
|
| 91 |
|
| 92 |
$(IPKG_IPTABLES_UTILS): |
| 93 |
$(INSTALL_DIR) $(IDIR_IPTABLES_UTILS)/usr/sbin |
| 94 |
$(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/ |
| 95 |
$(RSTRIP) $(IDIR_IPTABLES_UTILS) |
| 96 |
$(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR) |
| 97 |
|
| 98 |
$(IPKG_IP6TABLES): |
| 99 |
$(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/sbin |
| 100 |
$(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/lib/iptables |
| 101 |
$(INSTALL_BIN) $(WRKINST)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/ |
| 102 |
(cd $(WRKINST)/usr/lib/iptables ; \ |
| 103 |
$(INSTALL_DATA) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/iptables/ \ |
| 104 |
) |
| 105 |
$(RSTRIP) $(IDIR_IP6TABLES) |
| 106 |
$(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR) |
| 107 |
|
| 108 |
$(STAGING_DIR)/usr/lib/libipq.a: $(WRKBUILD)/.built |
| 109 |
$(MAKE) -C $(WRKBUILD) \ |
| 110 |
$(TARGET_CONFIGURE_OPTS) \ |
| 111 |
CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \ |
| 112 |
KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \ |
| 113 |
DESTDIR="$(STAGING_DIR)" \ |
| 114 |
install install-devel |
| 115 |
|
| 116 |
layer7-install: |
| 117 |
$(INSTALL_DIR) $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols |
| 118 |
$(INSTALL_DATA) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/ |
| 119 |
|
| 120 |
install-dev: $(STAGING_DIR)/usr/lib/libipq.a |
| 121 |
|
| 122 |
uninstall-dev: |
| 123 |
rm -rf $(STAGING_DIR)/usr/include/libipq.h |
| 124 |
rm -rf $(STAGING_DIR)/usr/lib/libipq.a |
| 125 |
|
| 126 |
compile-targets: install-dev |
| 127 |
clean-targets: uninstall-dev |