Use a prebuilt libcurl and libssl (avoid host)

Even though we only link in libcurl and libssl for cargo, and don't
actually use it, we still want to be hermetic about it. Use the libcurl
and libssl available from the android-emulator prebuilts.

Bug: 129701460
Change-Id: I0736a3cd846c6fb49cff8b1cc6bd89ea92fdcc61
diff --git a/build.py b/build.py
index 885a237..796660a 100755
--- a/build.py
+++ b/build.py
@@ -61,9 +61,15 @@
     # Build
     env = dict(os.environ)
     cmake_bindir = paths.cmake_prebuilt('bin')
+    curl_libdir = paths.curl_prebuilt('lib')
     build_tools_bindir = paths.build_tools_prebuilt()
     env['PATH'] = '{0}:{1}:{2}'.format(build_tools_bindir, cmake_bindir,
                                        env['PATH'])
+    if 'LIBRARY_PATH' in env:
+        old_library_path = ':{0}'.format(env['LIBRARY_PATH'])
+    else:
+        old_library_path = ''
+    env['LIBRARY_PATH'] = '{0}{1}'.format(curl_libdir, old_library_path)
     ec = subprocess.Popen([paths.rustc_path('x.py'), '--stage', '3', 'install'],
                           cwd=paths.rustc_path(), env=env).wait()
     if ec != 0:
diff --git a/paths.py b/paths.py
index 6cef77a..e43d28e 100644
--- a/paths.py
+++ b/paths.py
@@ -61,3 +61,8 @@
     """Generates a path relative to the build-tools prebuilt directory."""
     return workspace_path('prebuilts', 'build-tools', 'path', 'linux-x86',
                           *args)
+
+def curl_prebuilt(*args):
+    """Generates a path relative to the curl prebuilt directory."""
+    return workspace_path('prebuilts', 'android-emulator-build', 'curl',
+                          'linux-x86_64', *args)