Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / patches / libbase-fix-includes.patch
1 This patch fixes the build of adb on linux.
2
3 Copied from archlinux repository:
4 https://git.archlinux.org/svntogit/community.git/tree/trunk/fix_build.patch?h=packages/android-tools
5
6 diff --git a/adb/sysdeps.h b/adb/sysdeps.h
7 index 75dcc86..867f3ec 100644
8 --- a/adb/sysdeps.h
9 +++ b/adb/sysdeps.h
10 @@ -25,6 +25,7 @@
11 #endif
12
13 #include <errno.h>
14 +#include <sys/syscall.h>
15
16 #include <string>
17 #include <vector>
18 @@ -831,7 +832,16 @@ static __inline__ int adb_is_absolute_host_path(const char* path) {
19
20 static __inline__ unsigned long adb_thread_id()
21 {
22 - return (unsigned long)gettid();
23 + // TODO: this function should be merged with GetThreadId
24 +#if defined(__BIONIC__)
25 + return gettid();
26 +#elif defined(__APPLE__)
27 + return syscall(SYS_thread_selfid);
28 +#elif defined(__linux__)
29 + return syscall(__NR_gettid);
30 +#elif defined(_WIN32)
31 + return GetCurrentThreadId();
32 +#endif
33 }
34
35 #endif /* !_WIN32 */
36 diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
37 index 296995e..48269b6 100644
38 --- a/base/errors_unix.cpp
39 +++ b/base/errors_unix.cpp
40 @@ -17,6 +17,7 @@
41 #include "android-base/errors.h"
42
43 #include <errno.h>
44 +#include <string.h>
45
46 namespace android {
47 namespace base {
48 diff --git a/base/file.cpp b/base/file.cpp
49 index da1adba..91a3901 100644
50 --- a/base/file.cpp
51 +++ b/base/file.cpp
52 @@ -20,6 +20,7 @@
53 #include <fcntl.h>
54 #include <sys/stat.h>
55 #include <sys/types.h>
56 +#include <string.h>
57
58 #include <string>
59
60 diff --git a/base/logging.cpp b/base/logging.cpp
61 index 1741871..e97c7f1 100644
62 --- a/base/logging.cpp
63 +++ b/base/logging.cpp
64 @@ -21,6 +21,7 @@
65 #include "android-base/logging.h"
66
67 #include <libgen.h>
68 +#include <string.h>
69
70 // For getprogname(3) or program_invocation_short_name.
71 #if defined(__ANDROID__) || defined(__APPLE__)