summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-11-06 23:25:26 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-15 15:19:54 +0000
commit9bf3f80e8862e9028a4f2115fbe2bc42a0b60a4f (patch)
treea4a4a289dc9e440033e0aaf550b46f55d2e9036a /meta
parentcbc59141807551a938e4b680ace0d05b8d826bb6 (diff)
downloadpoky-9bf3f80e8862e9028a4f2115fbe2bc42a0b60a4f.tar.gz
libbsd: Fix build with musl
a.out.h support is not across all architectures only x86/x86_64 support is in linux/a.out.h, this patch abstracts the minimum needed constructs into itself (From OE-Core rev: 757224640bbf4ebf17aea22fa1419c9c3bcd89ce) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch363
-rw-r--r--meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch55
-rw-r--r--meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch130
-rw-r--r--meta/recipes-support/libbsd/libbsd_0.8.3.bb5
4 files changed, 553 insertions, 0 deletions
diff --git a/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch b/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
new file mode 100644
index 0000000000..e97e30e846
--- /dev/null
+++ b/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
@@ -0,0 +1,363 @@
1From 88adbe1a855b7aa95bd925c80ed83c86f3fc42e3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 6 Nov 2016 09:39:31 -0800
4Subject: [PATCH 1/3] Replace __BEGIN_DECLS and __END_DECLS
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 include/bsd/err.h | 10 ++++++++--
11 include/bsd/libutil.h | 10 ++++++++--
12 include/bsd/md5.h | 10 ++++++++--
13 include/bsd/nlist.h | 10 ++++++++--
14 include/bsd/readpassphrase.h | 10 ++++++++--
15 include/bsd/stdio.h | 10 ++++++++--
16 include/bsd/stdlib.h | 10 ++++++++--
17 include/bsd/string.h | 10 ++++++++--
18 include/bsd/stringlist.h | 10 ++++++++--
19 include/bsd/unistd.h | 10 ++++++++--
20 include/bsd/vis.h | 10 ++++++++--
21 include/bsd/wchar.h | 10 ++++++++--
22 src/hash/sha512.h | 10 ++++++++--
23 13 files changed, 104 insertions(+), 26 deletions(-)
24
25diff --git a/include/bsd/err.h b/include/bsd/err.h
26index 12fd051..43dfc32 100644
27--- a/include/bsd/err.h
28+++ b/include/bsd/err.h
29@@ -42,7 +42,10 @@
30
31 #include <stdarg.h>
32
33-__BEGIN_DECLS
34+/* __BEGIN_DECLS */
35+#ifdef __cplusplus
36+extern "C" {
37+#endif
38 void warnc(int code, const char *format, ...)
39 __printflike(2, 3);
40 void vwarnc(int code, const char *format, va_list ap)
41@@ -51,6 +54,9 @@ void errc(int status, int code, const char *format, ...)
42 __printflike(3, 4);
43 void verrc(int status, int code, const char *format, va_list ap)
44 __printflike(3, 0);
45-__END_DECLS
46+#ifdef __cplusplus
47+}
48+#endif
49+/* __END_DECLS */
50
51 #endif
52diff --git a/include/bsd/libutil.h b/include/bsd/libutil.h
53index ebb6160..28b919d 100644
54--- a/include/bsd/libutil.h
55+++ b/include/bsd/libutil.h
56@@ -53,7 +53,10 @@ struct pidfh {
57 ino_t pf_ino;
58 };
59
60-__BEGIN_DECLS
61+/* __BEGIN_DECLS */
62+#ifdef __cplusplus
63+extern "C" {
64+#endif
65 int humanize_number(char *buf, size_t len, int64_t bytes,
66 const char *suffix, int scale, int flags);
67 int expand_number(const char *_buf, uint64_t *_num);
68@@ -66,7 +69,10 @@ int pidfile_close(struct pidfh *pfh);
69 int pidfile_remove(struct pidfh *pfh);
70
71 char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
72-__END_DECLS
73+#ifdef __cplusplus
74+}
75+#endif
76+/* __END_DECLS */
77
78 /* humanize_number(3) */
79 #define HN_DECIMAL 0x01
80diff --git a/include/bsd/md5.h b/include/bsd/md5.h
81index 9a75fad..3531fd6 100644
82--- a/include/bsd/md5.h
83+++ b/include/bsd/md5.h
84@@ -30,7 +30,10 @@ typedef struct MD5Context {
85 #include <sys/cdefs.h>
86 #include <sys/types.h>
87
88-__BEGIN_DECLS
89+/* __BEGIN_DECLS */
90+#ifdef __cplusplus
91+extern "C" {
92+#endif
93 void MD5Init(MD5_CTX *);
94 void MD5Update(MD5_CTX *, const uint8_t *, size_t)
95 __attribute__((__bounded__(__string__,2,3)));
96@@ -49,6 +52,9 @@ char *MD5FileChunk(const char *, char *, off_t, off_t)
97 char *MD5Data(const uint8_t *, size_t, char *)
98 __attribute__((__bounded__(__string__,1,2)))
99 __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
100-__END_DECLS
101+#ifdef __cplusplus
102+}
103+#endif
104+/* __END_DECLS */
105
106 #endif /* _MD5_H_ */
107diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h
108index 2730237..0389ab7 100644
109--- a/include/bsd/nlist.h
110+++ b/include/bsd/nlist.h
111@@ -30,8 +30,14 @@
112 #include <sys/cdefs.h>
113 #include <a.out.h>
114
115-__BEGIN_DECLS
116+/* __BEGIN_DECLS */
117+#ifdef __cplusplus
118+extern "C" {
119+#endif
120 extern int nlist(const char *filename, struct nlist *list);
121-__END_DECLS
122+#ifdef __cplusplus
123+}
124+#endif
125+/* __END_DECLS */
126
127 #endif
128diff --git a/include/bsd/readpassphrase.h b/include/bsd/readpassphrase.h
129index e1dacc3..76e0d33 100644
130--- a/include/bsd/readpassphrase.h
131+++ b/include/bsd/readpassphrase.h
132@@ -34,8 +34,14 @@
133 #include <sys/cdefs.h>
134 #include <sys/types.h>
135
136-__BEGIN_DECLS
137+/* __BEGIN_DECLS */
138+#ifdef __cplusplus
139+extern "C" {
140+#endif
141 char * readpassphrase(const char *, char *, size_t, int);
142-__END_DECLS
143+#ifdef __cplusplus
144+}
145+#endif
146+/* __END_DECLS */
147
148 #endif /* !_READPASSPHRASE_H_ */
149diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h
150index 7697425..b5b3efd 100644
151--- a/include/bsd/stdio.h
152+++ b/include/bsd/stdio.h
153@@ -41,7 +41,10 @@
154 #include <sys/cdefs.h>
155 #include <sys/types.h>
156
157-__BEGIN_DECLS
158+/* __BEGIN_DECLS */
159+#ifdef __cplusplus
160+extern "C" {
161+#endif
162 const char *fmtcheck(const char *, const char *);
163
164 /* XXX: The function requires cooperation from the system libc to store the
165@@ -69,7 +72,10 @@ FILE *funopen(const void *cookie,
166 #define fwopen(cookie, fn) funopen(cookie, NULL, fn, NULL, NULL)
167
168 int fpurge(FILE *fp);
169-__END_DECLS
170+#ifdef __cplusplus
171+}
172+#endif
173+/* __END_DECLS */
174
175 #endif
176 #endif
177diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
178index 0604cad..b9f0515 100644
179--- a/include/bsd/stdlib.h
180+++ b/include/bsd/stdlib.h
181@@ -46,7 +46,10 @@
182 #include <sys/stat.h>
183 #include <stdint.h>
184
185-__BEGIN_DECLS
186+/* __BEGIN_DECLS */
187+#ifdef __cplusplus
188+extern "C" {
189+#endif
190 uint32_t arc4random(void);
191 void arc4random_stir(void);
192 void arc4random_addrandom(u_char *dat, int datlen);
193@@ -73,6 +76,9 @@ long long strtonum(const char *nptr, long long minval, long long maxval,
194 const char **errstr);
195
196 char *getbsize(int *headerlenp, long *blocksizep);
197-__END_DECLS
198+#ifdef __cplusplus
199+}
200+#endif
201+/* __END_DECLS */
202
203 #endif
204diff --git a/include/bsd/string.h b/include/bsd/string.h
205index ee2f953..fbf8c54 100644
206--- a/include/bsd/string.h
207+++ b/include/bsd/string.h
208@@ -36,13 +36,19 @@
209 #include <sys/cdefs.h>
210 #include <sys/types.h>
211
212-__BEGIN_DECLS
213+/* __BEGIN_DECLS */
214+#ifdef __cplusplus
215+extern "C" {
216+#endif
217 size_t strlcpy(char *dst, const char *src, size_t siz);
218 size_t strlcat(char *dst, const char *src, size_t siz);
219 char *strnstr(const char *str, const char *find, size_t str_len);
220 void strmode(mode_t mode, char *str);
221
222 void explicit_bzero(void *buf, size_t len);
223-__END_DECLS
224+#ifdef __cplusplus
225+}
226+#endif
227+/* __END_DECLS */
228
229 #endif
230diff --git a/include/bsd/stringlist.h b/include/bsd/stringlist.h
231index e3c42e9..40d0a52 100644
232--- a/include/bsd/stringlist.h
233+++ b/include/bsd/stringlist.h
234@@ -43,12 +43,18 @@ typedef struct _stringlist {
235 size_t sl_cur;
236 } StringList;
237
238-__BEGIN_DECLS
239+/* __BEGIN_DECLS */
240+#ifdef __cplusplus
241+extern "C" {
242+#endif
243 StringList *sl_init(void);
244 int sl_add(StringList *, char *);
245 void sl_free(StringList *, int);
246 char *sl_find(StringList *, const char *);
247 int sl_delete(StringList *, const char *, int);
248-__END_DECLS
249+#ifdef __cplusplus
250+}
251+#endif
252+/* __END_DECLS */
253
254 #endif /* _STRINGLIST_H */
255diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h
256index 1f9c5f8..5b2f4c7 100644
257--- a/include/bsd/unistd.h
258+++ b/include/bsd/unistd.h
259@@ -45,7 +45,10 @@
260 #define S_ISTXT S_ISVTX
261 #endif
262
263-__BEGIN_DECLS
264+/* __BEGIN_DECLS */
265+#ifdef __cplusplus
266+extern "C" {
267+#endif
268 extern int optreset;
269
270 #ifdef LIBBSD_OVERLAY
271@@ -68,6 +71,9 @@ void setproctitle(const char *fmt, ...)
272 __printflike(1, 2);
273
274 int getpeereid(int s, uid_t *euid, gid_t *egid);
275-__END_DECLS
276+#ifdef __cplusplus
277+}
278+#endif
279+/* __END_DECLS */
280
281 #endif
282diff --git a/include/bsd/vis.h b/include/bsd/vis.h
283index 835d2d6..63c951e 100644
284--- a/include/bsd/vis.h
285+++ b/include/bsd/vis.h
286@@ -74,7 +74,10 @@
287
288 #include <sys/cdefs.h>
289
290-__BEGIN_DECLS
291+/* __BEGIN_DECLS */
292+#ifdef __cplusplus
293+extern "C" {
294+#endif
295 char *vis(char *, int, int, int);
296 int strvis(char *, const char *, int);
297 int strvisx(char *, const char *, size_t, int);
298@@ -83,6 +86,9 @@ int strunvis(char *, const char *);
299 int strunvisx(char *, const char *, int);
300 ssize_t strnunvis(char *, const char *, size_t);
301 int unvis(char *, int, int *, int);
302-__END_DECLS
303+#ifdef __cplusplus
304+}
305+#endif
306+/* __END_DECLS */
307
308 #endif /* !_VIS_H_ */
309diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h
310index 33a500e..aa70742 100644
311--- a/include/bsd/wchar.h
312+++ b/include/bsd/wchar.h
313@@ -43,12 +43,18 @@
314 #include <sys/cdefs.h>
315 #include <sys/types.h>
316
317-__BEGIN_DECLS
318+/* __BEGIN_DECLS */
319+#ifdef __cplusplus
320+extern "C" {
321+#endif
322 wchar_t *fgetwln(FILE *stream, size_t *len);
323
324 size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
325 size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
326-__END_DECLS
327+#ifdef __cplusplus
328+}
329+#endif
330+/* __END_DECLS */
331
332 #endif
333 #endif
334diff --git a/src/hash/sha512.h b/src/hash/sha512.h
335index 4f368a1..27ddc24 100644
336--- a/src/hash/sha512.h
337+++ b/src/hash/sha512.h
338@@ -39,7 +39,10 @@ typedef struct SHA512Context {
339 unsigned char buf[128];
340 } SHA512_CTX;
341
342-__BEGIN_DECLS
343+/* __BEGIN_DECLS */
344+#ifdef __cplusplus
345+extern "C" {
346+#endif
347
348 void SHA512_Init(SHA512_CTX *);
349 void SHA512_Update(SHA512_CTX *, const void *, size_t);
350@@ -48,6 +51,9 @@ char *SHA512_End(SHA512_CTX *, char *);
351 char *SHA512_File(const char *, char *);
352 char *SHA512_FileChunk(const char *, char *, off_t, off_t);
353 char *SHA512_Data(const void *, unsigned int, char *);
354-__END_DECLS
355+#ifdef __cplusplus
356+}
357+#endif
358+/* __END_DECLS */
359
360 #endif /* !_SHA512_H_ */
361--
3622.10.2
363
diff --git a/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch b/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch
new file mode 100644
index 0000000000..83ce7c8dd0
--- /dev/null
+++ b/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch
@@ -0,0 +1,55 @@
1From 28fc66e8b848709a2e69dba7f07694248e0154e8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 6 Nov 2016 09:40:43 -0800
4Subject: [PATCH 2/3] Remove funopen()
5
6Musl doesnt have prerequisites for it.
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Inappropriate [musl specific]
11
12 man/Makefile.am | 1 -
13 src/Makefile.am | 1 -
14 test/Makefile.am | 1 -
15 3 files changed, 3 deletions(-)
16
17diff --git a/man/Makefile.am b/man/Makefile.am
18index e4d6e4a..c701d94 100644
19--- a/man/Makefile.am
20+++ b/man/Makefile.am
21@@ -29,7 +29,6 @@ dist_man_MANS = \
22 flopen.3 \
23 fmtcheck.3 \
24 fparseln.3 \
25- funopen.3bsd \
26 getbsize.3 \
27 getmode.3 \
28 getpeereid.3 \
29diff --git a/src/Makefile.am b/src/Makefile.am
30index ad83dbf..13225a3 100644
31--- a/src/Makefile.am
32+++ b/src/Makefile.am
33@@ -76,7 +76,6 @@ libbsd_la_SOURCES = \
34 fmtcheck.c \
35 fparseln.c \
36 fpurge.c \
37- funopen.c \
38 getbsize.c \
39 getpeereid.c \
40 hash/md5.c \
41diff --git a/test/Makefile.am b/test/Makefile.am
42index a75c8ff..e3a1d41 100644
43--- a/test/Makefile.am
44+++ b/test/Makefile.am
45@@ -36,7 +36,6 @@ check_PROGRAMS = \
46 endian \
47 humanize \
48 fgetln \
49- funopen \
50 fparseln \
51 fpurge \
52 md5 \
53--
542.10.2
55
diff --git a/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch b/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch
new file mode 100644
index 0000000000..176d940fc4
--- /dev/null
+++ b/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch
@@ -0,0 +1,130 @@
1From a1b93c25311834f2f411e9bfe2e616899ba2122d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 6 Nov 2016 10:23:55 -0800
4Subject: [PATCH 3/3] Fix build breaks due to missing a.out.h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 include/bsd/nlist.h | 1 -
11 include/bsd/nlist.h => src/local-aout.h | 47 ++++++++++++++++++++++-----------
12 src/nlist.c | 9 +++++++
13 3 files changed, 41 insertions(+), 16 deletions(-)
14 copy include/bsd/nlist.h => src/local-aout.h (63%)
15
16diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h
17index 0389ab7..9c7e3d8 100644
18--- a/include/bsd/nlist.h
19+++ b/include/bsd/nlist.h
20@@ -28,7 +28,6 @@
21 #define LIBBSD_NLIST_H
22
23 #include <sys/cdefs.h>
24-#include <a.out.h>
25
26 /* __BEGIN_DECLS */
27 #ifdef __cplusplus
28diff --git a/include/bsd/nlist.h b/src/local-aout.h
29similarity index 63%
30copy from include/bsd/nlist.h
31copy to src/local-aout.h
32index 0389ab7..2adb93e 100644
33--- a/include/bsd/nlist.h
34+++ b/src/local-aout.h
35@@ -1,5 +1,5 @@
36 /*
37- * Copyright © 2009 Guillem Jover <guillem@hadrons.org>
38+ * Copyright © 2016 Khem Raj <raj.khem@gmail.com>
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42@@ -24,20 +24,37 @@
43 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 */
45
46-#ifndef LIBBSD_NLIST_H
47-#define LIBBSD_NLIST_H
48+#ifndef LIBBSD_LOCAL_AOUT_H
49+#define LIBBSD_LOCAL_AOUT_H
50
51-#include <sys/cdefs.h>
52-#include <a.out.h>
53+#define N_UNDF 0
54+#define N_ABS 2
55+#define N_TEXT 4
56+#define N_DATA 6
57+#define N_BSS 8
58+#define N_FN 15
59+#define N_EXT 1
60+#define N_TYPE 036
61+#define N_STAB 0340
62+#define N_INDR 0xa
63+#define N_SETA 0x14 /* Absolute set element symbol. */
64+#define N_SETT 0x16 /* Text set element symbol. */
65+#define N_SETD 0x18 /* Data set element symbol. */
66+#define N_SETB 0x1A /* Bss set element symbol. */
67+#define N_SETV 0x1C /* Pointer to set vector in data area. */
68
69-/* __BEGIN_DECLS */
70-#ifdef __cplusplus
71-extern "C" {
72-#endif
73-extern int nlist(const char *filename, struct nlist *list);
74-#ifdef __cplusplus
75-}
76-#endif
77-/* __END_DECLS */
78+struct nlist
79+{
80+ union
81+ {
82+ char *n_name;
83+ struct nlist *n_next;
84+ long n_strx;
85+ } n_un;
86+ unsigned char n_type;
87+ char n_other;
88+ short n_desc;
89+ unsigned long n_value;
90+};
91
92-#endif
93+#endif /* LIBBSD_LOCAL_AOUT_H */
94diff --git a/src/nlist.c b/src/nlist.c
95index 0cffe55..625d310 100644
96--- a/src/nlist.c
97+++ b/src/nlist.c
98@@ -40,7 +40,11 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
99
100 #include <errno.h>
101 #include <fcntl.h>
102+#ifdef __GLIBC__
103 #include <a.out.h>
104+#else
105+#define __NO_A_OUT_SUPPORT
106+#endif
107 #include <stdio.h>
108 #include <string.h>
109 #include <unistd.h>
110@@ -48,12 +52,17 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
111 #if !defined(__NO_A_OUT_SUPPORT)
112 #define _NLIST_DO_AOUT
113 #endif
114+
115 #define _NLIST_DO_ELF
116
117 #ifdef _NLIST_DO_ELF
118 #include "local-elf.h"
119 #endif
120
121+#ifdef _NLIST_DO_ELF
122+#include "local-aout.h"
123+#endif
124+
125 #define SIZE_T_MAX 0xffffffffU
126
127 #ifdef _NLIST_DO_AOUT
128--
1292.10.2
130
diff --git a/meta/recipes-support/libbsd/libbsd_0.8.3.bb b/meta/recipes-support/libbsd/libbsd_0.8.3.bb
index 6f734ab453..fadd7886a2 100644
--- a/meta/recipes-support/libbsd/libbsd_0.8.3.bb
+++ b/meta/recipes-support/libbsd/libbsd_0.8.3.bb
@@ -36,6 +36,11 @@ SECTION = "libs"
36SRC_URI = " \ 36SRC_URI = " \
37 http://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz \ 37 http://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
38" 38"
39SRC_URI_append_libc-musl = " \
40 file://0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch \
41 file://0002-Remove-funopen.patch \
42 file://0003-Fix-build-breaks-due-to-missing-a.out.h.patch \
43"
39 44
40SRC_URI[md5sum] = "e935c1bb6cc98a4a43cb1da22795493a" 45SRC_URI[md5sum] = "e935c1bb6cc98a4a43cb1da22795493a"
41SRC_URI[sha256sum] = "934b634f4dfd865b6482650b8f522c70ae65c463529de8be907b53c89c3a34a8" 46SRC_URI[sha256sum] = "934b634f4dfd865b6482650b8f522c70ae65c463529de8be907b53c89c3a34a8"