source: freewrt/package/iptables/Makefile@ f15c9543

freewrt_2_0
Last change on this file since f15c9543 was b68978d, checked in by Waldemar Brodkorb <wbx@…>, 4 months ago

make the FreeWRT firewall script work, needs more cleanup

  • Property mode set to 100644
File size: 5.0 KB
Line 
1# This file is part of the FreeWRT project. FreeWRT is copyrighted
2# material, please see the LICENCE file in the top-level directory
3
4include $(TOPDIR)/rules.mk
5
6PKG_NAME:= iptables
7PKG_VERSION:= 1.8.11
8PKG_RELEASE:= 1
9PKG_MD5SUM:= 44191ce12055da9790a92429c771ba50
10PKG_INIT:= 45
11
12PKG_SOURCE_URL:= http://www.netfilter.org/projects/iptables/files
13PKG_SOURCE:= $(PKG_NAME)-$(PKG_VERSION).tar.xz
14
15define IPKG_plugin_template
16
17$$(IPKG_$(1)):
18 install -m0755 -d $$(IDIR_$(1))/usr/lib/xtables
19 for m in $(2); do \
20 $(INSTALL_DATA) $(WRKINST)/usr/lib/xtables/lib$$$${m}.so $$(IDIR_$(1))/usr/lib/xtables/ ; \
21 done
22 @[ -z "$(3)" ] || $(MAKE) $(3)
23 $(RSTRIP) $$(IDIR_$(1))
24 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
25
26endef
27
28include $(TOPDIR)/mk/package.mk
29include $(LINUX_DIR)/.config
30include $(TOPDIR)/mk/netfilter.mk
31
32$(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
33$(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
34$(eval $(call PKG_template,IPTABLES_FIREWALL_SCRIPT,iptables-firewall-script,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
35$(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
36
37$(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
38$(eval $(call PKG_template,IPTABLES_MOD_REJECT,iptables-mod-reject,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
39$(eval $(call PKG_template,IPTABLES_MOD_TCPMSS,iptables-mod-tcpmss,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
40$(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
41$(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
42$(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-imq,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
43$(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
44$(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
45$(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
46$(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
47
48$(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPT_CONNTRACK-m)))
49$(eval $(call IPKG_plugin_template,IPTABLES_MOD_REJECT,$(IPT_REJECT-m)))
50$(eval $(call IPKG_plugin_template,IPTABLES_MOD_TCPMSS,$(IPT_TCPMSS-m)))
51$(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPT_EXTRA-m)))
52$(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPT_FILTER-m),layer7-install))
53$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPT_IMQ-m)))
54$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPT_IPOPT-m)))
55$(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPT_IPSEC-m)))
56$(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPT_NAT-m)))
57$(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPT_ULOG-m)))
58
59$(WRKBUILD)/.configured:
60 (PATH="$(TARGET_PATH)"; cd $(WRKBUILD); ./configure \
61 --prefix=/usr \
62 --target=$(GNU_TARGET_NAME) \
63 --host=$(GNU_TARGET_NAME) \
64 --build=$(GNU_HOST_NAME) \
65 --disable-nftables \
66 );
67 touch $@
68
69$(WRKBUILD)/.built:
70 $(MAKE) -C $(WRKBUILD) \
71 $(TARGET_CONFIGURE_OPTS) \
72 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
73 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
74 DESTDIR="$(WRKINST)" \
75 all install
76 touch $@
77
78$(IPKG_IPTABLES):
79 $(INSTALL_DIR) $(IDIR_IPTABLES)/usr/sbin
80 $(INSTALL_DIR) $(IDIR_IPTABLES)/usr/lib/xtables
81 $(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
82 $(CP) $(WRKINST)/usr/lib/libxtables*.so* $(IDIR_IPTABLES)/usr/lib/
83 $(CP) $(WRKINST)/usr/lib/libip4tc.so* $(IDIR_IPTABLES)/usr/lib/
84 $(CP) $(WRKINST)/usr/lib/libip6tc.so* $(IDIR_IPTABLES)/usr/lib/
85 (cd $(WRKINST)/usr/lib/xtables ; \
86 $(INSTALL_DATA) libxt_standard.so libxt_tcp.so libxt_udp.so $(IDIR_IPTABLES)/usr/lib/xtables/ \
87 )
88 $(RSTRIP) $(IDIR_IPTABLES)
89 $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
90
91$(IPKG_IPTABLES_FIREWALL_SCRIPT):
92 $(INSTALL_DIR) $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d
93 $(INSTALL_BIN) ./files/firewall.init $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/init.d/S$(PKG_INIT)firewall
94 $(INSTALL_BIN) -m0644 ./files/firewall.conf $(IDIR_IPTABLES_FIREWALL_SCRIPT)/etc/
95 $(IPKG_BUILD) $(IDIR_IPTABLES_FIREWALL_SCRIPT) $(PACKAGE_DIR)
96
97
98$(IPKG_IPTABLES_UTILS):
99 $(INSTALL_DIR) $(IDIR_IPTABLES_UTILS)/usr/sbin
100 $(INSTALL_BIN) $(WRKINST)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
101 $(RSTRIP) $(IDIR_IPTABLES_UTILS)
102 $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
103
104$(IPKG_IP6TABLES):
105 $(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/sbin
106 $(INSTALL_DIR) $(IDIR_IP6TABLES)/usr/lib/iptables
107 $(INSTALL_BIN) $(WRKINST)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
108 (cd $(WRKINST)/usr/lib/xtables ; \
109 $(INSTALL_DATA) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/xtables/ \
110 )
111 $(RSTRIP) $(IDIR_IP6TABLES)
112 $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
113
114layer7-install:
115 $(INSTALL_DIR) $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols
116 $(INSTALL_DATA) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/
Note: See TracBrowser for help on using the repository browser.