update_engine: Migrate build system to gyp.

This change migrates the SConstruct file to the platform2 gyp
infrastructure without changing the way UE is compiled. The
code is still compiled as a single static library shared
between delta_generator, update_engine and update_engine_client.

This patch adds two generic .gypi rules to generate bindings for
DBus glib and public keys using openssl.

update_engine_unittests requires to run the openssl version from the
board and not the one on the host. This changes does that by using
SYSROOT when possible.

delta_generator is built without -pie to avoid a bug on how it
is run from au-generator.zip.

BUG=chromium:393293,chromium:394241
TEST=emerge-link update_engine; sudo emerge update_engine
TEST=cros_workon_make --reconf --test update_engine
TEST=cbuildbot link-release amd64-generic-full x86-generic-full
CQ-DEPEND=CL:Id81c7dca798ac8003252259eed03a12a60054437

Change-Id: Icc5e24ac202e552275cd197ee0b9a4a3d9b4a47c
Reviewed-on: https://chromium-review.googlesource.com/208487
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 8d4eacd..226427f 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -196,9 +196,9 @@
   // Generates a new private key that will not match the public key.
   if (signature_test == kSignatureGeneratedShellBadKey) {
     LOG(INFO) << "Generating a mismatched private key.";
-    ASSERT_EQ(0,
-              System(base::StringPrintf("openssl genrsa -out %s 2048",
-                                        private_key_path.c_str())));
+    ASSERT_EQ(0, System(base::StringPrintf(
+        "%s genrsa -out %s 2048",
+        utils::GetPathOnBoard("openssl").c_str(), private_key_path.c_str())));
   }
   int signature_size = GetSignatureSize(private_key_path);
   string hash_file;
@@ -230,7 +230,8 @@
   ScopedPathUnlinker sig_unlinker(sig_file);
   ASSERT_EQ(0,
             System(base::StringPrintf(
-                "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
+                "%s rsautl -raw -sign -inkey %s -in %s -out %s",
+                utils::GetPathOnBoard("openssl").c_str(),
                 private_key_path.c_str(),
                 hash_file.c_str(),
                 sig_file.c_str())));
@@ -241,7 +242,8 @@
       signature_test == kSignatureGeneratedShellRotateCl2) {
     ASSERT_EQ(0,
               System(base::StringPrintf(
-                  "openssl rsautl -raw -sign -inkey %s -in %s -out %s",
+                  "%s rsautl -raw -sign -inkey %s -in %s -out %s",
+                  utils::GetPathOnBoard("openssl").c_str(),
                   kUnittestPrivateKey2Path,
                   hash_file.c_str(),
                   sig_file2.c_str())));