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/utils.cc b/utils.cc
index f78861a..1235a6b 100644
--- a/utils.cc
+++ b/utils.cc
@@ -669,6 +669,27 @@
return true;
}
+string GetPathOnBoard(const string& command) {
+ int return_code = 0;
+ string command_path;
+ // TODO(deymo): prepend SYSROOT to each PATH instead of the result.
+ if (!Subprocess::SynchronousExec(
+ {"which", command}, &return_code, &command_path)) {
+ return command;
+ }
+ if (return_code != 0)
+ return command;
+
+ base::TrimWhitespaceASCII(command_path, base::TRIM_ALL, &command_path);
+ const char* env_sysroot = getenv("SYSROOT");
+ if (env_sysroot) {
+ string sysroot_command_path = env_sysroot + command_path;
+ if (utils::FileExists(sysroot_command_path.c_str()))
+ return sysroot_command_path;
+ }
+ return command_path;
+}
+
// Tries to parse the header of an ELF file to obtain a human-readable
// description of it on the |output| string.
static bool GetFileFormatELF(const char* buffer, size_t size, string* output) {