Fix includes and DBus headers to build on Android.
This patch include a set of small changes to includes and names in
order to be compatible with the Android build system.
First, the DBus .xml file needs to be renamed to .dbus-xml and the
output directory must match the soruce directory, since the headers are
generated with automatic Makefile rules.
Some headers required by bionic were missing, such as endian.h and
xattr.h. In the xattr.h case, we include the header from the glibc
(or bionic) instead of libattr, since libattr is not available in
AOSP in the first place, and we are not linking against it Chrome OS,
so we shold include the right headers.
Bug: 23084776
TEST=`FEATURES=test emerge-link update_engine` works; `mma` in AOSP doesn't have these errors anymore (but still doesn't build).
Change-Id: Ifeedfe9d894ca78baa03940ac55563cfcd464e76
diff --git a/dbus_bindings/org.chromium.LibCrosService.xml b/dbus_bindings/org.chromium.LibCrosService.dbus-xml
similarity index 100%
rename from dbus_bindings/org.chromium.LibCrosService.xml
rename to dbus_bindings/org.chromium.LibCrosService.dbus-xml
diff --git a/dbus_service.h b/dbus_service.h
index 6da972f..9c4f712 100644
--- a/dbus_service.h
+++ b/dbus_service.h
@@ -26,7 +26,7 @@
#include "update_engine/update_attempter.h"
-#include "update_engine/dbus_adaptor/org.chromium.UpdateEngineInterface.h"
+#include "dbus_bindings/org.chromium.UpdateEngineInterface.h"
namespace chromeos {
namespace dbus {
diff --git a/p2p_manager.cc b/p2p_manager.cc
index a8765ef..3cba737 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -22,7 +22,6 @@
#include "update_engine/p2p_manager.h"
-#include <attr/xattr.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/falloc.h>
@@ -31,6 +30,7 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/types.h>
+#include <sys/xattr.h>
#include <unistd.h>
#include <algorithm>
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index ce12b9c..05e44c4 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -19,8 +19,9 @@
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
#include <unistd.h>
-#include <attr/xattr.h> // NOLINT - requires typed defined in unistd.h
#include <memory>
#include <string>
@@ -277,10 +278,10 @@
if (expected_size_xattr == 0) {
ea_size = getxattr(path.c_str(), "user.cros-p2p-filesize",
&ea_value, sizeof ea_value - 1);
- if (ea_size == -1 && errno == ENOATTR) {
+ if (ea_size == -1 && errno == ENODATA) {
// This is valid behavior as we support files without the xattr set.
} else {
- PLOG(ERROR) << "getxattr() didn't fail with ENOATTR as expected, "
+ PLOG(ERROR) << "getxattr() didn't fail with ENODATA as expected, "
<< "ea_size=" << ea_size << ", errno=" << errno;
return false;
}
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index 66f51dd..6185f6c 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -16,6 +16,8 @@
#include "update_engine/payload_generator/payload_file.h"
+#include <endian.h>
+
#include <algorithm>
#include "update_engine/delta_performer.h"
diff --git a/payload_generator/payload_signer.cc b/payload_generator/payload_signer.cc
index 5b7d677..218b432 100644
--- a/payload_generator/payload_signer.cc
+++ b/payload_generator/payload_signer.cc
@@ -16,6 +16,8 @@
#include "update_engine/payload_generator/payload_signer.h"
+#include <endian.h>
+
#include <base/logging.h>
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
diff --git a/test_utils.cc b/test_utils.cc
index c0869fe..896097f 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -16,13 +16,13 @@
#include "update_engine/test_utils.h"
-#include <attr/xattr.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/xattr.h>
#include <unistd.h>
#include <set>
diff --git a/update_engine.gyp b/update_engine.gyp
index 339c45e..0f0a770 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -42,6 +42,7 @@
'-Wl,--gc-sections',
],
'defines': [
+ '_FILE_OFFSET_BITS=64',
'_POSIX_C_SOURCE=199309L',
'USE_HWID_OVERRIDE=<(USE_hwid_override)',
'USE_MTD=<(USE_mtd)',
@@ -83,7 +84,7 @@
'target_name': 'update_engine-dbus-adaptor',
'type': 'none',
'variables': {
- 'dbus_adaptors_out_dir': 'include/update_engine/dbus_adaptor',
+ 'dbus_adaptors_out_dir': 'include/dbus_bindings',
'dbus_xml_extension': 'dbus-xml',
},
'sources': [
@@ -102,7 +103,7 @@
'proxy_output_file': 'include/libcros/dbus-proxies.h'
},
'sources': [
- 'dbus_bindings/org.chromium.LibCrosService.xml',
+ 'dbus_bindings/org.chromium.LibCrosService.dbus-xml',
],
'includes': ['../../../platform2/common-mk/generate-dbus-proxies.gypi'],
},
@@ -120,8 +121,6 @@
'variables': {
'exported_deps': [
'dbus-1',
- 'libchrome-<(libbase_ver)',
- 'libchromeos-<(libbase_ver)',
'libcrypto',
'libcurl',
'libdebugd-client',
@@ -142,13 +141,6 @@
],
},
},
- 'include_dirs': [
- # We include the update_engine/dbus-constants from the
- # libupdate_engine-client library path. The file is installed by
- # system_api, but it is technically part of the library we are
- # generating but didn't install yet.
- '<(sysroot)/usr/include/update_engine-client',
- ],
'link_settings': {
'variables': {
'deps': [
@@ -288,9 +280,6 @@
'<@(exported_deps)',
],
},
- 'libraries': [
- '-lvboot_host',
- ],
},
'sources': [
'payload_generator/ab_generator.cc',
diff --git a/utils.cc b/utils.cc
index a50e56a..2baa087 100644
--- a/utils.cc
+++ b/utils.cc
@@ -20,6 +20,7 @@
#include <dirent.h>
#include <elf.h>
+#include <endian.h>
#include <errno.h>
#include <ext2fs/ext2fs.h>
#include <fcntl.h>