[oe] [meta-networking] [PATCH V2] atftp: fixes musl libc build

liu.ming50 at gmail.com liu.ming50 at gmail.com
Thu Oct 20 12:53:33 UTC 2016


From: Ming Liu <peter.x.liu at external.atlascopco.com>

The patches derive from buildroot:
https://git.busybox.net/buildroot/commit/?id=ef33c008e3c5048d1442f8b0f6336db2fa8d79a1

Adjust __BEGIN_DECLS/__END_DECLS defines according to:
http://wiki.musl-libc.org/wiki/FAQ

Signed-off-by: Ming Liu <peter.x.liu at external.atlascopco.com>
---
 .../atftp/atftp-0.7_add_missing_defines.patch      | 65 ++++++++++++++++++++++
 .../atftp/atftp-0.7_add_missing_include.patch      | 43 ++++++++++++++
 meta-networking/recipes-daemons/atftp/atftp_git.bb |  3 +
 3 files changed, 111 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_defines.patch
 create mode 100644 meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_include.patch

diff --git a/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_defines.patch b/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_defines.patch
new file mode 100644
index 0000000..7af3a7e
--- /dev/null
+++ b/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_defines.patch
@@ -0,0 +1,65 @@
+From 6d597493131b19aa78c1cecd63ac4e266bb50df8 Mon Sep 17 00:00:00 2001
+From: Peter Liu <peter.x.liu at external.atlascopco.com>
+Date: Thu, 20 Oct 2016 14:31:30 +0200
+Subject: [PATCH] argz.h: fix compiling (add missing defines)
+
+Use extern "C" instead of __BEGIN_DECL/__END_DECL macros, these macros
+are defined in sys/cdefs.h for glibc and this header is not available
+on all libc.
+
+Also define __attribute_pure__ if it's not defined.
+
+Upstream-Status: Pending
+
+Signed-off-by: Peter Liu <peter.x.liu at external.atlascopco.com>
+---
+ argz.h | 22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/argz.h b/argz.h
+index 582be55..11e1431 100644
+--- a/argz.h
++++ b/argz.h
+@@ -48,12 +48,28 @@
+ # define __const const
+ #endif
+ 
++#ifndef __attribute_pure__
++# define __attribute_pure__
++#endif
++
+ #ifndef __error_t_defined
+ typedef int error_t;
+ #endif
+ 
++#ifndef __THROW
++# ifndef __GNUC_PREREQ
++#  define __GNUC_PREREQ(maj, min) (0)
++# endif
++# if defined __cplusplus && __GNUC_PREREQ (2,8)
++#  define __THROW throw ()
++# else
++#  define __THROW
++# endif
++#endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Make a '\0' separated arg vector from a unix argv vector, returning it in
+    ARGZ, and the total length in LEN.  If a memory allocation error occurs,
+@@ -200,6 +216,8 @@ argz_next (__const char *__argz, size_t __argz_len,
+ }
+ #endif /* Use extern inlines.  */
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* argz.h */
+-- 
+1.9.1
+
diff --git a/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_include.patch b/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_include.patch
new file mode 100644
index 0000000..851626c
--- /dev/null
+++ b/meta-networking/recipes-daemons/atftp/atftp/atftp-0.7_add_missing_include.patch
@@ -0,0 +1,43 @@
+From 77e399899d9d7297d23c321811b628febdf0fd92 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report at gmx.net>
+Date: Thu, 16 Apr 2015 22:43:49 +0200
+Subject: [PATCH] tftp.h/tftpd.h: fix compile (missing include)
+
+Upstream-Status: Pending
+
+Add sys/types.h include for u_char typedef.
+
+Signed-off-by: Peter Seiderer <ps.report at gmx.net>
+Signed-off-by: Ming Liu <peter.x.liu at external.atlascopco.com>
+---
+ tftp.h  | 1 +
+ tftpd.h | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/tftp.h b/tftp.h
+index 12bd6aa..32a3f63 100644
+--- a/tftp.h
++++ b/tftp.h
+@@ -19,6 +19,7 @@
+ 
+ #include <sys/time.h>
+ #include <sys/times.h>
++#include <sys/types.h>
+ #include "tftp_def.h"
+ #include "config.h"
+ 
+diff --git a/tftpd.h b/tftpd.h
+index 945065e..60d3a49 100644
+--- a/tftpd.h
++++ b/tftpd.h
+@@ -20,6 +20,7 @@
+ #include <pthread.h>
+ #include <arpa/tftp.h>
+ #include <arpa/inet.h>
++#include <sys/types.h>
+ #include "tftp_io.h"
+ 
+ /*
+-- 
+2.1.4
+
diff --git a/meta-networking/recipes-daemons/atftp/atftp_git.bb b/meta-networking/recipes-daemons/atftp/atftp_git.bb
index b222c34..fc1ca96 100644
--- a/meta-networking/recipes-daemons/atftp/atftp_git.bb
+++ b/meta-networking/recipes-daemons/atftp/atftp_git.bb
@@ -14,7 +14,10 @@ SRC_URI = "git://git.code.sf.net/p/atftp/code \
            file://atftpd.init \
            file://atftpd.service \
            file://atftp-0.7-sorcerers_apprentice.patch \
+           file://atftp-0.7_add_missing_defines.patch \
+           file://atftp-0.7_add_missing_include.patch \
 "
+
 S = "${WORKDIR}/git"
 
 inherit autotools update-rc.d systemd
-- 
1.9.1




More information about the Openembedded-devel mailing list