Convert external/curl to Android.bp

Removed Android.mk and compile the target using Soong.

Right now there is no way to get to Android build environment
variables such as $(PLATFORM_VERSION) $(TARGET_ARCH_VARIANT)" from
Android.bp, so the OS for HTTP request is set to simply "Android"
for now.

BUG=None
TEST=Build from root on Shamu
TEST=cd system/update_engine && mma -j32

Change-Id: I0fbc33ada0721323e989593ec91487278d7c576f
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..add6ad5
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,249 @@
+cc_defaults {
+    name: "curl_common_defaults",
+    cflags: [
+        "-Wpointer-arith",
+        "-Wwrite-strings",
+        "-Wunused",
+        "-Winline",
+        "-Wnested-externs",
+        "-Wmissing-declarations",
+        "-Wmissing-prototypes",
+        "-Wno-long-long",
+        "-Wfloat-equal",
+        "-Wno-multichar",
+        "-Wno-sign-compare",
+        "-Wno-format-nonliteral",
+        "-Wendif-labels",
+        "-Wstrict-prototypes",
+        "-Wdeclaration-after-statement",
+        "-Wno-system-headers",
+        "-DHAVE_CONFIG_H",
+        // TODO(avakulenko): Android.mk had this for OS version string:
+        // "Android $(PLATFORM_VERSION) $(TARGET_ARCH_VARIANT)"
+        // but Soong doesn't have access to those config variables yet.
+        "-DOS=\\\"Android\\\"",
+        "-Werror",
+        // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
+        "-Wno-varargs",
+    ],
+    clang: true,
+    local_include_dirs: ["include", "lib"],
+}
+
+cc_library {
+    name: "libcurl",
+    defaults: ["curl_common_defaults"],
+    export_include_dirs: ["include"],
+    host_supported: true,
+    srcs:[
+        "lib/file.c",
+        "lib/timeval.c",
+        "lib/base64.c",
+        "lib/hostip.c",
+        "lib/progress.c",
+        "lib/formdata.c",
+        "lib/cookie.c",
+        "lib/http.c",
+        "lib/sendf.c",
+        "lib/ftp.c",
+        "lib/url.c",
+        "lib/dict.c",
+        "lib/if2ip.c",
+        "lib/speedcheck.c",
+        "lib/ldap.c",
+        "lib/version.c",
+        "lib/getenv.c",
+        "lib/escape.c",
+        "lib/mprintf.c",
+        "lib/telnet.c",
+        "lib/netrc.c",
+        "lib/getinfo.c",
+        "lib/transfer.c",
+        "lib/strequal.c",
+        "lib/easy.c",
+        "lib/security.c",
+        "lib/curl_fnmatch.c",
+        "lib/fileinfo.c",
+        "lib/ftplistparser.c",
+        "lib/wildcard.c",
+        "lib/krb5.c",
+        "lib/memdebug.c",
+        "lib/http_chunks.c",
+        "lib/strtok.c",
+        "lib/connect.c",
+        "lib/llist.c",
+        "lib/hash.c",
+        "lib/multi.c",
+        "lib/content_encoding.c",
+        "lib/share.c",
+        "lib/http_digest.c",
+        "lib/md4.c",
+        "lib/md5.c",
+        "lib/http_negotiate.c",
+        "lib/inet_pton.c",
+        "lib/strtoofft.c",
+        "lib/strerror.c",
+        "lib/amigaos.c",
+        "lib/hostasyn.c",
+        "lib/hostip4.c",
+        "lib/hostip6.c",
+        "lib/hostsyn.c",
+        "lib/inet_ntop.c",
+        "lib/parsedate.c",
+        "lib/select.c",
+        "lib/tftp.c",
+        "lib/splay.c",
+        "lib/strdup.c",
+        "lib/socks.c",
+        "lib/ssh.c",
+        "lib/rawstr.c",
+        "lib/curl_addrinfo.c",
+        "lib/socks_gssapi.c",
+        "lib/socks_sspi.c",
+        "lib/curl_sspi.c",
+        "lib/slist.c",
+        "lib/nonblock.c",
+        "lib/curl_memrchr.c",
+        "lib/imap.c",
+        "lib/pop3.c",
+        "lib/smtp.c",
+        "lib/pingpong.c",
+        "lib/rtsp.c",
+        "lib/curl_threads.c",
+        "lib/warnless.c",
+        "lib/hmac.c",
+        "lib/curl_rtmp.c",
+        "lib/openldap.c",
+        "lib/curl_gethostname.c",
+        "lib/gopher.c",
+        "lib/idn_win32.c",
+        "lib/http_proxy.c",
+        "lib/non-ascii.c",
+        "lib/asyn-ares.c",
+        "lib/asyn-thread.c",
+        "lib/curl_gssapi.c",
+        "lib/http_ntlm.c",
+        "lib/curl_ntlm_wb.c",
+        "lib/curl_ntlm_core.c",
+        "lib/curl_sasl.c",
+        "lib/curl_multibyte.c",
+        "lib/hostcheck.c",
+        "lib/conncache.c",
+        "lib/pipeline.c",
+        "lib/dotdot.c",
+        "lib/x509asn1.c",
+        "lib/http2.c",
+        "lib/smb.c",
+        "lib/curl_endian.c",
+        "lib/curl_des.c",
+        "lib/system_win32.c",
+        "lib/vauth/vauth.c",
+        "lib/vauth/cleartext.c",
+        "lib/vauth/cram.c",
+        "lib/vauth/digest.c",
+        "lib/vauth/digest_sspi.c",
+        "lib/vauth/krb5_gssapi.c",
+        "lib/vauth/krb5_sspi.c",
+        "lib/vauth/ntlm.c",
+        "lib/vauth/ntlm_sspi.c",
+        "lib/vauth/oauth2.c",
+        "lib/vauth/spnego_gssapi.c",
+        "lib/vauth/spnego_sspi.c",
+        "lib/vtls/openssl.c",
+        "lib/vtls/gtls.c",
+        "lib/vtls/vtls.c",
+        "lib/vtls/nss.c",
+        "lib/vtls/polarssl.c",
+        "lib/vtls/polarssl_threadlock.c",
+        "lib/vtls/axtls.c",
+        "lib/vtls/cyassl.c",
+        "lib/vtls/schannel.c",
+        "lib/vtls/darwinssl.c",
+        "lib/vtls/gskit.c",
+        "lib/vtls/mbedtls.c",
+    ],
+    shared: {
+        shared_libs: [
+            "libcrypto",
+            "libssl",
+        ],
+    },
+    static: {
+        static_libs: [
+            "libcrypto",
+            "libssl",
+            "libz",
+        ],
+    },
+    target: {
+        host: {
+            cflags: ["-D_GNU_SOURCE=1"],
+            shared: {
+                shared_libs: [
+                    "libz-host",
+                ],
+            },
+        },
+        android: {
+            shared: {
+                shared_libs: [
+                    "libz",
+                ],
+            },
+        },
+    },
+    unique_host_soname: true,
+}
+
+cc_binary {
+    name: "curl",
+    defaults: ["curl_common_defaults"],
+    srcs: [
+        "src/slist_wc.c",
+        "src/tool_binmode.c",
+        "src/tool_bname.c",
+        "src/tool_cb_dbg.c",
+        "src/tool_cb_hdr.c",
+        "src/tool_cb_prg.c",
+        "src/tool_cb_rea.c",
+        "src/tool_cb_see.c",
+        "src/tool_cb_wrt.c",
+        "src/tool_cfgable.c",
+        "src/tool_convert.c",
+        "src/tool_dirhie.c",
+        "src/tool_doswin.c",
+        "src/tool_easysrc.c",
+        "src/tool_formparse.c",
+        "src/tool_getparam.c",
+        "src/tool_getpass.c",
+        "src/tool_help.c",
+        "src/tool_helpers.c",
+        "src/tool_homedir.c",
+        "src/tool_hugehelp.c",
+        "src/tool_libinfo.c",
+        "src/tool_main.c",
+        "src/tool_metalink.c",
+        "src/tool_mfiles.c",
+        "src/tool_msgs.c",
+        "src/tool_operate.c",
+        "src/tool_operhlp.c",
+        "src/tool_panykey.c",
+        "src/tool_paramhlp.c",
+        "src/tool_parsecfg.c",
+        "src/tool_strdup.c",
+        "src/tool_setopt.c",
+        "src/tool_sleep.c",
+        "src/tool_urlglob.c",
+        "src/tool_util.c",
+        "src/tool_vms.c",
+        "src/tool_writeenv.c",
+        "src/tool_writeout.c",
+        "src/tool_xattr.c",
+    ],
+    shared_libs: [
+        "libcrypto",
+        "libssl",
+        "libz",
+    ],
+    static_libs: ["libcurl"],
+}