curl 7.16.1 (reduced)

Extract upstream curl using the following shell code.

url=git://github.com/bagder/curl.git &&
v=7.16.1 &&
r=ef442d58 &&
paths="
  COPYING
  include/curl/*.h
  lib/*.c
  lib/*.h
" &&
mkdir curl-$v-g$r-reduced &&
git clone $url curl-git &&
date=$(cd curl-git && git log -n 1 --format='%cd' $r) &&
(cd curl-git && git checkout $r &&
 git archive --format=tar $r -- $paths) |
(cd curl-$v-g$r-reduced && tar xv &&
 rm lib/config-*.h) &&
echo "g$r date: $date"
curl 7.38.0 (reduced)

Extract upstream curl using the following shell code.

url=git://github.com/bagder/curl.git &&
v=7.38.0 &&
r=202aa9f7 &&
paths="
  CMake/*
  CMakeLists.txt
  COPYING
  include/curl/*.h
  include/curl/curlbuild.h.cmake
  lib/*.c
  lib/*.h
  lib/CMakeLists.txt
  lib/Makefile.inc
  lib/curl_config.h.cmake
  lib/libcurl.rc
  lib/vtls/*.c
  lib/vtls/*.h
" &&
mkdir curl-$v-g$r-reduced &&
git clone $url curl-git &&
date=$(cd curl-git && git log -n 1 --format='%cd' $r) &&
(cd curl-git && git checkout $r &&
 git archive --format=tar $r -- $paths) |
(cd curl-$v-g$r-reduced && tar xv &&
 rm lib/config-*.h) &&
echo "g$r date: $date"
curl: Disable all whitespace checks in third-party code

Add a .gitattributes file to tell Git to skip whitespace checks
in the curl source code.
curl: Move sources back into upstream layout

Update our build files as needed to compensate.
curl: Drop unused testing code

Remove our "Testing/" directory renames of the upstream examples.
Merge branch 'curl-upstream' into update-curl

Use the '-s ours' merge strategy to keep our side unchanged.
This merge brings in the upstream snapshot as of the version
of curl on which our source is based.  This will allow new
snapshots to be merged with our changes.
curl: Drop our CMake infrastructure to make room for the upstream

Remove our curl CMake build files since upstream now provides some.
After merging the upstream versions we may then port them to build
inside CMake and take code from our old build files as needed.
Merge branch 'curl-upstream' into update-curl

Resolve all conflicts in favor of the upstream side.
We can re-apply specific changes later.
curl: Remove unused SIZEOF_LONG_DOUBLE

Re-apply change from commit v2.8.2~537 (cmcurl: Remove unused
SIZEOF_LONG_DOUBLE, 2009-12-17) on updated upstream curl.
curl: Fix warnings on 64-bit Mac OS X build

Re-apply change from commit v2.6.0~921 (Fix warnings on 64-bit Mac OS X
build, 2007-11-05) on updated upstream curl.
curl: Fix spelling errors reported by Lintian

Re-apply change from commit v2.8.3~265^2~1 (Fix spelling errors
reported by Lintian, 2010-07-02) on updated upstream curl.
curl: Drop '-DEV' from version since this is a curl release

We imported curl from an upstream release, so report the corresponding
release version to servers.  This is consistent with the version we
presented when our builtin curl was 7.16.1.
curl: Port to Haiku again

Re-apply change from commit v2.8.0~1683 (add initial support for HAIKU
OS, 2008-09-15) on updated upstream curl.  However, leave out the part
that was reverted by commit v3.0.0-rc1~541^2~1 (Haiku: Remove outdated
preprocessor checks, 2013-10-05).
curl: Remove outdated Haiku preprocessor checks

Re-apply change from commit v3.0.0-rc1~541^2~1 (Haiku: Remove outdated
preprocessor checks, 2013-10-05) on updated upstream curl.
curl: Simplify if() conditions on check result variables

Remove use of an old hack that takes advantage of the auto-dereference
behavior of the if() command to detect if a variable is defined.  The
hack has the form:

 if("${VAR} MATCHES "^${VAR}$")

where "${VAR}" is a macro argument reference.  Use if(DEFINED) instead.
This also avoids warnings for CMake Policy CMP0054.
file(GENERATE): Use permissions of input file if present.
Encoding: Use encoding libcurl expects with file: urls.

For unescaped file: URLs on Windows, libcurl expects
the ANSI code page.

This fixes the CMake.FileUpload test when CMake is configured
to use UTF-8 internally with a non-ascii build directory name.
Makefile: Refactor checks for lang-specific targets and export compile cmds

The checks are now split into languages that are able to generate
assembly listings, languages that are able to generate preprocessed
listings, and languages that are able to export the compile commands.
genex: Preserve order while evaluating TARGET_OBJECTS

The logic introduced in commit v3.1.0-rc1~688^2~9 (Genex: Evaluate
TARGET_OBJECTS as a normal expression, 2014-02-26) ordered a map
by pointer value and then constructed a list of object files by
iterating over the map.  This is not deterministic.

Since commit v3.1.0-rc1~688^2~5 (cmTarget: Allow any generator
expression in SOURCES property, 2014-03-18) the order produced by the
above-mentioned logic started being used for the actual list of object
files on the link line.  Since it is not deterministic, spurious
re-links occur after re-running CMake simply because the order of
objects changed on the link line.

Fix this by iterating over the original vector of source files instead
of the map.  This has a deterministic order.
Xcode: Fix compiler path detection for iOS tools on Xcode <= 5.0 (#15237)

Since commit v3.1.0-rc1~1^2~1 (Xcode: Fix compiler id detection for iOS
tools, 2014-10-22) our compiler id detection project sets the product
type to 'com.apple.product-type.bundle.unit-test'.  This causes the Ld
command line on which we match the path to the compiler to have a
'CompilerIdC.xctest/' component.  The commit updated our regex to match
this, but placed it before the extra './' component that Xcode 5.0 and
below produce.  Xcode <= 5.0 prints '/./CompilerIdC.xctest/', so switch
the order of the two components in the regex to match it.