Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..da6255d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,143 @@
+#
+#    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 NTP, the reference client and
+#      server implementation for the Network Time Protocol (NTP).
+#
+
+
+include pre.mak
+
+PackageName		:= ntp
+
+PackageExtension	:= tar.gz
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFile	:= $(PackageSourceDir)/COPYRIGHT
+
+CleanPaths		+= $(PackageLicenseFile)
+
+LibCapDir		:= sw/tps/libcap
+LibCapIncDir		= $(call GenerateResultPaths,$(LibCapDir),usr/include)
+LibCapLibDir		= $(call GenerateResultPaths,$(LibCapDir),lib)
+
+LinuxDir		:= sw/tps/linux
+LinuxIncDir		:= $(call GenerateResultPaths,$(LinuxDir),include)
+
+OpenSslDir		:= sw/tps/openssl
+OpenSslSearchDir	:= $(call GenerateResultPaths,$(OpenSslDir),usr)
+OpenSslIncDir		:= $(call GenerateResultPaths,$(OpenSslDir),usr/include)
+OpenSslLibDir		:= $(call GenerateResultPaths,$(OpenSslDir),usr/lib)
+
+ZlibDir			:= sw/tps/zlib
+ZlibSearchPath		:= $(call GenerateResultPaths,$(ZlibDir),usr)
+ZlibLibDir		:= $(call GenerateResultPaths,$(ZlibDir),usr/lib)
+
+SOURCEDIRS                      = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourceFile): $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(LicenseSourceFile)
+	$(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+	$(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+	$(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+	$(Verbose)touch @
+
+# Generate the package build makefile.
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory)
+	$(Verbose)cd $(BuildDirectory) && \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	$(CURDIR)/$(PackageSourceDir)/configure \
+	CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+	CFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncDir)) \
+	$(call ToolGenerateIncludeArgument,$(LibCapIncDir))" \
+	LDFLAGS="-L$(LibCapLibDir) -Wl,-rpath-link -Wl,$(ZlibLibDir)" \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--localstatedir=/var \
+	--disable-debugging \
+	--disable-debug-timing \
+	--disable-all-clocks \
+	--disable-parse-clocks \
+	--enable-getifaddrs=yes \
+	--enable-kmem \
+	--enable-linuxcaps \
+	--enable-ipv6 \
+	--enable-accurate-adjtime \
+	--without-net-snmp-config \
+	--without-lineeditlibs \
+	--with-openssl-libdir=$(OpenSslLibDir) \
+	--with-openssl-incdir=$(OpenSslIncDir) \
+	--with-crypto=openssl \
+	--without-electricfence \
+	--with-yielding-select=yes \
+	--without-ntpsnmpd
+	$(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+	all
+	$(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+	DESTDIR=$(ResultDirectory) \
+	install
+	$(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/ntp.patches/ntp-50.description b/ntp.patches/ntp-50.description
new file mode 100644
index 0000000..b8771cf
--- /dev/null
+++ b/ntp.patches/ntp-50.description
@@ -0,0 +1 @@
+This patch changes MOD_NANO to STA_NANO, matching the preprocessor conditional that triggers its use.
diff --git a/ntp.patches/ntp-50.patch b/ntp.patches/ntp-50.patch
new file mode 100644
index 0000000..5b17372
--- /dev/null
+++ b/ntp.patches/ntp-50.patch
@@ -0,0 +1,12 @@
+diff -aruN a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c
+--- a/ntpd/ntp_loopfilter.c	2009-12-08 23:36:36.000000000 -0800
++++ b/ntpd/ntp_loopfilter.c	2010-11-24 14:30:17.211010878 -0800
+@@ -517,7 +517,7 @@
+ 			ntv.modes = MOD_STATUS;
+ 		} else {
+ #ifdef STA_NANO
+-			ntv.modes = MOD_BITS | MOD_NANO;
++			ntv.modes = MOD_BITS | STA_NANO;
+ #else /* STA_NANO */
+ 			ntv.modes = MOD_BITS;
+ #endif /* STA_NANO */
diff --git a/ntp.tar.gz b/ntp.tar.gz
new file mode 100644
index 0000000..5174d6c
--- /dev/null
+++ b/ntp.tar.gz
Binary files differ
diff --git a/ntp.url b/ntp.url
new file mode 100644
index 0000000..71eb08b
--- /dev/null
+++ b/ntp.url
@@ -0,0 +1 @@
+http://archive.ntp.org/ntp4/ntp-4.2/ntp-4.2.8.tar.gz
diff --git a/ntp.version b/ntp.version
new file mode 100644
index 0000000..ad9e446
--- /dev/null
+++ b/ntp.version
@@ -0,0 +1 @@
+4.2.8