Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..08184eb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,124 @@
+#
+#    Copyright (c) 2010-2011 Nest, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest.
+#
+#    Description:
+#      This file is the make file for iptables, a set of command line
+#      program used to configure the Linux IPv4 and IPv6 packet
+#      filtering ruleset.
+#
+
+BuildConfigSpecialized	:= No
+BuildProductSpecialized	:= No
+
+include pre.mak
+
+PackageName		:= iptables
+
+PackageExtension	:= tar.bz2
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+CleanPaths		+= $(PackageLicenseFile)
+
+LinuxIncDir		:= $(call GenerateResultPaths,sw/tps/linux,include)
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/COPYING: source
+
+$(PackageLicenseFile): $(PackageSourceDir)/COPYING
+	$(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+	$(expand-and-patch-package)
+
+# Prepare the sources.
+
+.PHONY: source
+source: | $(PackageSourceDir)
+
+# Patch the sources, if necessary.
+
+.PHONY: patch
+patch: source
+
+# Generate the package build makefile.
+
+$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory)
+	$(Verbose)cd $(BuildDirectory) && \
+	$(CURDIR)/$(PackageSourceDir)/configure \
+	CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	CFLAGS="-I$(LinuxIncDir)" \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--disable-static \
+	--enable-shared \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--localstatedir=/var
+
+# Configure the source for building.
+
+.PHONY: configure
+configure: source $(PackageBuildMakefile)
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+.PHONY: build
+build: configure
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+#
+# We explictly remove 'libfoo.la' because some packages that depend on
+# these libraries use libtool. If libtool finds a 'libfoo.la' file for
+# a library, it uses the value of 'libdir=<dir>' it finds. In our
+# case, since '--prefix=/usr' this value is '/usr/lib'. It then
+# resolves '-lfoo'. In a cross-compilation environment, this is likely
+# to be neither the right architecture nor the right version to link
+# against. In short, we lose.
+#
+# We could also handle this by removing DESTDIR and setting the prefix
+# to $(ResultDirectory); however, that results in libtool hard-coding
+# $(ResultDirectory) as the RPATH in the linked executables which is
+# NOT what we want either. We lose again.
+#
+# By removing the '*.la' file, we win by ensuring neither a misdirected
+# link nor an RPATH.
+
+.PHONY: stage
+stage: build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
+	$(Verbose)$(RM) $(RMFLAGS) $(call GenerateResultPaths,,usr/lib/libip4tc.la usr/lib/libiptc.la usr/lib/libxtables.la usr/lib/libip6tc.la)
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/iptables.patches/iptables-50.description b/iptables.patches/iptables-50.description
new file mode 100644
index 0000000..3d99683
--- /dev/null
+++ b/iptables.patches/iptables-50.description
@@ -0,0 +1,7 @@
+Add definition of __aligned_u64 for iptables to build against
+newer version Linux kernel like 3.10. 
+
+iptables has its own copy of Linux kernel header files, which is
+weird. The developers of iptables claim they do this so that 
+package iptables is self-contained. However this causes issue like
+what this patch has to fix.   
diff --git a/iptables.patches/iptables-50.patch b/iptables.patches/iptables-50.patch
new file mode 100644
index 0000000..80fef85
--- /dev/null
+++ b/iptables.patches/iptables-50.patch
@@ -0,0 +1,10 @@
+--- a/include/linux/types.h	2010-08-06 06:28:38.000000000 -0700
++++ b/include/linux/types.h	2014-05-06 13:54:13.911514658 -0700
+@@ -34,5 +34,7 @@
+ typedef __u16 __bitwise __sum16;
+ typedef __u32 __bitwise __wsum;
+ 
++#define __aligned_u64 __u64 __attribute__((aligned(8)))
++
+ #endif /*  __ASSEMBLY__ */
+ #endif /* _LINUX_TYPES_H */
diff --git a/iptables.tar.bz2 b/iptables.tar.bz2
new file mode 100644
index 0000000..8b0198d
--- /dev/null
+++ b/iptables.tar.bz2
Binary files differ
diff --git a/iptables.url b/iptables.url
new file mode 100644
index 0000000..bf37363
--- /dev/null
+++ b/iptables.url
@@ -0,0 +1 @@
+ftp://ftp.netfilter.org/pub/iptables/iptables-1.4.9.1.tar.bz2
diff --git a/iptables.version b/iptables.version
new file mode 100644
index 0000000..8cc8fe0
--- /dev/null
+++ b/iptables.version
@@ -0,0 +1 @@
+1.4.21