Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..775c1eb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,144 @@
+#
+#    Copyright (c) 2010-2012 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 the GNU TLS library, providing a
+#      secure layer over a reliable network transport.
+#
+
+BuildConfigSpecialized	:= No
+BuildProductSpecialized	:= No
+
+include pre.mak
+
+PackageName		:= gnutls
+
+PackageExtension	:= tar.bz2
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFile	:= $(PackageSourceDir)/COPYING
+
+CleanPaths		+= $(PackageLicenseFile)
+
+GcryptDir		:= sw/tps/libgcrypt
+GcryptIncDir		:= $(call GenerateResultPaths,$(GcryptDir),usr/include)
+GcryptLibDir		:= $(call GenerateResultPaths,$(GcryptDir),usr/lib)
+
+GpgErrorDir		:= sw/tps/libgpg-error
+GpgErrorIncDir		:= $(call GenerateResultPaths,$(GpgErrorDir),usr/include)
+GpgErrorLibDir		:= $(call GenerateResultPaths,$(GpgErrorDir),usr/lib)
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourceFile): 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.
+
+.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)" \
+	CPPFLAGS="$(call ToolGenerateIncludeArgument,$(GpgErrorIncDir))" \
+	LDFLAGS="$(call ToolGenerateLibraryPathArgument,$(GpgErrorLibDir))" \
+	ac_cv_libgcrypt=yes \
+	ac_cv_libtasn1=yes \
+	--build=$(HostTuple) \
+	--host=$(TargetTuple) \
+	--target=$(TargetTuple) \
+	--prefix=/usr \
+	--sysconfdir=/etc \
+	--localstatedir=/var \
+	--disable-cxx \
+	--disable-gtk-doc \
+	--disable-gtk-doc-html \
+	--disable-gtk-doc-pdf \
+	--with-included-libtasn1 \
+	--with-libgcrypt-prefix=$(call GenerateResultPaths,$(GcryptDir),usr)
+
+# 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 'libavahi-core.la' and 'libavahi-common.la'
+# because some packages that depend on these libraries use libtool. If
+# libtool finds a '*.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 '-lavahi-core' or
+# '-lavahi-common' to '/usr/lib/libavahi-core.so' and
+# '/usr/lib/libavahi-common.so', respectively. 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,,$(addprefix usr/lib/, libgnutls.la libgnutls-extra.la libgnutls-openssl.la))
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/gnutls.patches/gnutls-50.description b/gnutls.patches/gnutls-50.description
new file mode 100644
index 0000000..8029520
--- /dev/null
+++ b/gnutls.patches/gnutls-50.description
@@ -0,0 +1 @@
+This patch adds support for cross-compiling gnutls.
diff --git a/gnutls.patches/gnutls-50.patch b/gnutls.patches/gnutls-50.patch
new file mode 100644
index 0000000..d6cf730
--- /dev/null
+++ b/gnutls.patches/gnutls-50.patch
@@ -0,0 +1,74 @@
+diff -aruN a/doc/examples/Makefile.in b/doc/examples/Makefile.in
+--- a/doc/examples/Makefile.in	2010-03-15 03:29:19.000000000 -0700
++++ b/doc/examples/Makefile.in	2010-11-19 11:03:59.000000000 -0800
+@@ -827,7 +827,7 @@
+ 	../../lib/libgnutls.la			\
+ 	../../libextra/libgnutls-extra.la	\
+ 	../../gl/libgnu.la			\
+-	$(LIBSOCKET) $(INET_NTOP_LIB) $(INET_PTON_LIB)
++	$(LIBSOCKET) $(INET_NTOP_LIB) $(INET_PTON_LIB) $(LTLIBGCRYPT)
+ 
+ CXX_LDADD = $(LDADD) \
+ 	../../lib/libgnutlsxx.la
+diff -aruN a/doc/Makefile.in b/doc/Makefile.in
+--- a/doc/Makefile.in	2010-03-15 03:29:18.000000000 -0700
++++ b/doc/Makefile.in	2010-11-19 11:05:14.000000000 -0800
+@@ -806,9 +806,9 @@
+ 	--no-split --css-include=$(srcdir)/texinfo.css
+ 
+ errcodes_SOURCES = errcodes.c
+-errcodes_LDADD = ../lib/libgnutls.la ../gl/libgnu.la
++errcodes_LDADD = ../lib/libgnutls.la ../gl/libgnu.la $(LTLIBGCRYPT)
+ printlist_SOURCES = printlist.c
+-printlist_LDADD = ../lib/libgnutls.la ../gl/libgnu.la
++printlist_LDADD = ../lib/libgnutls.la ../gl/libgnu.la $(LTLIBGCRYPT)
+ AM_CPPFLAGS = -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes
+ guile_texi = core.c.texi extra.c.texi
+ BUILT_SOURCES = $(guile_texi)
+diff -aruN a/lib/Makefile.in b/lib/Makefile.in
+--- a/lib/Makefile.in	2010-03-15 03:28:41.000000000 -0700
++++ b/lib/Makefile.in	2010-11-19 10:22:24.161487057 -0800
+@@ -885,7 +885,7 @@
+ @HAVE_LD_OUTPUT_DEF_TRUE@defexec_DATA = libgnutls-$(DLL_VERSION).def
+ 
+ # C++ library
+-@ENABLE_CXX_TRUE@libgnutlsxx_la_CPPFLAGS = -I$(top_srcdir)/includes -I../includes
++@ENABLE_CXX_TRUE@libgnutlsxx_la_CPPFLAGS = -I$(top_srcdir)/includes -I$(builddir)/includes -I../includes
+ @ENABLE_CXX_TRUE@AM_CXXFLAGS = -I$(top_srcdir)/includes/
+ @ENABLE_CXX_TRUE@libgnutlsxx_la_SOURCES = gnutlsxx.cpp libgnutlsxx.map
+ @ENABLE_CXX_TRUE@libgnutlsxx_la_LDFLAGS = -no-undefined -version-info \
+diff -aruN a/src/Makefile.in b/src/Makefile.in
+--- a/src/Makefile.in	2010-03-15 03:29:21.000000000 -0700
++++ b/src/Makefile.in	2010-11-19 11:02:28.553178489 -0800
+@@ -834,26 +834,26 @@
+ gnutls_serv_SOURCES = list.h serv.c common.h common.c certtool-common.h
+ gnutls_serv_LDADD = ../lib/libgnutls.la ../libextra/libgnutls-extra.la \
+ 	libcmd-serv.la ../gl/libgnu.la $(LTLIBGCRYPT) $(LIBSOCKET) \
+-	$(GETADDRINFO_LIB)
++	$(GETADDRINFO_LIB)
+ libcmd_serv_la_CFLAGS = 
+ libcmd_serv_la_SOURCES = serv.gaa serv-gaa.h serv-gaa.c
+ @ENABLE_SRP_TRUE@srptool_SOURCES = crypt.c
+-@ENABLE_SRP_TRUE@srptool_LDADD = ../lib/libgnutls.la libcmd-srp.la ../gl/libgnu.la
++@ENABLE_SRP_TRUE@srptool_LDADD = ../lib/libgnutls.la libcmd-srp.la ../gl/libgnu.la $(LTLIBGCRYPT)
+ @ENABLE_SRP_TRUE@libcmd_srp_la_CFLAGS = 
+ @ENABLE_SRP_TRUE@libcmd_srp_la_SOURCES = crypt.gaa crypt-gaa.h crypt-gaa.c
+ psktool_SOURCES = psk.c
+-psktool_LDADD = ../lib/libgnutls.la libcmd-psk.la ../gl/libgnu.la
++psktool_LDADD = ../lib/libgnutls.la libcmd-psk.la ../gl/libgnu.la $(LTLIBGCRYPT)
+ libcmd_psk_la_CFLAGS = 
+ libcmd_psk_la_SOURCES = psk.gaa psk-gaa.h psk-gaa.c
+ gnutls_cli_SOURCES = cli.c common.h common.c
+ gnutls_cli_LDADD = ../lib/libgnutls.la ../libextra/libgnutls-extra.la \
+ 	libcmd-cli.la ../gl/libgnu.la $(LTLIBGCRYPT) $(LIBSOCKET) \
+-	$(GETADDRINFO_LIB)
++	$(GETADDRINFO_LIB)
+ libcmd_cli_la_CFLAGS = 
+ libcmd_cli_la_SOURCES = cli.gaa cli-gaa.h cli-gaa.c
+ gnutls_cli_debug_SOURCES = tls_test.c tests.h tests.c common.h common.c
+ gnutls_cli_debug_LDADD = ../lib/libgnutls.la libcmd-cli-debug.la \
+-	../gl/libgnu.la $(LIBSOCKET) $(GETADDRINFO_LIB)
++	../gl/libgnu.la $(LIBSOCKET) $(GETADDRINFO_LIB) $(LTLIBGCRYPT)
+ libcmd_cli_debug_la_CFLAGS = 
+ libcmd_cli_debug_la_SOURCES = tls_test.gaa tls_test-gaa.h tls_test-gaa.c
+ certtool_SOURCES = certtool.c prime.c
diff --git a/gnutls.tar.bz2 b/gnutls.tar.bz2
new file mode 100644
index 0000000..1e63953
--- /dev/null
+++ b/gnutls.tar.bz2
Binary files differ
diff --git a/gnutls.url b/gnutls.url
new file mode 100644
index 0000000..2ce58d7
--- /dev/null
+++ b/gnutls.url
@@ -0,0 +1 @@
+http://ftp.gnu.org/gnu/gnutls/gnutls-2.8.6.tar.bz2
diff --git a/gnutls.version b/gnutls.version
new file mode 100644
index 0000000..e43686a
--- /dev/null
+++ b/gnutls.version
@@ -0,0 +1 @@
+2.8.6