Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f7059ed
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,174 @@
+#
+# 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 makefile for the library and command line
+# utility for transferring files with URL syntax, libcurl and
+# curl, respectively.
+#
+
+include pre.mak
+
+PackageName := curl
+
+PackageExtension := tar.gz
+PackageSeparator := -
+
+PackagePatchArgs := -p1
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
+
+CleanPaths += $(PackageLicenseFile)
+
+TpsDir = sw/tps
+
+OpenSSLDir = $(TpsDir)/openssl
+OpenSSLPrefixDir = usr
+OpenSSLIncludeDir = $(OpenSSLPrefixDir)/include
+OpenSSLLibraryDir = $(OpenSSLPrefixDir)/lib
+OpenSSLNames = crypto ssl
+OpenSSLSearchPath = $(call GenerateResultPaths,$(OpenSSLDir),$(OpenSSLPrefixDir))
+OpenSSLIncludePath = $(call GenerateResultPaths,$(OpenSSLDir),$(OpenSSLIncludeDir))
+OpenSSLLibraryPath = $(call GenerateResultPaths,$(OpenSSLDir),$(OpenSSLLibraryDir))
+OpenSSLLibraryPaths = $(call GenerateResultPaths,$(OpenSSLResultsDir),$(addprefix $(OpenSSLLibraryDir)/,$(OpenSSLNames)))
+OpenSSLDependPaths = $(call GenerateSharedLibraryResultPaths,$(OpenSSLDir)/$(OpenSSLLibraryDir),$(OpenSSLNames))
+
+ZlibDir = $(TpsDir)/zlib
+ZlibPrefixDir = usr
+ZlibIncludeDir = $(ZlibPrefixDir)/include
+ZlibLibraryDir = $(ZlibPrefixDir)/lib
+ZlibName = z
+ZlibSearchPath = $(call GenerateResultPaths,$(ZlibDir),$(ZlibPrefixDir))
+ZlibIncludePath = $(call GenerateResultPaths,$(ZlibDir),$(ZlibIncludeDir))
+ZlibLibraryPath = $(call GenerateResultPaths,$(ZlibDir),$(ZlibLibraryDir))
+ZlibDependPath = $(call GenerateSharedLibraryResultPaths,$(ZlibDir)/$(ZlibLibraryDir),$(ZlibName))
+
+SOURCEDIRS = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/COPYING: $(BuildDirectory)/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.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+ $(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+ $(Verbose)touch $@
+
+# Generate the package build makefile.
+#
+# For non-cross-compiled targets (e.g. simulators), the curl configure
+# attempts to perform run-time tests.
+#
+# To ensure this works against the in-project versions of openssl and
+# zlib, the paths to these shared objects MUST be found by the dynamic
+# loader.
+
+$(BuildDirectory)/configure: export $(LoaderSearchPath) := $(OpenSSLLibraryPath):$(ZlibLibraryPath):$($(LoaderSearchPath))
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+ $(Verbose)cd $(BuildDirectory) && \
+ $(CURDIR)/$(PackageSourceDir)/configure \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ CC="$(CC)" CXX="$(CXX)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+ CPPFLAGS="$(call ToolGenerateIncludeArgument,$(OpenSSLIncludePath))" \
+ LDFLAGS="$(call GenerateResolveArguments,$(ZlibDependPath)) \
+ $(call GenerateResolveArguments,$(OpenSSLDependPaths)) \
+ $(call ToolGenerateLibraryPathArgument,$(OpenSSLLibraryPath))" \
+ --build=$(HostTuple) \
+ --host=$(TargetTuple) \
+ $(CurlPackageOptions) \
+ --disable-ares \
+ --disable-dict \
+ --disable-gopher \
+ --disable-imap \
+ --disable-ldap \
+ --disable-ldaps \
+ --disable-manual \
+ --disable-ntlm-wb \
+ --disable-pop3 \
+ --disable-rtsp \
+ --disable-smtp \
+ --disable-telnet \
+ --enable-ipv6 \
+ --with-ssl=$(OpenSSLSearchPath) \
+ --with-zlib=$(ZlibSearchPath) \
+ --without-libidn \
+ --prefix=$(addprefix $(LibPrefixConfigOption),/usr) \
+ --sysconfdir=$(addprefix $(LibPrefixConfigOption),/etc) \
+ --localstatedir=$(addprefix $(LibPrefixConfigOption),/var) \
+ --disable-static
+ $(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.
+#
+# We explictly remove 'libcurl.la' because some packages that depend
+# on libcurl 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
+# '-lcurl' to '/usr/lib/libcurl.so'. 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.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) $(call GenerateLibraryDestinationArgument,$(ResultDirectory)) install
+ $(Verbose)$(RM) $(RMFLAGS) $(call GenerateResultPaths,,usr/lib/libcurl.la)
+ $(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/curl.patches/curl-00.description b/curl.patches/curl-00.description
new file mode 100644
index 0000000..c5d1250
--- /dev/null
+++ b/curl.patches/curl-00.description
@@ -0,0 +1,6 @@
+This patch allows curl to be compiled with clang. This is a known problem with
+the version of curl we're using and was fixed with commit 358c5c0745a4c47f910189095f3832163b4708c4.
+According to tags made on the curl repo, the first build to include this commit was curl-7_30_0.
+
+Original bug tracked here:
+http://sourceforge.net/p/curl/bugs/1192/
\ No newline at end of file
diff --git a/curl.patches/curl-00.patch b/curl.patches/curl-00.patch
new file mode 100644
index 0000000..35d2f29
--- /dev/null
+++ b/curl.patches/curl-00.patch
@@ -0,0 +1,295 @@
+diff -aruN curl-7.25.0/configure.ac curl-7.25.0.N/configure.ac
+--- curl-7.25.0/configure.ac 2012-03-08 11:35:23.000000000 -0800
++++ curl-7.25.0.N/configure.ac 2014-10-05 15:25:05.000000000 -0700
+@@ -2776,7 +2776,6 @@
+ CURL_CHECK_FUNC_STRDUP
+ CURL_CHECK_FUNC_STRERROR_R
+ CURL_CHECK_FUNC_STRICMP
+-CURL_CHECK_FUNC_STRLCAT
+ CURL_CHECK_FUNC_STRNCASECMP
+ CURL_CHECK_FUNC_STRNCMPI
+ CURL_CHECK_FUNC_STRNICMP
+diff -aruN curl-7.25.0/lib/config-dos.h curl-7.25.0.N/lib/config-dos.h
+--- curl-7.25.0/lib/config-dos.h 2012-03-08 11:35:24.000000000 -0800
++++ curl-7.25.0.N/lib/config-dos.h 2014-10-05 15:25:05.000000000 -0700
+@@ -164,10 +164,6 @@
+ #define HAVE_SYS_TIME_H 1
+ #define HAVE_VARIADIC_MACROS_GCC 1
+
+- #if (DJGPP_MINOR >= 4)
+- #define HAVE_STRLCAT 1
+- #endif
+-
+ /* Because djgpp <= 2.03 doesn't have snprintf() etc. */
+ #if (DJGPP_MINOR < 4)
+ #define _MPRINTF_REPLACE
+diff -aruN curl-7.25.0/lib/config-os400.h curl-7.25.0.N/lib/config-os400.h
+--- curl-7.25.0/lib/config-os400.h 2012-03-08 11:35:24.000000000 -0800
++++ curl-7.25.0.N/lib/config-os400.h 2014-10-05 15:25:05.000000000 -0700
+@@ -295,9 +295,6 @@
+ /* Define if you have the <string.h> header file. */
+ #define HAVE_STRING_H
+
+-/* Define if you have the `strlcat' function. */
+-#undef HAVE_STRLCAT
+-
+ /* Define if you have the `strlcpy' function. */
+ #undef HAVE_STRLCPY
+
+diff -aruN curl-7.25.0/lib/config-riscos.h curl-7.25.0.N/lib/config-riscos.h
+--- curl-7.25.0/lib/config-riscos.h 2012-03-08 11:35:24.000000000 -0800
++++ curl-7.25.0.N/lib/config-riscos.h 2014-10-05 15:25:05.000000000 -0700
+@@ -293,9 +293,6 @@
+ /* Define if you have the <string.h> header file. */
+ #define HAVE_STRING_H
+
+-/* Define if you have the `strlcat' function. */
+-#undef HAVE_STRLCAT
+-
+ /* Define if you have the `strlcpy' function. */
+ #undef HAVE_STRLCPY
+
+diff -aruN curl-7.25.0/lib/config-symbian.h curl-7.25.0.N/lib/config-symbian.h
+--- curl-7.25.0/lib/config-symbian.h 2011-11-04 15:32:55.000000000 -0700
++++ curl-7.25.0.N/lib/config-symbian.h 2014-10-05 15:25:05.000000000 -0700
+@@ -532,9 +532,6 @@
+ /* Define to 1 if you have the <string.h> header file. */
+ #define HAVE_STRING_H 1
+
+-/* Define to 1 if you have the `strlcat' function. */
+-#define HAVE_STRLCAT 1
+-
+ /* Define to 1 if you have the `strlcpy' function. */
+ #define HAVE_STRLCPY 1
+
+diff -aruN curl-7.25.0/lib/config-tpf.h curl-7.25.0.N/lib/config-tpf.h
+--- curl-7.25.0/lib/config-tpf.h 2011-11-04 15:32:55.000000000 -0700
++++ curl-7.25.0.N/lib/config-tpf.h 2014-10-05 15:25:05.000000000 -0700
+@@ -477,9 +477,6 @@
+ /* Define to 1 if you have the <string.h> header file. */
+ #define HAVE_STRING_H 1
+
+-/* Define to 1 if you have the `strlcat' function. */
+-/* #undef HAVE_STRLCAT */
+-
+ /* Define to 1 if you have the `strlcpy' function. */
+ /* #undef HAVE_STRLCPY */
+
+diff -aruN curl-7.25.0/lib/config-vxworks.h curl-7.25.0.N/lib/config-vxworks.h
+--- curl-7.25.0/lib/config-vxworks.h 2011-11-04 15:32:55.000000000 -0700
++++ curl-7.25.0.N/lib/config-vxworks.h 2014-10-05 15:25:05.000000000 -0700
+@@ -604,9 +604,6 @@
+ /* Define to 1 if you have the <string.h> header file. */
+ #define HAVE_STRING_H 1
+
+-/* Define to 1 if you have the strlcat function. */
+-/* #undef HAVE_STRLCAT */
+-
+ /* Define to 1 if you have the `strlcpy' function. */
+ /* #undef HAVE_STRLCPY */
+
+diff -aruN curl-7.25.0/lib/if2ip.c curl-7.25.0.N/lib/if2ip.c
+--- curl-7.25.0/lib/if2ip.c 2012-03-08 11:35:24.000000000 -0800
++++ curl-7.25.0.N/lib/if2ip.c 2014-10-05 15:25:05.000000000 -0700
+@@ -101,6 +101,7 @@
+ curl_strequal(iface->ifa_name, interf)) {
+ void *addr;
+ char scope[12]="";
++ char ipstr[64];
+ #ifdef ENABLE_IPV6
+ if(af == AF_INET6) {
+ unsigned int scopeid = 0;
+@@ -115,8 +116,9 @@
+ else
+ #endif
+ addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr;
+- ip = (char *) Curl_inet_ntop(af, addr, buf, buf_size);
+- strlcat(buf, scope, buf_size);
++ ip = (char *) Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
++ snprintf(buf, buf_size, "%s%s", ip, scope);
++ ip = buf;
+ break;
+ }
+ }
+diff -aruN curl-7.25.0/lib/socks.c curl-7.25.0.N/lib/socks.c
+--- curl-7.25.0/lib/socks.c 2012-03-08 11:35:25.000000000 -0800
++++ curl-7.25.0.N/lib/socks.c 2014-10-05 15:25:05.000000000 -0700
+@@ -199,8 +199,15 @@
+ * This is currently not supporting "Identification Protocol (RFC1413)".
+ */
+ socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
+- if(proxy_name)
+- strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8);
++ if(proxy_name) {
++ size_t plen = strlen(proxy_name);
++ if(plen >= sizeof(socksreq) - 8) {
++ failf(data, "Too long SOCKS proxy name, can't use!\n");
++ return CURLE_COULDNT_CONNECT;
++ }
++ /* copy the proxy name WITH trailing zero */
++ memcpy(socksreq + 8, proxy_name, plen+1);
++ }
+
+ /*
+ * Make connection
+diff -aruN curl-7.25.0/lib/strequal.c curl-7.25.0.N/lib/strequal.c
+--- curl-7.25.0/lib/strequal.c 2012-03-08 11:35:25.000000000 -0800
++++ curl-7.25.0.N/lib/strequal.c 2014-10-05 15:25:05.000000000 -0700
+@@ -77,48 +77,3 @@
+ return toupper(*first) == toupper(*second);
+ #endif
+ }
+-
+-#ifndef HAVE_STRLCAT
+-/*
+- * The strlcat() function appends the NUL-terminated string src to the end
+- * of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-
+- * nating the result.
+- *
+- * The strlcpy() and strlcat() functions return the total length of the
+- * string they tried to create. For strlcpy() that means the length of src.
+- * For strlcat() that means the initial length of dst plus the length of
+- * src. While this may seem somewhat confusing it was done to make trunca-
+- * tion detection simple.
+- *
+- *
+- */
+-size_t Curl_strlcat(char *dst, const char *src, size_t siz)
+-{
+- char *d = dst;
+- const char *s = src;
+- size_t n = siz;
+- union {
+- ssize_t sig;
+- size_t uns;
+- } dlen;
+-
+- /* Find the end of dst and adjust bytes left but don't go past end */
+- while(n-- != 0 && *d != '\0')
+- d++;
+- dlen.sig = d - dst;
+- n = siz - dlen.uns;
+-
+- if(n == 0)
+- return(dlen.uns + strlen(s));
+- while(*s != '\0') {
+- if(n != 1) {
+- *d++ = *s;
+- n--;
+- }
+- s++;
+- }
+- *d = '\0';
+-
+- return(dlen.uns + (s - src)); /* count does not include NUL */
+-}
+-#endif
+diff -aruN curl-7.25.0/lib/strequal.h curl-7.25.0.N/lib/strequal.h
+--- curl-7.25.0/lib/strequal.h 2011-03-19 08:16:07.000000000 -0700
++++ curl-7.25.0.N/lib/strequal.h 2014-10-05 15:25:05.000000000 -0700
+@@ -27,9 +27,4 @@
+ #define strequal(a,b) curl_strequal(a,b)
+ #define strnequal(a,b,c) curl_strnequal(a,b,c)
+
+-#ifndef HAVE_STRLCAT
+-#define strlcat(x,y,z) Curl_strlcat(x,y,z)
+-#endif
+-size_t strlcat(char *dst, const char *src, size_t siz);
+-
+ #endif
+diff -aruN curl-7.25.0/m4/curl-functions.m4 curl-7.25.0.N/m4/curl-functions.m4
+--- curl-7.25.0/m4/curl-functions.m4 2012-03-21 16:12:36.000000000 -0700
++++ curl-7.25.0.N/m4/curl-functions.m4 2014-10-05 15:25:05.000000000 -0700
+@@ -6418,92 +6418,6 @@
+ fi
+ ])
+
+-
+-dnl CURL_CHECK_FUNC_STRLCAT
+-dnl -------------------------------------------------
+-dnl Verify if strlcat is available, prototyped, and
+-dnl can be compiled. If all of these are true, and
+-dnl usage has not been previously disallowed with
+-dnl shell variable curl_disallow_strlcat, then
+-dnl HAVE_STRLCAT will be defined.
+-
+-AC_DEFUN([CURL_CHECK_FUNC_STRLCAT], [
+- AC_REQUIRE([CURL_INCLUDES_STRING])dnl
+- #
+- tst_links_strlcat="unknown"
+- tst_proto_strlcat="unknown"
+- tst_compi_strlcat="unknown"
+- tst_allow_strlcat="unknown"
+- #
+- AC_MSG_CHECKING([if strlcat can be linked])
+- AC_LINK_IFELSE([
+- AC_LANG_FUNC_LINK_TRY([strlcat])
+- ],[
+- AC_MSG_RESULT([yes])
+- tst_links_strlcat="yes"
+- ],[
+- AC_MSG_RESULT([no])
+- tst_links_strlcat="no"
+- ])
+- #
+- if test "$tst_links_strlcat" = "yes"; then
+- AC_MSG_CHECKING([if strlcat is prototyped])
+- AC_EGREP_CPP([strlcat],[
+- $curl_includes_string
+- ],[
+- AC_MSG_RESULT([yes])
+- tst_proto_strlcat="yes"
+- ],[
+- AC_MSG_RESULT([no])
+- tst_proto_strlcat="no"
+- ])
+- fi
+- #
+- if test "$tst_proto_strlcat" = "yes"; then
+- AC_MSG_CHECKING([if strlcat is compilable])
+- AC_COMPILE_IFELSE([
+- AC_LANG_PROGRAM([[
+- $curl_includes_string
+- ]],[[
+- if(0 != strlcat(0, 0, 0))
+- return 1;
+- ]])
+- ],[
+- AC_MSG_RESULT([yes])
+- tst_compi_strlcat="yes"
+- ],[
+- AC_MSG_RESULT([no])
+- tst_compi_strlcat="no"
+- ])
+- fi
+- #
+- if test "$tst_compi_strlcat" = "yes"; then
+- AC_MSG_CHECKING([if strlcat usage allowed])
+- if test "x$curl_disallow_strlcat" != "xyes"; then
+- AC_MSG_RESULT([yes])
+- tst_allow_strlcat="yes"
+- else
+- AC_MSG_RESULT([no])
+- tst_allow_strlcat="no"
+- fi
+- fi
+- #
+- AC_MSG_CHECKING([if strlcat might be used])
+- if test "$tst_links_strlcat" = "yes" &&
+- test "$tst_proto_strlcat" = "yes" &&
+- test "$tst_compi_strlcat" = "yes" &&
+- test "$tst_allow_strlcat" = "yes"; then
+- AC_MSG_RESULT([yes])
+- AC_DEFINE_UNQUOTED(HAVE_STRLCAT, 1,
+- [Define to 1 if you have the strlcat function.])
+- ac_cv_func_strlcat="yes"
+- else
+- AC_MSG_RESULT([no])
+- ac_cv_func_strlcat="no"
+- fi
+-])
+-
+-
+ dnl CURL_CHECK_FUNC_STRNCASECMP
+ dnl -------------------------------------------------
+ dnl Verify if strncasecmp is available, prototyped, and
diff --git a/curl.tar.gz b/curl.tar.gz
new file mode 100644
index 0000000..1432843
--- /dev/null
+++ b/curl.tar.gz
Binary files differ
diff --git a/curl.url b/curl.url
new file mode 100644
index 0000000..ddc403c
--- /dev/null
+++ b/curl.url
@@ -0,0 +1 @@
+http://curl.haxx.se/download/curl-7.25.0.tar.gz
diff --git a/curl.version b/curl.version
new file mode 100644
index 0000000..bc34d81
--- /dev/null
+++ b/curl.version
@@ -0,0 +1 @@
+7.25.0