aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/libbase-fix-includes.patch71
-rw-r--r--gnu/packages/patches/libbase-use-own-logging.patch80
2 files changed, 151 insertions, 0 deletions
diff --git a/gnu/packages/patches/libbase-fix-includes.patch b/gnu/packages/patches/libbase-fix-includes.patch
new file mode 100644
index 0000000000..3071a0c400
--- /dev/null
+++ b/gnu/packages/patches/libbase-fix-includes.patch
@@ -0,0 +1,71 @@
+This patch fixes the build of adb on linux.
+
+Copied from archlinux repository:
+https://git.archlinux.org/svntogit/community.git/tree/trunk/fix_build.patch?h=packages/android-tools
+
+diff --git a/adb/sysdeps.h b/adb/sysdeps.h
+index 75dcc86..867f3ec 100644
+--- a/adb/sysdeps.h
++++ b/adb/sysdeps.h
+@@ -25,6 +25,7 @@
+ #endif
+
+ #include <errno.h>
++#include <sys/syscall.h>
+
+ #include <string>
+ #include <vector>
+@@ -831,7 +832,16 @@ static __inline__ int adb_is_absolute_host_path(const char* path) {
+
+ static __inline__ unsigned long adb_thread_id()
+ {
+- return (unsigned long)gettid();
++ // TODO: this function should be merged with GetThreadId
++#if defined(__BIONIC__)
++ return gettid();
++#elif defined(__APPLE__)
++ return syscall(SYS_thread_selfid);
++#elif defined(__linux__)
++ return syscall(__NR_gettid);
++#elif defined(_WIN32)
++ return GetCurrentThreadId();
++#endif
+ }
+
+ #endif /* !_WIN32 */
+diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
+index 296995e..48269b6 100644
+--- a/base/errors_unix.cpp
++++ b/base/errors_unix.cpp
+@@ -17,6 +17,7 @@
+ #include "android-base/errors.h"
+
+ #include <errno.h>
++#include <string.h>
+
+ namespace android {
+ namespace base {
+diff --git a/base/file.cpp b/base/file.cpp
+index da1adba..91a3901 100644
+--- a/base/file.cpp
++++ b/base/file.cpp
+@@ -20,6 +20,7 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <string.h>
+
+ #include <string>
+
+diff --git a/base/logging.cpp b/base/logging.cpp
+index 1741871..e97c7f1 100644
+--- a/base/logging.cpp
++++ b/base/logging.cpp
+@@ -21,6 +21,7 @@
+ #include "android-base/logging.h"
+
+ #include <libgen.h>
++#include <string.h>
+
+ // For getprogname(3) or program_invocation_short_name.
+ #if defined(__ANDROID__) || defined(__APPLE__)
diff --git a/gnu/packages/patches/libbase-use-own-logging.patch b/gnu/packages/patches/libbase-use-own-logging.patch
new file mode 100644
index 0000000000..f755bf9722
--- /dev/null
+++ b/gnu/packages/patches/libbase-use-own-logging.patch
@@ -0,0 +1,80 @@
+Patch copied from:
+https://android.googlesource.com/platform/system/core/+/e5dd71a290f664d3f3bf0dd8a4bad411dc7ad416
+
+From e5dd71a290f664d3f3bf0dd8a4bad411dc7ad416 Mon Sep 17 00:00:00 2001
+From: Elliott Hughes <enh@google.com>
+Date: Thu, 28 Jul 2016 15:15:28 -0700
+Subject: [PATCH] libbase should use its own logging!
+
+Not doing so led to us using a bogus log tag.
+
+Bug: http://b/30281203
+Change-Id: I3ac91758a1a043146c65f2ae0f36fcfbe372c30f
+---
+ base/file.cpp | 11 +++++------
+ base/logging.cpp | 3 +--
+ 2 files changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/base/file.cpp b/base/file.cpp
+index da1adba19..4e7ac82d1 100644
+--- a/base/file.cpp
++++ b/base/file.cpp
+@@ -24,9 +24,8 @@
+ #include <string>
+
+ #include "android-base/macros.h" // For TEMP_FAILURE_RETRY on Darwin.
++#include "android-base/logging.h"
+ #include "android-base/utf8.h"
+-#define LOG_TAG "base.file"
+-#include "cutils/log.h"
+ #include "utils/Compat.h"
+
+ namespace android {
+@@ -86,22 +85,22 @@ bool WriteStringToFile(const std::string& content, const std::string& path,
+ int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
+ int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, mode));
+ if (fd == -1) {
+- ALOGE("android::WriteStringToFile open failed: %s", strerror(errno));
++ PLOG(ERROR) << "android::WriteStringToFile open failed";
+ return false;
+ }
+
+ // We do an explicit fchmod here because we assume that the caller really
+ // meant what they said and doesn't want the umask-influenced mode.
+ if (fchmod(fd, mode) == -1) {
+- ALOGE("android::WriteStringToFile fchmod failed: %s", strerror(errno));
++ PLOG(ERROR) << "android::WriteStringToFile fchmod failed";
+ return CleanUpAfterFailedWrite(path);
+ }
+ if (fchown(fd, owner, group) == -1) {
+- ALOGE("android::WriteStringToFile fchown failed: %s", strerror(errno));
++ PLOG(ERROR) << "android::WriteStringToFile fchown failed";
+ return CleanUpAfterFailedWrite(path);
+ }
+ if (!WriteStringToFd(content, fd)) {
+- ALOGE("android::WriteStringToFile write failed: %s", strerror(errno));
++ PLOG(ERROR) << "android::WriteStringToFile write failed";
+ return CleanUpAfterFailedWrite(path);
+ }
+ close(fd);
+diff --git a/base/logging.cpp b/base/logging.cpp
+index 769c266c9..959bb8b05 100644
+--- a/base/logging.cpp
++++ b/base/logging.cpp
+@@ -43,12 +43,11 @@
+
+ #include "android-base/macros.h"
+ #include "android-base/strings.h"
+-#include "cutils/threads.h"
+
+ // Headers for LogMessage::LogLine.
+ #ifdef __ANDROID__
+ #include <android/set_abort_message.h>
+-#include "cutils/log.h"
++#include "log/log.h"
+ #else
+ #include <sys/types.h>
+ #include <unistd.h>
+--
+2.11.0
+