kumquat-buildroot/package/android-tools/0004-Fix-build-issue-with-musl.patch

232 lines
5.9 KiB
Diff
Raw Normal View History

[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