summaryrefslogtreecommitdiffstats
path: root/package/android-tools/0004-Fix-build-issue-with-musl.patch
blob: e5ba0e6ec4a102d666ba470d2743e1d330b84104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
[PATCH] Fix build issue with musl

cdefs.h header doesn't exist in musl toolchains:
http://wiki.musl-libc.org/wiki/FAQ

Also arpa/nameser.h doesn't use the same macro name to avoid several
inclusions.

Finally had an issue with framebuffer_service.c since it was missing the
TEMP_FAILURE_RETRY macro.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 core/adbd/arpa_nameser.h              | 12 +++++++++---
 core/adbd/base64.c                    |  1 -
 core/adbd/framebuffer_service.c       |  1 +
 core/adbd/qemu_pipe.h                 |  1 -
 core/include/cutils/android_reboot.h  |  8 ++++++--
 core/include/cutils/bitops.h          | 10 ++++++----
 core/include/cutils/partition_utils.h |  8 ++++++--
 extras/ext4_utils/sha1.c              |  3 ---
 extras/ext4_utils/sha1.h              | 13 ++++++-------
 9 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/core/adbd/arpa_nameser.h b/core/adbd/arpa_nameser.h
index 438dc04..b2a28d6 100644
--- a/core/adbd/arpa_nameser.h
+++ b/core/adbd/arpa_nameser.h
@@ -52,11 +52,12 @@
 
 #ifndef _ARPA_NAMESER_H_
 #define _ARPA_NAMESER_H_
+#ifndef _ARPA_NAMESER_H
+#define _ARPA_NAMESER_H
 
 #define BIND_4_COMPAT
 
 #include <sys/types.h>
-#include <sys/cdefs.h>
 
 /*
  * Revision information.  This is the release date in YYYYMMDD format.
@@ -505,7 +506,9 @@ typedef enum __ns_cert_types {
 #define	ns_makecanon		__ns_makecanon
 #define	ns_samename		__ns_samename
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 int		ns_msg_getflag(ns_msg, int);
 uint16_t	ns_get16(const u_char *);
 uint32_t	ns_get32(const u_char *);
@@ -560,7 +563,9 @@ int		ns_samedomain(const char *, const char *);
 int		ns_subdomain(const char *, const char *);
 int		ns_makecanon(const char *, char *, size_t);
 int		ns_samename(const char *, const char *);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #ifdef BIND_4_COMPAT
 #include "arpa_nameser_compat.h"
@@ -574,4 +579,5 @@ __END_DECLS
 #define  XLOG(...)   do {} while (0)
 #endif
 
+#endif /* !_ARPA_NAMESER_H */
 #endif /* !_ARPA_NAMESER_H_ */
diff --git a/core/adbd/base64.c b/core/adbd/base64.c
index 7270703..73725f5 100644
--- a/core/adbd/base64.c
+++ b/core/adbd/base64.c
@@ -42,7 +42,6 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 __RCSID("$NetBSD: base64.c,v 1.8 2002/11/11 01:15:17 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
diff --git a/core/adbd/framebuffer_service.c b/core/adbd/framebuffer_service.c
index 20c08d2..48e0241 100644
--- a/core/adbd/framebuffer_service.c
+++ b/core/adbd/framebuffer_service.c
@@ -26,6 +26,7 @@
 #include "fdevent.h"
 #include "adb.h"
 
+#include <cutils/fs.h>
 #include <linux/fb.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
diff --git a/core/adbd/qemu_pipe.h b/core/adbd/qemu_pipe.h
index 1a67022..572a242 100644
--- a/core/adbd/qemu_pipe.h
+++ b/core/adbd/qemu_pipe.h
@@ -16,7 +16,6 @@
 #ifndef ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
 #define ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
 
-#include <sys/cdefs.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/mman.h>
diff --git a/core/include/cutils/android_reboot.h b/core/include/cutils/android_reboot.h
index 0c79be7..2ebe1cf 100644
--- a/core/include/cutils/android_reboot.h
+++ b/core/include/cutils/android_reboot.h
@@ -17,7 +17,9 @@
 #ifndef __CUTILS_ANDROID_REBOOT_H__
 #define __CUTILS_ANDROID_REBOOT_H__
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Commands */
 #define ANDROID_RB_RESTART  0xDEAD0001
@@ -30,6 +32,8 @@ __BEGIN_DECLS
 
 int android_reboot(int cmd, int flags, char *arg);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CUTILS_ANDROID_REBOOT_H__ */
diff --git a/core/include/cutils/bitops.h b/core/include/cutils/bitops.h
index 1b3b762..a7c8cab 100644
--- a/core/include/cutils/bitops.h
+++ b/core/include/cutils/bitops.h
@@ -17,9 +17,9 @@
 #ifndef __CUTILS_BITOPS_H
 #define __CUTILS_BITOPS_H
 
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 static inline int popcount(unsigned int x)
 {
@@ -36,6 +36,8 @@ static inline int popcountll(unsigned long long x)
     return __builtin_popcountll(x);
 }
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CUTILS_BITOPS_H */
diff --git a/core/include/cutils/partition_utils.h b/core/include/cutils/partition_utils.h
index 597df92..0da9d5b 100644
--- a/core/include/cutils/partition_utils.h
+++ b/core/include/cutils/partition_utils.h
@@ -17,11 +17,15 @@
 #ifndef __CUTILS_PARTITION_WIPED_H__
 #define __CUTILS_PARTITION_WIPED_H__
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 int partition_wiped(char *source);
 void erase_footer(const char *dev_path, long long size);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __CUTILS_PARTITION_WIPED_H__ */
diff --git a/extras/ext4_utils/sha1.c b/extras/ext4_utils/sha1.c
index 463ec38..e2e29cf 100644
--- a/extras/ext4_utils/sha1.c
+++ b/extras/ext4_utils/sha1.c
@@ -17,9 +17,6 @@
 
 #define SHA1HANDSOFF		/* Copies data before messing with it. */
 
-#ifndef USE_MINGW
-#include <sys/cdefs.h>
-#endif
 #include <sys/types.h>
 #include <assert.h>
 #include <string.h>
diff --git a/extras/ext4_utils/sha1.h b/extras/ext4_utils/sha1.h
index 9a8f7e3..fe3217e 100644
--- a/extras/ext4_utils/sha1.h
+++ b/extras/ext4_utils/sha1.h
@@ -17,11 +17,6 @@ typedef unsigned char u_char;
 typedef unsigned int uint32_t;
 typedef unsigned int u_int32_t;
 typedef unsigned int u_int;
-
-#define __BEGIN_DECLS
-#define __END_DECLS
-#else
-#include <sys/cdefs.h>
 #endif
 
 #define SHA1_DIGEST_LENGTH		20
@@ -33,11 +28,15 @@ typedef struct {
 	u_char buffer[64];
 } SHA1_CTX;
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 void	SHA1Transform(uint32_t[5], const u_char[64]);
 void	SHA1Init(SHA1_CTX *);
 void	SHA1Update(SHA1_CTX *, const u_char *, u_int);
 void	SHA1Final(u_char[SHA1_DIGEST_LENGTH], SHA1_CTX *);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _SYS_SHA1_H_ */
-- 
2.6.1

OpenPOWER on IntegriCloud