From 6e8617f22247d761ae42dd637c7dda4ee2106f5b Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 18 Aug 2016 23:50:16 +0200 Subject: [PATCH] package/android-tools: drop musl-compatibility cdefs patching out We now always have a sys/cdefs.h, so we no longer need to patch it out. Simplify the patch by removing any hunk removing cdefs.h or the use of __BEGIN_DECLS/__END_DECLS. However, it must be included when macros it defines are being used. Also, renumber patches to guarantee ordering (static patch was added before big-endian one). Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni Reviewed-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Thomas Petazzoni --- .../0004-Fix-build-issue-with-musl.patch | 181 +----------------- ....patch => 0006-fix-big-endian-build.patch} | 0 .../0007-include-cdefs-h-when-needed.patch | 41 ++++ 3 files changed, 43 insertions(+), 179 deletions(-) rename package/android-tools/{0005-fix-big-endian-build.patch => 0006-fix-big-endian-build.patch} (100%) create mode 100644 package/android-tools/0007-include-cdefs-h-when-needed.patch diff --git a/package/android-tools/0004-Fix-build-issue-with-musl.patch b/package/android-tools/0004-Fix-build-issue-with-musl.patch index e5ba0e6ec4..964eb87a6d 100644 --- a/package/android-tools/0004-Fix-build-issue-with-musl.patch +++ b/package/android-tools/0004-Fix-build-issue-with-musl.patch @@ -1,9 +1,6 @@ [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 +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 @@ -26,7 +23,7 @@ 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 @@ +@@ -52,6 +52,8 @@ #ifndef _ARPA_NAMESER_H_ #define _ARPA_NAMESER_H_ @@ -35,51 +32,12 @@ index 438dc04..b2a28d6 100644 #define BIND_4_COMPAT - #include --#include - - /* - * 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 - #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 @@ -92,140 +50,5 @@ index 20c08d2..48e0241 100644 #include #include #include -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 - #include - #include - #include -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 -- --__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 --#endif - #include - #include - #include -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 - #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 - diff --git a/package/android-tools/0005-fix-big-endian-build.patch b/package/android-tools/0006-fix-big-endian-build.patch similarity index 100% rename from package/android-tools/0005-fix-big-endian-build.patch rename to package/android-tools/0006-fix-big-endian-build.patch diff --git a/package/android-tools/0007-include-cdefs-h-when-needed.patch b/package/android-tools/0007-include-cdefs-h-when-needed.patch new file mode 100644 index 0000000000..da4ee13a17 --- /dev/null +++ b/package/android-tools/0007-include-cdefs-h-when-needed.patch @@ -0,0 +1,41 @@ +Include cdefs.h wherever it is needed + +cdefs.h is included from within a lot of glibc headers, so it almost +invariably and automagically gets pulled in with glibc. + +However, this might not be the case with other C libraries. musl does +not provide cdefs.h so it does not include it from its own headers +(cdefs.h must be provided separately). + +So we must include it when we are going to use macros it provides. + +Signed-off-by: "Yann E. MORIN" +--- + core/adbd/services.c | 1 + + core/libcutils/android_reboot.c | 1 + + 2 files changed, 2 insertions(+), 0 deletion(-) + +diff --git a/core/adbd/services.c b/core/adbd/services.c +index 20c08d2..48e0241 100644 +--- a/core/adbd/services.c ++++ b/core/adbd/services.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include "sysdeps.h" + +diff --git a/core/libcutils/android_reboot.c b/core/libcutils/android_reboot.c +index 20c08d2..48e0241 100644 +--- a/core/libcutils/android_reboot.c ++++ b/core/libcutils/android_reboot.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + -- 2.30.2