All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/53] powertop: Include right headers for timval struct
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 02/53] dhcp: Include sys/types.h for u_int* defs Khem Raj
                   ` (54 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0001-include-rquired-headers-for-typedefs.patch | 47 ++++++++++++++++++++++
 meta/recipes-kernel/powertop/powertop_2.8.bb       |  4 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch

diff --git a/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch b/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
new file mode 100644
index 0000000..0fd6310
--- /dev/null
+++ b/meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
@@ -0,0 +1,47 @@
+From 0856d8145d187a7e5a49625247abe43a13f95acc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 Sep 2015 19:36:28 +0000
+Subject: [PATCH] include rquired headers for typedefs
+
+timeval struct needs to include sys/time.h and sprintf() usage requires
+to include stdio.h headers from system
+
+Fixes
+src/perf/perf_bundle.cpp:141:2: error: use of undeclared identifier 'sprintf'; did you mean 'vswprintf'?
+src/devices/devfreq.h:35:18: error: field has incomplete type 'struct timeval'
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/devices/devfreq.h    | 1 +
+ src/perf/perf_bundle.cpp | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/devices/devfreq.h b/src/devices/devfreq.h
+index 16a60fb..4bede7c 100644
+--- a/src/devices/devfreq.h
++++ b/src/devices/devfreq.h
+@@ -25,6 +25,7 @@
+ #ifndef _INCLUDE_GUARD_DEVFREQ_H
+ #define _INCLUDE_GUARD_DEVFREQ_H
+ 
++#include <sys/time.h>
+ #include "device.h"
+ #include "../parameters/parameters.h"
+ 
+diff --git a/src/perf/perf_bundle.cpp b/src/perf/perf_bundle.cpp
+index cf1ae11..232f894 100644
+--- a/src/perf/perf_bundle.cpp
++++ b/src/perf/perf_bundle.cpp
+@@ -27,6 +27,7 @@
+ #include <algorithm>
+ #include <string.h>
+ #include <stdint.h>
++#include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-- 
+2.5.2
+
diff --git a/meta/recipes-kernel/powertop/powertop_2.8.bb b/meta/recipes-kernel/powertop/powertop_2.8.bb
index a466067..1f2dfb8 100644
--- a/meta/recipes-kernel/powertop/powertop_2.8.bb
+++ b/meta/recipes-kernel/powertop/powertop_2.8.bb
@@ -6,7 +6,9 @@ DEPENDS = "ncurses libnl pciutils"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e"
 
-SRC_URI = "http://01.org/sites/default/files/downloads/powertop/powertop-${PV}.tar.gz"
+SRC_URI = "http://01.org/sites/default/files/downloads/powertop/powertop-${PV}.tar.gz \
+           file://0001-include-rquired-headers-for-typedefs.patch \
+"
 
 SRC_URI[md5sum] = "c55fedb69203e480801b18bd7b886241"
 SRC_URI[sha256sum] = "a87b563f73106babfa3e74dcf92f252938c061e309ace20a361358bbfa579c5a"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 02/53] dhcp: Include sys/types.h for u_int* defs
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
  2016-01-08 10:18 ` [PATCH 01/53] powertop: Include right headers for timval struct Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 03/53] blktrace: Include <sys/types.h for dev_t Khem Raj
                   ` (53 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../dhcp/0001-include-missing-sys-types.h.patch    | 58 ++++++++++++++++++++++
 meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb       |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 meta/recipes-connectivity/dhcp/dhcp/0001-include-missing-sys-types.h.patch

diff --git a/meta/recipes-connectivity/dhcp/dhcp/0001-include-missing-sys-types.h.patch b/meta/recipes-connectivity/dhcp/dhcp/0001-include-missing-sys-types.h.patch
new file mode 100644
index 0000000..64f2bdd
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/dhcp/0001-include-missing-sys-types.h.patch
@@ -0,0 +1,58 @@
+From 971491b6d7ab47d2f92f34269a129d0347fba15a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 14 Sep 2015 23:51:38 +0000
+Subject: [PATCH] include missing sys/types.h
+
+Code uses plain typedefs defines in this header but does not include it
+Fixes
+
+error: unknown type name 'u_int16_t'; did you mean 'uint16_t'?
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ dst/dst_api.c     | 1 +
+ dst/dst_support.c | 1 +
+ dst/hmac_link.c   | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/dst/dst_api.c b/dst/dst_api.c
+index a77abd2..7885538 100644
+--- a/dst/dst_api.c
++++ b/dst/dst_api.c
+@@ -49,6 +49,7 @@
+ #include <sys/param.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
++#include <sys/types.h>
+ #include <netinet/in.h>
+ 
+ #include "cdefs.h"
+diff --git a/dst/dst_support.c b/dst/dst_support.c
+index 8e08a0c..f353ec6 100644
+--- a/dst/dst_support.c
++++ b/dst/dst_support.c
+@@ -25,6 +25,7 @@
+ #include <sys/stat.h>
+ #include <netinet/in.h>
+ #include <sys/socket.h>
++#include <sys/types.h>
+ 
+ #include "cdefs.h"
+ #include "osdep.h"
+diff --git a/dst/hmac_link.c b/dst/hmac_link.c
+index b812c1c..a7de622 100644
+--- a/dst/hmac_link.c
++++ b/dst/hmac_link.c
+@@ -31,6 +31,7 @@
+ #include <sys/time.h>
+ #include <netinet/in.h>
+ #include <sys/socket.h>
++#include <sys/types.h>
+ 
+ #include "cdefs.h"
+ #include "osdep.h"
+-- 
+2.5.2
+
diff --git a/meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb b/meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb
index b4a05fc..436a32e 100644
--- a/meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb
+++ b/meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb
@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \
             file://fixsepbuild.patch \
             file://dhclient-script-drop-resolv.conf.dhclient.patch \
             file://replace-ifconfig-route.patch \
+            file://0001-include-missing-sys-types.h.patch \
            "
 
 SRC_URI[md5sum] = "5a284875dd2c12ddd388416d69156a67"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 03/53] blktrace: Include <sys/types.h for dev_t
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
  2016-01-08 10:18 ` [PATCH 01/53] powertop: Include right headers for timval struct Khem Raj
  2016-01-08 10:18 ` [PATCH 02/53] dhcp: Include sys/types.h for u_int* defs Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 04/53] ppp: Fix build with musl Khem Raj
                   ` (52 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-include-sys-types.h-for-dev_t-definition.patch | 30 ++++++++++++++++++++++
 meta/recipes-kernel/blktrace/blktrace_git.bb       |  4 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch

diff --git a/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch b/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
new file mode 100644
index 0000000..a4b7157
--- /dev/null
+++ b/meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
@@ -0,0 +1,30 @@
+From 6b5bbdfaac7f216fe8a02c4cf29e5eb2aee5a409 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 Sep 2015 00:01:00 +0000
+Subject: [PATCH] include sys/types.h for dev_t definition
+
+Avoids the build failures when sys/types.h does not get included
+indirectly through other headers.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ blktrace.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/blktrace.h b/blktrace.h
+index 380aec7..944fc08 100644
+--- a/blktrace.h
++++ b/blktrace.h
+@@ -5,6 +5,7 @@
+ #include <limits.h>
+ #include <byteswap.h>
+ #include <endian.h>
++#include <sys/types.h>
+ 
+ #include "blktrace_api.h"
+ #include "rbtree.h"
+-- 
+2.5.2
+
diff --git a/meta/recipes-kernel/blktrace/blktrace_git.bb b/meta/recipes-kernel/blktrace/blktrace_git.bb
index 5b0be42..957cb70 100644
--- a/meta/recipes-kernel/blktrace/blktrace_git.bb
+++ b/meta/recipes-kernel/blktrace/blktrace_git.bb
@@ -9,7 +9,9 @@ SRCREV = "43fc870ce04e963def45dfc0d1ed4ea21ef10d4b"
 PV = "1.1.0+git${SRCPV}"
 
 SRC_URI = "git://git.kernel.dk/blktrace.git \
-           file://ldflags.patch"
+           file://ldflags.patch \
+           file://0001-include-sys-types.h-for-dev_t-definition.patch \
+"
 
 S = "${WORKDIR}/git"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 04/53] ppp: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (2 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 03/53] blktrace: Include <sys/types.h for dev_t Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 05/53] tcp-wrappers: " Khem Raj
                   ` (51 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Therer are assumptions about glibc headers and features which needs to
be addressed for musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../ppp/ppp/0001-Fix-build-with-musl.patch         | 163 +++++++++++++++++++++
 meta/recipes-connectivity/ppp/ppp_2.4.7.bb         |   3 +
 2 files changed, 166 insertions(+)
 create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch

diff --git a/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch b/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..763e374
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
@@ -0,0 +1,163 @@
+From 52a1e41d7541b2c936285844c59bd1be21797860 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 May 2015 14:57:05 -0700
+Subject: [PATCH] Fix build with musl
+
+There are several assumption about glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ include/net/ppp_defs.h                  | 2 ++
+ pppd/Makefile.linux                     | 2 +-
+ pppd/magic.h                            | 6 +++---
+ pppd/plugins/rp-pppoe/config.h          | 5 ++++-
+ pppd/plugins/rp-pppoe/plugin.c          | 1 -
+ pppd/plugins/rp-pppoe/pppoe-discovery.c | 8 ++++----
+ pppd/plugins/rp-pppoe/pppoe.h           | 2 +-
+ pppd/sys-linux.c                        | 3 ++-
+ 8 files changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h
+index b06eda5..dafa36c 100644
+--- a/include/net/ppp_defs.h
++++ b/include/net/ppp_defs.h
+@@ -38,6 +38,8 @@
+ #ifndef _PPP_DEFS_H_
+ #define _PPP_DEFS_H_
+ 
++#include <sys/time.h>
++
+ /*
+  * The basic PPP frame.
+  */
+diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
+index 8ab2102..d7e2564 100644
+--- a/pppd/Makefile.linux
++++ b/pppd/Makefile.linux
+@@ -126,7 +126,7 @@ LIBS	+= -lcrypt
+ #endif
+ 
+ ifdef USE_LIBUTIL
+-CFLAGS	+= -DHAVE_LOGWTMP=1
++#CFLAGS	+= -DHAVE_LOGWTMP=1
+ LIBS	+= -lutil
+ endif
+ 
+diff --git a/pppd/magic.h b/pppd/magic.h
+index c81213b..9d399e3 100644
+--- a/pppd/magic.h
++++ b/pppd/magic.h
+@@ -42,8 +42,8 @@
+  * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
+  */
+ 
+-void magic_init __P((void));	/* Initialize the magic number generator */
+-u_int32_t magic __P((void));	/* Returns the next magic number */
++void magic_init (void);	/* Initialize the magic number generator */
++u_int32_t magic (void);	/* Returns the next magic number */
+ 
+ /* Fill buffer with random bytes */
+-void random_bytes __P((unsigned char *buf, int len));
++void random_bytes (unsigned char *buf, int len);
+diff --git a/pppd/plugins/rp-pppoe/config.h b/pppd/plugins/rp-pppoe/config.h
+index 5703087..fff032e 100644
+--- a/pppd/plugins/rp-pppoe/config.h
++++ b/pppd/plugins/rp-pppoe/config.h
+@@ -78,8 +78,9 @@
+ #define HAVE_NET_IF_ARP_H 1
+ 
+ /* Define if you have the <net/ethernet.h> header file.  */
++#ifdef __GLIBC__
+ #define HAVE_NET_ETHERNET_H 1
+-
++#endif
+ /* Define if you have the <net/if.h> header file.  */
+ #define HAVE_NET_IF_H 1
+ 
+@@ -102,7 +103,9 @@
+ #define HAVE_NETPACKET_PACKET_H 1
+ 
+ /* Define if you have the <sys/cdefs.h> header file.  */
++#ifdef __GLIBC__
+ #define HAVE_SYS_CDEFS_H 1
++#endif
+ 
+ /* Define if you have the <sys/dlpi.h> header file.  */
+ /* #undef HAVE_SYS_DLPI_H */
+diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c
+index a8c2bb4..ca34d79 100644
+--- a/pppd/plugins/rp-pppoe/plugin.c
++++ b/pppd/plugins/rp-pppoe/plugin.c
+@@ -46,7 +46,6 @@ static char const RCSID[] =
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#include <net/ethernet.h>
+ #include <net/if_arp.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_pppox.h>
+diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+index 3d3bf4e..d42f619 100644
+--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
++++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+@@ -27,10 +27,6 @@
+ #include <linux/if_packet.h>
+ #endif
+ 
+-#ifdef HAVE_NET_ETHERNET_H
+-#include <net/ethernet.h>
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include <asm/types.h>
+ #endif
+@@ -47,6 +43,10 @@
+ #include <net/if_arp.h>
+ #endif
+ 
++#ifndef __GLIBC__
++#define error(x...) fprintf(stderr, x)
++#endif
++
+ char *xstrdup(const char *s);
+ void usage(void);
+ 
+diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h
+index 9ab2eee..75b9004 100644
+--- a/pppd/plugins/rp-pppoe/pppoe.h
++++ b/pppd/plugins/rp-pppoe/pppoe.h
+@@ -92,7 +92,7 @@ typedef unsigned long UINT32_t;
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+-#ifndef HAVE_SYS_DLPI_H
++#if !defined HAVE_SYS_DLPI_H && defined HAVE_NET_ETHERNET_H
+ #include <netinet/if_ether.h>
+ #endif
+ #endif
+diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
+index a105505..49b0273 100644
+--- a/pppd/sys-linux.c
++++ b/pppd/sys-linux.c
+@@ -112,7 +112,7 @@
+ #include <linux/types.h>
+ #include <linux/if.h>
+ #include <linux/if_arp.h>
+-#include <linux/route.h>
++/* #include <linux/route.h> */
+ #include <linux/if_ether.h>
+ #endif
+ #include <netinet/in.h>
+@@ -145,6 +145,7 @@
+ #endif
+ 
+ #ifdef INET6
++#include <net/route.h>
+ #ifndef _LINUX_IN6_H
+ /*
+  *    This is in linux/include/net/ipv6.h.
+-- 
+2.1.4
+
diff --git a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
index 5f06034..4437b5c 100644
--- a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
+++ b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
@@ -32,6 +32,9 @@ SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \
            file://fix-CVE-2015-3310.patch \
 "
 
+SRC_URI_append_libc-musl = "\
+           file://0001-Fix-build-with-musl.patch \
+"
 SRC_URI[md5sum] = "78818f40e6d33a1d1de68a1551f6595a"
 SRC_URI[sha256sum] = "02e0a3dd3e4799e33103f70ec7df75348c8540966ee7c948e4ed8a42bbccfb30"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 05/53] tcp-wrappers: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (3 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 04/53] ppp: Fix build with musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 06/53] fts: Add recipe Khem Raj
                   ` (50 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch | 31 ++++++++++++++++++++++
 .../tcp-wrappers/tcp-wrappers_7.6.bb               |  4 +++
 2 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch

diff --git a/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
new file mode 100644
index 0000000..eee640e
--- /dev/null
+++ b/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
@@ -0,0 +1,31 @@
+__BEGIN_DECLS/__END_DECLS are BSD specific and not defined in musl
+glibc and uclibc had sys/cdefs.h doing it.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: tcp_wrappers_7.6/tcpd.h
+===================================================================
+--- tcp_wrappers_7.6.orig/tcpd.h
++++ tcp_wrappers_7.6/tcpd.h
+@@ -11,7 +11,9 @@
+ #include <netinet/in.h>
+ #include <stdio.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Structure to describe one communications endpoint. */
+ 
+@@ -252,6 +254,8 @@ extern char *fix_strtok();
+ extern char *my_strtok();
+ #endif
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif
diff --git a/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb b/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
index 2630478..5fdbbce 100644
--- a/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
+++ b/meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb
@@ -43,6 +43,7 @@ SRC_URI = "ftp://ftp.porcupine.org/pub/security/tcp_wrappers_${PV}.tar.gz \
            file://try-from.8 \
            file://safe_finger.8 \
            file://makefile-fix-parallel.patch \
+           file://musl-decls.patch \
            "
 
 SRC_URI[md5sum] = "e6fa25f71226d090f34de3f6b122fb5a"
@@ -73,6 +74,9 @@ EXTRA_OEMAKE = "'CC=${CC}' \
 
 EXTRA_OEMAKE_NETGROUP = "-DNETGROUP -DUSE_GETDOMAIN"
 EXTRA_OEMAKE_NETGROUP_libc-uclibc = "-DUSE_GETDOMAIN"
+EXTRA_OEMAKE_NETGROUP_libc-musl = "-DUSE_GETDOMAIN"
+
+EXTRA_OEMAKE_append_libc-musl = " 'LIBS='"
 
 do_compile () {
 	oe_runmake 'TABLES=-DHOSTS_DENY=\"${sysconfdir}/hosts.deny\" -DHOSTS_ALLOW=\"${sysconfdir}/hosts.allow\"' \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 06/53] fts: Add recipe
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (4 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 05/53] tcp-wrappers: " Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 07/53] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
                   ` (49 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

fts is not implemented in musl but many packages depend on it
glibc implements it even though posix does not requir it to do so.
So provide an alternative provider for fts

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/fts/fts.bb                       |   39 +
 .../fts/fts/fts-header-correctness.patch           |   25 +
 meta/recipes-core/fts/fts/fts-uclibc.patch         |   50 +
 meta/recipes-core/fts/fts/gcc5.patch               | 1368 ++++++++++++++++++++
 meta/recipes-core/fts/fts/remove_cdefs.patch       |   69 +
 meta/recipes-core/fts/fts/stdint.patch             |   15 +
 6 files changed, 1566 insertions(+)
 create mode 100644 meta/recipes-core/fts/fts.bb
 create mode 100644 meta/recipes-core/fts/fts/fts-header-correctness.patch
 create mode 100644 meta/recipes-core/fts/fts/fts-uclibc.patch
 create mode 100644 meta/recipes-core/fts/fts/gcc5.patch
 create mode 100644 meta/recipes-core/fts/fts/remove_cdefs.patch
 create mode 100644 meta/recipes-core/fts/fts/stdint.patch

diff --git a/meta/recipes-core/fts/fts.bb b/meta/recipes-core/fts/fts.bb
new file mode 100644
index 0000000..d8b4ed2
--- /dev/null
+++ b/meta/recipes-core/fts/fts.bb
@@ -0,0 +1,39 @@
+# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "keith bostic's POSIX file tree stream operations library"
+HOMEPAGE = "https://sites.google.com/a/bostic.com/keithbostic"
+LICENSE = "BSD-4-Clause"
+LIC_FILES_CHECKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-4-Clause;md5=624d9e67e8ac41a78f6b6c2c55a83a2b"
+SECTION = "libs"
+
+SRC_URI = "https://sites.google.com/a/bostic.com/keithbostic/files/fts.tar.gz \
+           file://fts-header-correctness.patch \
+           file://fts-uclibc.patch \
+           file://remove_cdefs.patch \
+           file://stdint.patch \
+           file://gcc5.patch \
+"
+
+SRC_URI[md5sum] = "120c14715485ec6ced14f494d059d20a"
+SRC_URI[sha256sum] = "3df9b9b5a45aeaf16f33bb84e692a10dc662e22ec8a51748f98767d67fb6f342"
+
+S = "${WORKDIR}/${BPN}"
+
+do_configure[noexec] = "1"
+
+VER = "0"
+do_compile () {
+    ${CC} -I${S} -fPIC -shared -o libfts.so.${VER} -Wl,-soname,libfts.so.${VER} ${S}/fts.c
+}
+
+do_install() {
+    install -Dm755 ${B}/libfts.so.${VER} ${D}${libdir}/libfts.so.${VER}
+    ln -sf libfts.so.${VER} ${D}${libdir}/libfts.so
+    install -Dm644 ${S}/fts.h ${D}${includedir}/fts.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+
diff --git a/meta/recipes-core/fts/fts/fts-header-correctness.patch b/meta/recipes-core/fts/fts/fts-header-correctness.patch
new file mode 100644
index 0000000..c73ddc9
--- /dev/null
+++ b/meta/recipes-core/fts/fts/fts-header-correctness.patch
@@ -0,0 +1,25 @@
+Included needed headers for compiling with musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- fts.orig/fts.h
++++ fts/fts.h
+@@ -38,6 +38,17 @@
+ #ifndef	_FTS_H_
+ #define	_FTS_H_
+ 
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/stat.h>
++
++#include <dirent.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++
+ typedef struct {
+ 	struct _ftsent *fts_cur;	/* current node */
+ 	struct _ftsent *fts_child;	/* linked list of children */
diff --git a/meta/recipes-core/fts/fts/fts-uclibc.patch b/meta/recipes-core/fts/fts/fts-uclibc.patch
new file mode 100644
index 0000000..397654b
--- /dev/null
+++ b/meta/recipes-core/fts/fts/fts-uclibc.patch
@@ -0,0 +1,50 @@
+Add missing defines for uclibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -31,6 +31,10 @@
+  * SUCH DAMAGE.
+  */
+ 
++#define	alignof(TYPE)   ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2)
++#define	ALIGNBYTES	(alignof(long double) - 1)
++#define	ALIGN(p)	(((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES) 
++
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static char sccsid[] = "@(#)fts.c	8.6 (Berkeley) 8/14/94";
+ #endif /* LIBC_SCCS and not lint */
+@@ -652,10 +656,10 @@
+ 		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+ 			continue;
+ 
+-		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_namlen)) == NULL)
++		if ((p = fts_alloc(sp, dp->d_name, (int)dp->d_reclen)) == NULL)
+ 			goto mem1;
+-		if (dp->d_namlen > maxlen) {
+-			if (fts_palloc(sp, (size_t)dp->d_namlen)) {
++		if (dp->d_reclen > maxlen) {
++			if (fts_palloc(sp, (size_t)dp->d_reclen)) {
+ 				/*
+ 				 * No more memory for path or structures.  Save
+ 				 * errno, free up the current structure and the
+@@ -675,7 +679,7 @@
+ 			maxlen = sp->fts_pathlen - sp->fts_cur->fts_pathlen - 1;
+ 		}
+ 
+-		p->fts_pathlen = len + dp->d_namlen + 1;
++		p->fts_pathlen = len + dp->d_reclen + 1;
+ 		p->fts_parent = sp->fts_cur;
+ 		p->fts_level = level;
+ 
+@@ -784,7 +788,7 @@
+ 	/* If user needs stat info, stat buffer already allocated. */
+ 	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
+ 
+-#ifdef DT_WHT
++#ifdef S_IFWHT
+ 	/*
+ 	 * Whited-out files don't really exist.  However, there's stat(2) file
+ 	 * mask for them, so we set it so that programs (i.e., find) don't have
diff --git a/meta/recipes-core/fts/fts/gcc5.patch b/meta/recipes-core/fts/fts/gcc5.patch
new file mode 100644
index 0000000..f5b948e
--- /dev/null
+++ b/meta/recipes-core/fts/fts/gcc5.patch
@@ -0,0 +1,1368 @@
+Forward port the sources to be able to compile with c99/gcc5
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+Index: fts/fts.c
+===================================================================
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -51,16 +51,6 @@ static char sccsid[] = "@(#)fts.c	8.6 (B
+ #include <string.h>
+ #include <unistd.h>
+ 
+-static FTSENT	*fts_alloc __P(FTS *, char *, int);
+-static FTSENT	*fts_build __P(FTS *, int);
+-static void	 fts_lfree __P(FTSENT *);
+-static void	 fts_load __P(FTS *, FTSENT *);
+-static size_t	 fts_maxarglen __P(char * const *);
+-static void	 fts_padjust __P(FTS *, void *);
+-static int	 fts_palloc __P(FTS *, size_t);
+-static FTSENT	*fts_sort __P(FTS *, FTSENT *, int);
+-static u_short	 fts_stat __P(FTS *, struct dirent *, FTSENT *, int);
+-
+ #define	ISDOT(a)	(a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
+ 
+ #define	ISSET(opt)	(sp->fts_options & opt)
+@@ -73,119 +63,16 @@ static u_short	 fts_stat __P(FTS *, stru
+ #define	BCHILD		1		/* fts_children */
+ #define	BNAMES		2		/* fts_children, names only */
+ #define	BREAD		3		/* fts_read */
+-
+-FTS *
+-fts_open(argv, options, compar)
+-	char * const *argv;
+-	register int options;
+-	int (*compar)();
+-{
+-	register FTS *sp;
+-	register FTSENT *p, *root;
+-	register int nitems;
+-	FTSENT *parent, *tmp;
+-	int len;
+-
+-	/* Options check. */
+-	if (options & ~FTS_OPTIONMASK) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Allocate/initialize the stream */
+-	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
+-		return (NULL);
+-	memset(sp, 0, sizeof(FTS));
+-	sp->fts_compar = compar;
+-	sp->fts_options = options;
+-
+-	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+-	if (ISSET(FTS_LOGICAL))
+-		SET(FTS_NOCHDIR);
+-
+-	/*
+-	 * Start out with 1K of path space, and enough, in any case,
+-	 * to hold the user's paths.
+-	 */
+-	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
+-		goto mem1;
+-
+-	/* Allocate/initialize root's parent. */
+-	if ((parent = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem2;
+-	parent->fts_level = FTS_ROOTPARENTLEVEL;
+-
+-	/* Allocate/initialize root(s). */
+-	for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
+-		/* Don't allow zero-length paths. */
+-		if ((len = strlen(*argv)) == 0) {
+-			errno = EINVAL;
+-			goto mem3;
+-		}
+-
+-		p = fts_alloc(sp, *argv, len);
+-		p->fts_level = FTS_ROOTLEVEL;
+-		p->fts_parent = parent;
+-		p->fts_accpath = p->fts_name;
+-		p->fts_info = fts_stat(sp, NULL, p, ISSET(FTS_COMFOLLOW));
+-
+-		/* Command-line "." and ".." are real directories. */
+-		if (p->fts_info == FTS_DOT)
+-			p->fts_info = FTS_D;
+-
+-		/*
+-		 * If comparison routine supplied, traverse in sorted
+-		 * order; otherwise traverse in the order specified.
+-		 */
+-		if (compar) {
+-			p->fts_link = root;
+-			root = p;
+-		} else {
+-			p->fts_link = NULL;
+-			if (root == NULL)
+-				tmp = root = p;
+-			else {
+-				tmp->fts_link = p;
+-				tmp = p;
+-			}
+-		}
+-	}
+-	if (compar && nitems > 1)
+-		root = fts_sort(sp, root, nitems);
+-
+-	/*
+-	 * Allocate a dummy pointer and make fts_read think that we've just
+-	 * finished the node before the root(s); set p->fts_info to FTS_INIT
+-	 * so that everything about the "current" node is ignored.
+-	 */
+-	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem3;
+-	sp->fts_cur->fts_link = root;
+-	sp->fts_cur->fts_info = FTS_INIT;
+-
+-	/*
+-	 * If using chdir(2), grab a file descriptor pointing to dot to insure
+-	 * that we can get back here; this could be avoided for some paths,
+-	 * but almost certainly not worth the effort.  Slashes, symbolic links,
+-	 * and ".." are all fairly nasty problems.  Note, if we can't get the
+-	 * descriptor we run anyway, just more slowly.
+-	 */
+-	if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+-		SET(FTS_NOCHDIR);
+-
+-	return (sp);
+-
+-mem3:	fts_lfree(root);
+-	free(parent);
+-mem2:	free(sp->fts_path);
+-mem1:	free(sp);
+-	return (NULL);
+-}
++/*
++ * Special case a root of "/" so that slashes aren't appended which would
++ * cause paths to be written as "//foo".
++ */
++#define	NAPPEND(p)							\
++	(p->fts_level == FTS_ROOTLEVEL && p->fts_pathlen == 1 &&	\
++	    p->fts_path[0] == '/' ? 0 : p->fts_pathlen)
+ 
+ static void
+-fts_load(sp, p)
+-	FTS *sp;
+-	register FTSENT *p;
++fts_load(FTS *sp, register FTSENT *p)
+ {
+ 	register int len;
+ 	register char *cp;
+@@ -208,332 +95,214 @@ fts_load(sp, p)
+ 	sp->fts_dev = p->fts_dev;
+ }
+ 
+-int
+-fts_close(sp)
+-	FTS *sp;
++static void
++fts_lfree(register FTSENT *head)
+ {
+-	register FTSENT *freep, *p;
+-	int saved_errno;
++	register FTSENT *p;
+ 
+-	/*
+-	 * This still works if we haven't read anything -- the dummy structure
+-	 * points to the root list, so we step through to the end of the root
+-	 * list which has a valid parent pointer.
+-	 */
+-	if (sp->fts_cur) {
+-		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-			freep = p;
+-			p = p->fts_link ? p->fts_link : p->fts_parent;
+-			free(freep);
+-		}
++	/* Free a linked list of structures. */
++	while (p = head) {
++		head = head->fts_link;
+ 		free(p);
+ 	}
++}
+ 
+-	/* Free up child linked list, sort array, path buffer. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-	if (sp->fts_array)
+-		free(sp->fts_array);
+-	free(sp->fts_path);
++static size_t
++fts_maxarglen(char * const *argv)
++{
++	size_t len, max;
+ 
+-	/* Return to original directory, save errno if necessary. */
+-	if (!ISSET(FTS_NOCHDIR)) {
+-		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
+-		(void)close(sp->fts_rfd);
+-	}
++	for (max = 0; *argv; ++argv)
++		if ((len = strlen(*argv)) > max)
++			max = len;
++	return (max);
++}
+ 
+-	/* Free up the stream pointer. */
+-	free(sp);
+ 
+-	/* Set errno and return. */
+-	if (!ISSET(FTS_NOCHDIR) && saved_errno) {
+-		errno = saved_errno;
+-		return (-1);
++/*
++ * When the path is realloc'd, have to fix all of the pointers in structures
++ * already returned.
++ */
++static void
++fts_padjust(FTS *sp, void *addr)
++{
++	FTSENT *p;
++
++#define	ADJUST(p) {							\
++	(p)->fts_accpath =						\
++	    (char *)addr + ((p)->fts_accpath - (p)->fts_path);		\
++	(p)->fts_path = addr;						\
++}
++	/* Adjust the current set of children. */
++	for (p = sp->fts_child; p; p = p->fts_link)
++		ADJUST(p);
++
++	/* Adjust the rest of the tree. */
++	for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
++		ADJUST(p);
++		p = p->fts_link ? p->fts_link : p->fts_parent;
+ 	}
+-	return (0);
+ }
+ 
+ /*
+- * Special case a root of "/" so that slashes aren't appended which would
+- * cause paths to be written as "//foo".
++ * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
++ * Most systems will allow creation of paths much longer than MAXPATHLEN, even
++ * though the kernel won't resolve them.  Add the size (not just what's needed)
++ * plus 256 bytes so don't realloc the path 2 bytes at a time.
+  */
+-#define	NAPPEND(p)							\
+-	(p->fts_level == FTS_ROOTLEVEL && p->fts_pathlen == 1 &&	\
+-	    p->fts_path[0] == '/' ? 0 : p->fts_pathlen)
++static int
++fts_palloc(FTS *sp, size_t more)
++{
++	sp->fts_pathlen += more + 256;
++	sp->fts_path = realloc(sp->fts_path, (size_t)sp->fts_pathlen);
++	return (sp->fts_path == NULL);
++}
+ 
+-FTSENT *
+-fts_read(sp)
+-	register FTS *sp;
++static FTSENT *
++fts_alloc(FTS *sp, char *name, register int namelen)
+ {
+-	register FTSENT *p, *tmp;
+-	register int instr;
+-	register char *t;
+-	int saved_errno;
++	register FTSENT *p;
++	size_t len;
+ 
+-	/* If finished or unrecoverable error, return NULL. */
+-	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
++	/*
++	 * The file name is a variable length array and no stat structure is
++	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
++	 * structure, the file name and the stat structure in one chunk, but
++	 * be careful that the stat structure is reasonably aligned.  Since the
++	 * fts_name field is declared to be of size 1, the fts_name pointer is
++	 * namelen + 2 before the first possible address of the stat structure.
++	 */
++	len = sizeof(FTSENT) + namelen;
++	if (!ISSET(FTS_NOSTAT))
++		len += sizeof(struct stat) + ALIGNBYTES;
++	if ((p = malloc(len)) == NULL)
+ 		return (NULL);
+ 
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
++	/* Copy the name plus the trailing NULL. */
++	memmove(p->fts_name, name, namelen + 1);
+ 
+-	/* Save and zero out user instructions. */
+-	instr = p->fts_instr;
++	if (!ISSET(FTS_NOSTAT))
++		p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
++	p->fts_namelen = namelen;
++	p->fts_path = sp->fts_path;
++	p->fts_errno = 0;
++	p->fts_flags = 0;
+ 	p->fts_instr = FTS_NOINSTR;
++	p->fts_number = 0;
++	p->fts_pointer = NULL;
++	return (p);
++}
+ 
+-	/* Any type of file may be re-visited; re-stat and re-turn. */
+-	if (instr == FTS_AGAIN) {
+-		p->fts_info = fts_stat(sp, NULL, p, 0);
+-		return (p);
+-	}
+ 
++static u_short
++fts_stat(FTS *sp, register FTSENT *p, struct dirent *dp, int follow)
++{
++	register FTSENT *t;
++	register dev_t dev;
++	register ino_t ino;
++	struct stat *sbp, sb;
++	int saved_errno;
++
++	/* If user needs stat info, stat buffer already allocated. */
++	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
++
++#ifdef S_IFWHT
+ 	/*
+-	 * Following a symlink -- SLNONE test allows application to see
+-	 * SLNONE and recover.  If indirecting through a symlink, have
+-	 * keep a pointer to current location.  If unable to get that
+-	 * pointer, follow fails.
+-	 */
+-	if (instr == FTS_FOLLOW &&
+-	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+-		p->fts_info = fts_stat(sp, NULL, p, 1);
+-		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+-			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
+-				p->fts_errno = errno;
+-				p->fts_info = FTS_ERR;
+-			} else
+-				p->fts_flags |= FTS_SYMFOLLOW;
+-		return (p);
++	 * Whited-out files don't really exist.  However, there's stat(2) file
++	 * mask for them, so we set it so that programs (i.e., find) don't have
++	 * to test FTS_W separately from other file types.
++	 */
++	if (dp != NULL && dp->d_type == DT_WHT) {
++		memset(sbp, 0, sizeof(struct stat));
++		sbp->st_mode = S_IFWHT;
++		return (FTS_W);
+ 	}
+-
+-	/* Directory in pre-order. */
+-	if (p->fts_info == FTS_D) {
+-		/* If skipped or crossed mount point, do post-order visit. */
+-		if (instr == FTS_SKIP ||
+-		    ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
+-			if (p->fts_flags & FTS_SYMFOLLOW)
+-				(void)close(p->fts_symfd);
+-			if (sp->fts_child) {
+-				fts_lfree(sp->fts_child);
+-				sp->fts_child = NULL;
+-			}
+-			p->fts_info = FTS_DP;
+-			return (p);
+-		} 
+-
+-		/* Rebuild if only read the names and now traversing. */
+-		if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) {
+-			sp->fts_options &= ~FTS_NAMEONLY;
+-			fts_lfree(sp->fts_child);
+-			sp->fts_child = NULL;
+-		}
+-
+-		/*
+-		 * Cd to the subdirectory.
+-		 *
+-		 * If have already read and now fail to chdir, whack the list
+-		 * to make the names come out right, and set the parent errno
+-		 * so the application will eventually get an error condition.
+-		 * Set the FTS_DONTCHDIR flag so that when we logically change
+-		 * directories back to the parent we don't do a chdir.
+-		 *
+-		 * If haven't read do so.  If the read fails, fts_build sets
+-		 * FTS_STOP or the fts_info field of the node.
+-		 */
+-		if (sp->fts_child) {
+-			if (CHDIR(sp, p->fts_accpath)) {
+-				p->fts_errno = errno;
+-				p->fts_flags |= FTS_DONTCHDIR;
+-				for (p = sp->fts_child; p; p = p->fts_link)
+-					p->fts_accpath =
+-					    p->fts_parent->fts_accpath;
+-			}
+-		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+-			if (ISSET(FTS_STOP))
+-				return (NULL);
+-			return (p);
++#endif
++
++	/*
++	 * If doing a logical walk, or application requested FTS_FOLLOW, do
++	 * a stat(2).  If that fails, check for a non-existent symlink.  If
++	 * fail, set the errno from the stat call.
++	 */
++	if (ISSET(FTS_LOGICAL) || follow) {
++		if (stat(p->fts_accpath, sbp)) {
++			saved_errno = errno;
++			if (!lstat(p->fts_accpath, sbp)) {
++				errno = 0;
++				return (FTS_SLNONE);
++			}
++			p->fts_errno = saved_errno;
++			goto err;
+ 		}
+-		p = sp->fts_child;
+-		sp->fts_child = NULL;
+-		goto name;
++	} else if (lstat(p->fts_accpath, sbp)) {
++		p->fts_errno = errno;
++err:		memset(sbp, 0, sizeof(struct stat));
++		return (FTS_NS);
+ 	}
+ 
+-	/* Move to the next node on this level. */
+-next:	tmp = p;
+-	if (p = p->fts_link) {
+-		free(tmp);
+-
+-		/*
+-		 * If reached the top, return to the original directory, and
+-		 * load the paths for the next root.
+-		 */
+-		if (p->fts_level == FTS_ROOTLEVEL) {
+-			if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
+-				SET(FTS_STOP);
+-				return (NULL);
+-			}
+-			fts_load(sp, p);
+-			return (sp->fts_cur = p);
+-		}
+-
++	if (S_ISDIR(sbp->st_mode)) {
+ 		/*
+-		 * User may have called fts_set on the node.  If skipped,
+-		 * ignore.  If followed, get a file descriptor so we can
+-		 * get back if necessary.
++		 * Set the device/inode.  Used to find cycles and check for
++		 * crossing mount points.  Also remember the link count, used
++		 * in fts_build to limit the number of stat calls.  It is
++		 * understood that these fields are only referenced if fts_info
++		 * is set to FTS_D.
+ 		 */
+-		if (p->fts_instr == FTS_SKIP)
+-			goto next;
+-		if (p->fts_instr == FTS_FOLLOW) {
+-			p->fts_info = fts_stat(sp, NULL, p, 1);
+-			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
+-				if ((p->fts_symfd =
+-				    open(".", O_RDONLY, 0)) < 0) {
+-					p->fts_errno = errno;
+-					p->fts_info = FTS_ERR;
+-				} else
+-					p->fts_flags |= FTS_SYMFOLLOW;
+-			p->fts_instr = FTS_NOINSTR;
+-		}
+-
+-name:		t = sp->fts_path + NAPPEND(p->fts_parent);
+-		*t++ = '/';
+-		memmove(t, p->fts_name, p->fts_namelen + 1);
+-		return (sp->fts_cur = p);
+-	}
++		dev = p->fts_dev = sbp->st_dev;
++		ino = p->fts_ino = sbp->st_ino;
++		p->fts_nlink = sbp->st_nlink;
+ 
+-	/* Move up to the parent node. */
+-	p = tmp->fts_parent;
+-	free(tmp);
++		if (ISDOT(p->fts_name))
++			return (FTS_DOT);
+ 
+-	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+ 		/*
+-		 * Done; free everything up and set errno to 0 so the user
+-		 * can distinguish between error and EOF.
++		 * Cycle detection is done by brute force when the directory
++		 * is first encountered.  If the tree gets deep enough or the
++		 * number of symbolic links to directories is high enough,
++		 * something faster might be worthwhile.
+ 		 */
+-		free(p);
+-		errno = 0;
+-		return (sp->fts_cur = NULL);
+-	}
+-
+-	/* Nul terminate the pathname. */
+-	sp->fts_path[p->fts_pathlen] = '\0';
+-
+-	/*
+-	 * Return to the parent directory.  If at a root node or came through
+-	 * a symlink, go back through the file descriptor.  Otherwise, cd up
+-	 * one directory.
+-	 */
+-	if (p->fts_level == FTS_ROOTLEVEL) {
+-		if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	} else if (p->fts_flags & FTS_SYMFOLLOW) {
+-		if (FCHDIR(sp, p->fts_symfd)) {
+-			saved_errno = errno;
+-			(void)close(p->fts_symfd);
+-			errno = saved_errno;
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-		(void)close(p->fts_symfd);
+-	} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
+-		if (CHDIR(sp, "..")) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	}
+-	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+-	return (sp->fts_cur = p);
+-}
+-
+-/*
+- * Fts_set takes the stream as an argument although it's not used in this
+- * implementation; it would be necessary if anyone wanted to add global
+- * semantics to fts using fts_set.  An error return is allowed for similar
+- * reasons.
+- */
+-/* ARGSUSED */
+-int
+-fts_set(sp, p, instr)
+-	FTS *sp;
+-	FTSENT *p;
+-	int instr;
+-{
+-	if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+-	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
+-		errno = EINVAL;
+-		return (1);
++		for (t = p->fts_parent;
++		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
++			if (ino == t->fts_ino && dev == t->fts_dev) {
++				p->fts_cycle = t;
++				return (FTS_DC);
++			}
++		return (FTS_D);
+ 	}
+-	p->fts_instr = instr;
+-	return (0);
++	if (S_ISLNK(sbp->st_mode))
++		return (FTS_SL);
++	if (S_ISREG(sbp->st_mode))
++		return (FTS_F);
++	return (FTS_DEFAULT);
+ }
+ 
+-FTSENT *
+-fts_children(sp, instr)
+-	register FTS *sp;
+-	int instr;
++static FTSENT *
++fts_sort(FTS *sp, FTSENT *head, register int nitems)
+ {
+-	register FTSENT *p;
+-	int fd;
+-
+-	if (instr && instr != FTS_NAMEONLY) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
+-
+-	/*
+-	 * Errno set to 0 so user can distinguish empty directory from
+-	 * an error.
+-	 */
+-	errno = 0;
+-
+-	/* Fatal errors stop here. */
+-	if (ISSET(FTS_STOP))
+-		return (NULL);
+-
+-	/* Return logical hierarchy of user's arguments. */
+-	if (p->fts_info == FTS_INIT)
+-		return (p->fts_link);
+-
+-	/*
+-	 * If not a directory being visited in pre-order, stop here.  Could
+-	 * allow FTS_DNR, assuming the user has fixed the problem, but the
+-	 * same effect is available with FTS_AGAIN.
+-	 */
+-	if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
+-		return (NULL);
+-
+-	/* Free up any previous child list. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-
+-	if (instr == FTS_NAMEONLY) {
+-		sp->fts_options |= FTS_NAMEONLY;
+-		instr = BNAMES;
+-	} else 
+-		instr = BCHILD;
++	register FTSENT **ap, *p;
+ 
+ 	/*
+-	 * If using chdir on a relative path and called BEFORE fts_read does
+-	 * its chdir to the root of a traversal, we can lose -- we need to
+-	 * chdir into the subdirectory, and we don't know where the current
+-	 * directory is, so we can't get back so that the upcoming chdir by
+-	 * fts_read will work.
++	 * Construct an array of pointers to the structures and call qsort(3).
++	 * Reassemble the array in the order returned by qsort.  If unable to
++	 * sort for memory reasons, return the directory entries in their
++	 * current order.  Allocate enough space for the current needs plus
++	 * 40 so don't realloc one entry at a time.
+ 	 */
+-	if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
+-	    ISSET(FTS_NOCHDIR))
+-		return (sp->fts_child = fts_build(sp, instr));
+-
+-	if ((fd = open(".", O_RDONLY, 0)) < 0)
+-		return (NULL);
+-	sp->fts_child = fts_build(sp, instr);
+-	if (fchdir(fd))
+-		return (NULL);
+-	(void)close(fd);
+-	return (sp->fts_child);
++	if (nitems > sp->fts_nitems) {
++		sp->fts_nitems = nitems + 40;
++		if ((sp->fts_array = realloc(sp->fts_array,
++		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
++			sp->fts_nitems = 0;
++			return (head);
++		}
++	}
++	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
++		*ap++ = p;
++	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
++	for (head = *(ap = sp->fts_array); --nitems; ++ap)
++		ap[0]->fts_link = ap[1];
++	ap[0]->fts_link = NULL;
++	return (head);
+ }
+ 
+ /*
+@@ -551,9 +320,7 @@ fts_children(sp, instr)
+  * been found, cutting the stat calls by about 2/3.
+  */
+ static FTSENT *
+-fts_build(sp, type)
+-	register FTS *sp;
+-	int type;
++fts_build(register FTS *sp, int type)
+ {
+ 	register struct dirent *dp;
+ 	register FTSENT *p, *head;
+@@ -716,283 +483,479 @@ mem1:				saved_errno = errno;
+ 				--nlinks;
+ 		}
+ 
+-		/* We walk in directory order so "ls -f" doesn't get upset. */
+-		p->fts_link = NULL;
+-		if (head == NULL)
+-			head = tail = p;
+-		else {
+-			tail->fts_link = p;
+-			tail = p;
++		/* We walk in directory order so "ls -f" doesn't get upset. */
++		p->fts_link = NULL;
++		if (head == NULL)
++			head = tail = p;
++		else {
++			tail->fts_link = p;
++			tail = p;
++		}
++		++nitems;
++	}
++	(void)closedir(dirp);
++
++	/*
++	 * If had to realloc the path, adjust the addresses for the rest
++	 * of the tree.
++	 */
++	if (adjaddr)
++		fts_padjust(sp, adjaddr);
++
++	/*
++	 * If not changing directories, reset the path back to original
++	 * state.
++	 */
++	if (ISSET(FTS_NOCHDIR)) {
++		if (cp - 1 > sp->fts_path)
++			--cp;
++		*cp = '\0';
++	}
++
++	/*
++	 * If descended after called from fts_children or after called from
++	 * fts_read and nothing found, get back.  At the root level we use
++	 * the saved fd; if one of fts_open()'s arguments is a relative path
++	 * to an empty directory, we wind up here with no other way back.  If
++	 * can't get back, we're done.
++	 */
++	if (descend && (type == BCHILD || !nitems) &&
++	    (cur->fts_level == FTS_ROOTLEVEL ?
++	    FCHDIR(sp, sp->fts_rfd) : CHDIR(sp, ".."))) {
++		cur->fts_info = FTS_ERR;
++		SET(FTS_STOP);
++		return (NULL);
++	}
++
++	/* If didn't find anything, return NULL. */
++	if (!nitems) {
++		if (type == BREAD)
++			cur->fts_info = FTS_DP;
++		return (NULL);
++	}
++
++	/* Sort the entries. */
++	if (sp->fts_compar && nitems > 1)
++		head = fts_sort(sp, head, nitems);
++	return (head);
++}
++
++
++FTS *
++fts_open(char * const *argv, register int options, int (*compar)())
++{
++	register FTS *sp;
++	register FTSENT *p, *root;
++	register int nitems;
++	FTSENT *parent, *tmp;
++	int len;
++
++	/* Options check. */
++	if (options & ~FTS_OPTIONMASK) {
++		errno = EINVAL;
++		return (NULL);
++	}
++
++	/* Allocate/initialize the stream */
++	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
++		return (NULL);
++	memset(sp, 0, sizeof(FTS));
++	sp->fts_compar = compar;
++	sp->fts_options = options;
++
++	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
++	if (ISSET(FTS_LOGICAL))
++		SET(FTS_NOCHDIR);
++
++	/*
++	 * Start out with 1K of path space, and enough, in any case,
++	 * to hold the user's paths.
++	 */
++	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
++		goto mem1;
++
++	/* Allocate/initialize root's parent. */
++	if ((parent = fts_alloc(sp, "", 0)) == NULL)
++		goto mem2;
++	parent->fts_level = FTS_ROOTPARENTLEVEL;
++
++	/* Allocate/initialize root(s). */
++	for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
++		/* Don't allow zero-length paths. */
++		if ((len = strlen(*argv)) == 0) {
++			errno = EINVAL;
++			goto mem3;
++		}
++
++		p = fts_alloc(sp, *argv, len);
++		p->fts_level = FTS_ROOTLEVEL;
++		p->fts_parent = parent;
++		p->fts_accpath = p->fts_name;
++		p->fts_info = fts_stat(sp, NULL, p, ISSET(FTS_COMFOLLOW));
++
++		/* Command-line "." and ".." are real directories. */
++		if (p->fts_info == FTS_DOT)
++			p->fts_info = FTS_D;
++
++		/*
++		 * If comparison routine supplied, traverse in sorted
++		 * order; otherwise traverse in the order specified.
++		 */
++		if (compar) {
++			p->fts_link = root;
++			root = p;
++		} else {
++			p->fts_link = NULL;
++			if (root == NULL)
++				tmp = root = p;
++			else {
++				tmp->fts_link = p;
++				tmp = p;
++			}
+ 		}
+-		++nitems;
+ 	}
+-	(void)closedir(dirp);
+-
+-	/*
+-	 * If had to realloc the path, adjust the addresses for the rest
+-	 * of the tree.
+-	 */
+-	if (adjaddr)
+-		fts_padjust(sp, adjaddr);
++	if (compar && nitems > 1)
++		root = fts_sort(sp, root, nitems);
+ 
+ 	/*
+-	 * If not changing directories, reset the path back to original
+-	 * state.
++	 * Allocate a dummy pointer and make fts_read think that we've just
++	 * finished the node before the root(s); set p->fts_info to FTS_INIT
++	 * so that everything about the "current" node is ignored.
+ 	 */
+-	if (ISSET(FTS_NOCHDIR)) {
+-		if (cp - 1 > sp->fts_path)
+-			--cp;
+-		*cp = '\0';
+-	}
++	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
++		goto mem3;
++	sp->fts_cur->fts_link = root;
++	sp->fts_cur->fts_info = FTS_INIT;
+ 
+ 	/*
+-	 * If descended after called from fts_children or after called from
+-	 * fts_read and nothing found, get back.  At the root level we use
+-	 * the saved fd; if one of fts_open()'s arguments is a relative path
+-	 * to an empty directory, we wind up here with no other way back.  If
+-	 * can't get back, we're done.
++	 * If using chdir(2), grab a file descriptor pointing to dot to insure
++	 * that we can get back here; this could be avoided for some paths,
++	 * but almost certainly not worth the effort.  Slashes, symbolic links,
++	 * and ".." are all fairly nasty problems.  Note, if we can't get the
++	 * descriptor we run anyway, just more slowly.
+ 	 */
+-	if (descend && (type == BCHILD || !nitems) &&
+-	    (cur->fts_level == FTS_ROOTLEVEL ?
+-	    FCHDIR(sp, sp->fts_rfd) : CHDIR(sp, ".."))) {
+-		cur->fts_info = FTS_ERR;
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
++	if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
++		SET(FTS_NOCHDIR);
+ 
+-	/* If didn't find anything, return NULL. */
+-	if (!nitems) {
+-		if (type == BREAD)
+-			cur->fts_info = FTS_DP;
+-		return (NULL);
+-	}
++	return (sp);
+ 
+-	/* Sort the entries. */
+-	if (sp->fts_compar && nitems > 1)
+-		head = fts_sort(sp, head, nitems);
+-	return (head);
++mem3:	fts_lfree(root);
++	free(parent);
++mem2:	free(sp->fts_path);
++mem1:	free(sp);
++	return (NULL);
+ }
+ 
+-static u_short
+-fts_stat(sp, dp, p, follow)
+-	FTS *sp;
+-	register FTSENT *p;
+-	struct dirent *dp;
+-	int follow;
++FTSENT *
++fts_read(register FTS *sp)
+ {
+-	register FTSENT *t;
+-	register dev_t dev;
+-	register ino_t ino;
+-	struct stat *sbp, sb;
++	register FTSENT *p, *tmp;
++	register int instr;
++	register char *t;
+ 	int saved_errno;
+ 
+-	/* If user needs stat info, stat buffer already allocated. */
+-	sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
++	/* If finished or unrecoverable error, return NULL. */
++	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
++		return (NULL);
+ 
+-#ifdef S_IFWHT
+-	/*
+-	 * Whited-out files don't really exist.  However, there's stat(2) file
+-	 * mask for them, so we set it so that programs (i.e., find) don't have
+-	 * to test FTS_W separately from other file types.
+-	 */
+-	if (dp != NULL && dp->d_type == DT_WHT) {
+-		memset(sbp, 0, sizeof(struct stat));
+-		sbp->st_mode = S_IFWHT;
+-		return (FTS_W);
++	/* Set current node pointer. */
++	p = sp->fts_cur;
++
++	/* Save and zero out user instructions. */
++	instr = p->fts_instr;
++	p->fts_instr = FTS_NOINSTR;
++
++	/* Any type of file may be re-visited; re-stat and re-turn. */
++	if (instr == FTS_AGAIN) {
++		p->fts_info = fts_stat(sp, NULL, p, 0);
++		return (p);
+ 	}
+-#endif
+-	
++
+ 	/*
+-	 * If doing a logical walk, or application requested FTS_FOLLOW, do
+-	 * a stat(2).  If that fails, check for a non-existent symlink.  If
+-	 * fail, set the errno from the stat call.
++	 * Following a symlink -- SLNONE test allows application to see
++	 * SLNONE and recover.  If indirecting through a symlink, have
++	 * keep a pointer to current location.  If unable to get that
++	 * pointer, follow fails.
+ 	 */
+-	if (ISSET(FTS_LOGICAL) || follow) {
+-		if (stat(p->fts_accpath, sbp)) {
+-			saved_errno = errno;
+-			if (!lstat(p->fts_accpath, sbp)) {
+-				errno = 0;
+-				return (FTS_SLNONE);
+-			} 
+-			p->fts_errno = saved_errno;
+-			goto err;
++	if (instr == FTS_FOLLOW &&
++	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
++		p->fts_info = fts_stat(sp, NULL, p, 1);
++		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
++			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
++				p->fts_errno = errno;
++				p->fts_info = FTS_ERR;
++			} else
++				p->fts_flags |= FTS_SYMFOLLOW;
++		return (p);
++	}
++
++	/* Directory in pre-order. */
++	if (p->fts_info == FTS_D) {
++		/* If skipped or crossed mount point, do post-order visit. */
++		if (instr == FTS_SKIP ||
++		    ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
++			if (p->fts_flags & FTS_SYMFOLLOW)
++				(void)close(p->fts_symfd);
++			if (sp->fts_child) {
++				fts_lfree(sp->fts_child);
++				sp->fts_child = NULL;
++			}
++			p->fts_info = FTS_DP;
++			return (p);
+ 		}
+-	} else if (lstat(p->fts_accpath, sbp)) {
+-		p->fts_errno = errno;
+-err:		memset(sbp, 0, sizeof(struct stat));
+-		return (FTS_NS);
++
++		/* Rebuild if only read the names and now traversing. */
++		if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) {
++			sp->fts_options &= ~FTS_NAMEONLY;
++			fts_lfree(sp->fts_child);
++			sp->fts_child = NULL;
++		}
++
++		/*
++		 * Cd to the subdirectory.
++		 *
++		 * If have already read and now fail to chdir, whack the list
++		 * to make the names come out right, and set the parent errno
++		 * so the application will eventually get an error condition.
++		 * Set the FTS_DONTCHDIR flag so that when we logically change
++		 * directories back to the parent we don't do a chdir.
++		 *
++		 * If haven't read do so.  If the read fails, fts_build sets
++		 * FTS_STOP or the fts_info field of the node.
++		 */
++		if (sp->fts_child) {
++			if (CHDIR(sp, p->fts_accpath)) {
++				p->fts_errno = errno;
++				p->fts_flags |= FTS_DONTCHDIR;
++				for (p = sp->fts_child; p; p = p->fts_link)
++					p->fts_accpath =
++					    p->fts_parent->fts_accpath;
++			}
++		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
++			if (ISSET(FTS_STOP))
++				return (NULL);
++			return (p);
++		}
++		p = sp->fts_child;
++		sp->fts_child = NULL;
++		goto name;
+ 	}
+ 
+-	if (S_ISDIR(sbp->st_mode)) {
++	/* Move to the next node on this level. */
++next:	tmp = p;
++	if (p = p->fts_link) {
++		free(tmp);
++
+ 		/*
+-		 * Set the device/inode.  Used to find cycles and check for
+-		 * crossing mount points.  Also remember the link count, used
+-		 * in fts_build to limit the number of stat calls.  It is
+-		 * understood that these fields are only referenced if fts_info
+-		 * is set to FTS_D.
++		 * If reached the top, return to the original directory, and
++		 * load the paths for the next root.
+ 		 */
+-		dev = p->fts_dev = sbp->st_dev;
+-		ino = p->fts_ino = sbp->st_ino;
+-		p->fts_nlink = sbp->st_nlink;
++		if (p->fts_level == FTS_ROOTLEVEL) {
++			if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
++				SET(FTS_STOP);
++				return (NULL);
++			}
++			fts_load(sp, p);
++			return (sp->fts_cur = p);
++		}
++
++		/*
++		 * User may have called fts_set on the node.  If skipped,
++		 * ignore.  If followed, get a file descriptor so we can
++		 * get back if necessary.
++		 */
++		if (p->fts_instr == FTS_SKIP)
++			goto next;
++		if (p->fts_instr == FTS_FOLLOW) {
++			p->fts_info = fts_stat(sp, NULL, p, 1);
++			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
++				if ((p->fts_symfd =
++				    open(".", O_RDONLY, 0)) < 0) {
++					p->fts_errno = errno;
++					p->fts_info = FTS_ERR;
++				} else
++					p->fts_flags |= FTS_SYMFOLLOW;
++			p->fts_instr = FTS_NOINSTR;
++		}
+ 
+-		if (ISDOT(p->fts_name))
+-			return (FTS_DOT);
++name:		t = sp->fts_path + NAPPEND(p->fts_parent);
++		*t++ = '/';
++		memmove(t, p->fts_name, p->fts_namelen + 1);
++		return (sp->fts_cur = p);
++	}
+ 
++	/* Move up to the parent node. */
++	p = tmp->fts_parent;
++	free(tmp);
++
++	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+ 		/*
+-		 * Cycle detection is done by brute force when the directory
+-		 * is first encountered.  If the tree gets deep enough or the
+-		 * number of symbolic links to directories is high enough,
+-		 * something faster might be worthwhile.
++		 * Done; free everything up and set errno to 0 so the user
++		 * can distinguish between error and EOF.
+ 		 */
+-		for (t = p->fts_parent;
+-		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+-			if (ino == t->fts_ino && dev == t->fts_dev) {
+-				p->fts_cycle = t;
+-				return (FTS_DC);
+-			}
+-		return (FTS_D);
++		free(p);
++		errno = 0;
++		return (sp->fts_cur = NULL);
+ 	}
+-	if (S_ISLNK(sbp->st_mode))
+-		return (FTS_SL);
+-	if (S_ISREG(sbp->st_mode))
+-		return (FTS_F);
+-	return (FTS_DEFAULT);
+-}
+ 
+-static FTSENT *
+-fts_sort(sp, head, nitems)
+-	FTS *sp;
+-	FTSENT *head;
+-	register int nitems;
+-{
+-	register FTSENT **ap, *p;
++	/* Nul terminate the pathname. */
++	sp->fts_path[p->fts_pathlen] = '\0';
+ 
+ 	/*
+-	 * Construct an array of pointers to the structures and call qsort(3).
+-	 * Reassemble the array in the order returned by qsort.  If unable to
+-	 * sort for memory reasons, return the directory entries in their
+-	 * current order.  Allocate enough space for the current needs plus
+-	 * 40 so don't realloc one entry at a time.
++	 * Return to the parent directory.  If at a root node or came through
++	 * a symlink, go back through the file descriptor.  Otherwise, cd up
++	 * one directory.
+ 	 */
+-	if (nitems > sp->fts_nitems) {
+-		sp->fts_nitems = nitems + 40;
+-		if ((sp->fts_array = realloc(sp->fts_array,
+-		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
+-			sp->fts_nitems = 0;
+-			return (head);
++	if (p->fts_level == FTS_ROOTLEVEL) {
++		if (!ISSET(FTS_NOCHDIR) && FCHDIR(sp, sp->fts_rfd)) {
++			SET(FTS_STOP);
++			return (NULL);
++		}
++	} else if (p->fts_flags & FTS_SYMFOLLOW) {
++		if (FCHDIR(sp, p->fts_symfd)) {
++			saved_errno = errno;
++			(void)close(p->fts_symfd);
++			errno = saved_errno;
++			SET(FTS_STOP);
++			return (NULL);
++		}
++		(void)close(p->fts_symfd);
++	} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
++		if (CHDIR(sp, "..")) {
++			SET(FTS_STOP);
++			return (NULL);
+ 		}
+ 	}
+-	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+-		*ap++ = p;
+-	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+-	for (head = *(ap = sp->fts_array); --nitems; ++ap)
+-		ap[0]->fts_link = ap[1];
+-	ap[0]->fts_link = NULL;
+-	return (head);
++	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
++	return (sp->fts_cur = p);
+ }
+ 
+-static FTSENT *
+-fts_alloc(sp, name, namelen)
+-	FTS *sp;
+-	char *name;
+-	register int namelen;
++/*
++ * Fts_set takes the stream as an argument although it's not used in this
++ * implementation; it would be necessary if anyone wanted to add global
++ * semantics to fts using fts_set.  An error return is allowed for similar
++ * reasons.
++ */
++/* ARGSUSED */
++int
++fts_set(FTS *sp, FTSENT *p, int instr)
++{
++	if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
++	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
++		errno = EINVAL;
++		return (1);
++	}
++	p->fts_instr = instr;
++	return (0);
++}
++
++FTSENT *
++fts_children(register FTS *sp, int instr)
+ {
+ 	register FTSENT *p;
+-	size_t len;
++	int fd;
++
++	if (instr && instr != FTS_NAMEONLY) {
++		errno = EINVAL;
++		return (NULL);
++	}
++
++	/* Set current node pointer. */
++	p = sp->fts_cur;
+ 
+ 	/*
+-	 * The file name is a variable length array and no stat structure is
+-	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
+-	 * structure, the file name and the stat structure in one chunk, but
+-	 * be careful that the stat structure is reasonably aligned.  Since the
+-	 * fts_name field is declared to be of size 1, the fts_name pointer is
+-	 * namelen + 2 before the first possible address of the stat structure.
++	 * Errno set to 0 so user can distinguish empty directory from
++	 * an error.
+ 	 */
+-	len = sizeof(FTSENT) + namelen;
+-	if (!ISSET(FTS_NOSTAT))
+-		len += sizeof(struct stat) + ALIGNBYTES;
+-	if ((p = malloc(len)) == NULL)
++	errno = 0;
++
++	/* Fatal errors stop here. */
++	if (ISSET(FTS_STOP))
+ 		return (NULL);
+ 
+-	/* Copy the name plus the trailing NULL. */
+-	memmove(p->fts_name, name, namelen + 1);
++	/* Return logical hierarchy of user's arguments. */
++	if (p->fts_info == FTS_INIT)
++		return (p->fts_link);
+ 
+-	if (!ISSET(FTS_NOSTAT))
+-		p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+-	p->fts_namelen = namelen;
+-	p->fts_path = sp->fts_path;
+-	p->fts_errno = 0;
+-	p->fts_flags = 0;
+-	p->fts_instr = FTS_NOINSTR;
+-	p->fts_number = 0;
+-	p->fts_pointer = NULL;
+-	return (p);
++	/*
++	 * If not a directory being visited in pre-order, stop here.  Could
++	 * allow FTS_DNR, assuming the user has fixed the problem, but the
++	 * same effect is available with FTS_AGAIN.
++	 */
++	if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
++		return (NULL);
++
++	/* Free up any previous child list. */
++	if (sp->fts_child)
++		fts_lfree(sp->fts_child);
++
++	if (instr == FTS_NAMEONLY) {
++		sp->fts_options |= FTS_NAMEONLY;
++		instr = BNAMES;
++	} else
++		instr = BCHILD;
++
++	/*
++	 * If using chdir on a relative path and called BEFORE fts_read does
++	 * its chdir to the root of a traversal, we can lose -- we need to
++	 * chdir into the subdirectory, and we don't know where the current
++	 * directory is, so we can't get back so that the upcoming chdir by
++	 * fts_read will work.
++	 */
++	if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
++	    ISSET(FTS_NOCHDIR))
++		return (sp->fts_child = fts_build(sp, instr));
++
++	if ((fd = open(".", O_RDONLY, 0)) < 0)
++		return (NULL);
++	sp->fts_child = fts_build(sp, instr);
++	if (fchdir(fd))
++		return (NULL);
++	(void)close(fd);
++	return (sp->fts_child);
+ }
+ 
+-static void
+-fts_lfree(head)
+-	register FTSENT *head;
++int
++fts_close(FTS *sp)
+ {
+-	register FTSENT *p;
++	register FTSENT *freep, *p;
++	int saved_errno;
+ 
+-	/* Free a linked list of structures. */
+-	while (p = head) {
+-		head = head->fts_link;
++	/*
++	 * This still works if we haven't read anything -- the dummy structure
++	 * points to the root list, so we step through to the end of the root
++	 * list which has a valid parent pointer.
++	 */
++	if (sp->fts_cur) {
++		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
++			freep = p;
++			p = p->fts_link ? p->fts_link : p->fts_parent;
++			free(freep);
++		}
+ 		free(p);
+ 	}
+-}
+ 
+-/*
+- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
+- * though the kernel won't resolve them.  Add the size (not just what's needed)
+- * plus 256 bytes so don't realloc the path 2 bytes at a time. 
+- */
+-static int
+-fts_palloc(sp, more)
+-	FTS *sp;
+-	size_t more;
+-{
+-	sp->fts_pathlen += more + 256;
+-	sp->fts_path = realloc(sp->fts_path, (size_t)sp->fts_pathlen);
+-	return (sp->fts_path == NULL);
+-}
++	/* Free up child linked list, sort array, path buffer. */
++	if (sp->fts_child)
++		fts_lfree(sp->fts_child);
++	if (sp->fts_array)
++		free(sp->fts_array);
++	free(sp->fts_path);
+ 
+-/*
+- * When the path is realloc'd, have to fix all of the pointers in structures
+- * already returned.
+- */
+-static void
+-fts_padjust(sp, addr)
+-	FTS *sp;
+-	void *addr;
+-{
+-	FTSENT *p;
++	/* Return to original directory, save errno if necessary. */
++	if (!ISSET(FTS_NOCHDIR)) {
++		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
++		(void)close(sp->fts_rfd);
++	}
+ 
+-#define	ADJUST(p) {							\
+-	(p)->fts_accpath =						\
+-	    (char *)addr + ((p)->fts_accpath - (p)->fts_path);		\
+-	(p)->fts_path = addr;						\
+-}
+-	/* Adjust the current set of children. */
+-	for (p = sp->fts_child; p; p = p->fts_link)
+-		ADJUST(p);
++	/* Free up the stream pointer. */
++	free(sp);
+ 
+-	/* Adjust the rest of the tree. */
+-	for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-		ADJUST(p);
+-		p = p->fts_link ? p->fts_link : p->fts_parent;
++	/* Set errno and return. */
++	if (!ISSET(FTS_NOCHDIR) && saved_errno) {
++		errno = saved_errno;
++		return (-1);
+ 	}
++	return (0);
+ }
+ 
+-static size_t
+-fts_maxarglen(argv)
+-	char * const *argv;
+-{
+-	size_t len, max;
+-
+-	for (max = 0; *argv; ++argv)
+-		if ((len = strlen(*argv)) > max)
+-			max = len;
+-	return (max);
+-}
diff --git a/meta/recipes-core/fts/fts/remove_cdefs.patch b/meta/recipes-core/fts/fts/remove_cdefs.patch
new file mode 100644
index 0000000..c152704
--- /dev/null
+++ b/meta/recipes-core/fts/fts/remove_cdefs.patch
@@ -0,0 +1,69 @@
+Replace use of macros from sys/cdefs.h since cdefs.h is missing on musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+Index: fts/fts.h
+===================================================================
+--- fts.orig/fts.h
++++ fts/fts.h
+@@ -126,15 +126,21 @@ typedef struct _ftsent {
+ 	char fts_name[1];		/* file name */
+ } FTSENT;
+ 
+-#include <sys/cdefs.h>
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+-__BEGIN_DECLS
+-FTSENT	*fts_children __P((FTS *, int));
+-int	 fts_close __P((FTS *));
+-FTS	*fts_open __P((char * const *, int,
+-	    int (*)(const FTSENT **, const FTSENT **)));
+-FTSENT	*fts_read __P((FTS *));
+-int	 fts_set __P((FTS *, FTSENT *, int));
+-__END_DECLS
++#ifndef __P
++#define __P
++#endif
++FTSENT	*fts_children (FTS *p, int opts);
++int	 fts_close (FTS *p);
++FTS	*fts_open (char * const * path, int opts,
++	    int (*compfn)(const FTSENT **, const FTSENT **));
++FTSENT	*fts_read (FTS *p);
++int	 fts_set (FTS *p, FTSENT *f, int opts);
+ 
++#ifdef __cplusplus
++}
++#endif
+ #endif /* !_FTS_H_ */
+Index: fts/fts.c
+===================================================================
+--- fts.orig/fts.c
++++ fts/fts.c
+@@ -50,15 +50,15 @@ static char sccsid[] = "@(#)fts.c	8.6 (B
+ #include <string.h>
+ #include <unistd.h>
+ 
+-static FTSENT	*fts_alloc __P((FTS *, char *, int));
+-static FTSENT	*fts_build __P((FTS *, int));
+-static void	 fts_lfree __P((FTSENT *));
+-static void	 fts_load __P((FTS *, FTSENT *));
+-static size_t	 fts_maxarglen __P((char * const *));
+-static void	 fts_padjust __P((FTS *, void *));
+-static int	 fts_palloc __P((FTS *, size_t));
+-static FTSENT	*fts_sort __P((FTS *, FTSENT *, int));
+-static u_short	 fts_stat __P((FTS *, struct dirent *, FTSENT *, int));
++static FTSENT	*fts_alloc __P(FTS *, char *, int);
++static FTSENT	*fts_build __P(FTS *, int);
++static void	 fts_lfree __P(FTSENT *);
++static void	 fts_load __P(FTS *, FTSENT *);
++static size_t	 fts_maxarglen __P(char * const *);
++static void	 fts_padjust __P(FTS *, void *);
++static int	 fts_palloc __P(FTS *, size_t);
++static FTSENT	*fts_sort __P(FTS *, FTSENT *, int);
++static u_short	 fts_stat __P(FTS *, struct dirent *, FTSENT *, int);
+ 
+ #define	ISDOT(a)	(a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
+ 
diff --git a/meta/recipes-core/fts/fts/stdint.patch b/meta/recipes-core/fts/fts/stdint.patch
new file mode 100644
index 0000000..89e6097
--- /dev/null
+++ b/meta/recipes-core/fts/fts/stdint.patch
@@ -0,0 +1,15 @@
+Include stdint.h for u_* typedefs
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Inappropriate
+
+--- ./fts.c.orig
++++ ./fts.c
+@@ -46,6 +46,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <fts.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 07/53] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (5 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 06/53] fts: Add recipe Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 08/53] libcgroup: Add dependency on fts when building on musl Khem Raj
                   ` (48 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

We now check at configure time of libc has pktinfo struct

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0003-Fix-header-inclusions-for-musl.patch      | 79 +++++++++++++++-------
 1 file changed, 56 insertions(+), 23 deletions(-)

diff --git a/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
index 6327aa2..eefc683 100644
--- a/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
+++ b/meta/recipes-connectivity/connman/connman/0003-Fix-header-inclusions-for-musl.patch
@@ -14,10 +14,10 @@ Upstream-Status: Pending
  tools/dnsproxy-test.c | 1 +
  5 files changed, 3 insertions(+), 5 deletions(-)
 
-diff --git a/gweb/gresolv.c b/gweb/gresolv.c
-index 3ad8e70..61d6fe8 100644
---- a/gweb/gresolv.c
-+++ b/gweb/gresolv.c
+Index: connman-1.30/gweb/gresolv.c
+===================================================================
+--- connman-1.30.orig/gweb/gresolv.c
++++ connman-1.30/gweb/gresolv.c
 @@ -28,6 +28,7 @@
  #include <stdarg.h>
  #include <string.h>
@@ -26,10 +26,10 @@ index 3ad8e70..61d6fe8 100644
  #include <resolv.h>
  #include <sys/types.h>
  #include <sys/socket.h>
-diff --git a/plugins/wifi.c b/plugins/wifi.c
-index dfe849f..99cff3f 100644
---- a/plugins/wifi.c
-+++ b/plugins/wifi.c
+Index: connman-1.30/plugins/wifi.c
+===================================================================
+--- connman-1.30.orig/plugins/wifi.c
++++ connman-1.30/plugins/wifi.c
 @@ -30,9 +30,8 @@
  #include <string.h>
  #include <sys/ioctl.h>
@@ -41,10 +41,10 @@ index dfe849f..99cff3f 100644
  
  #ifndef IFF_LOWER_UP
  #define IFF_LOWER_UP	0x10000
-diff --git a/src/tethering.c b/src/tethering.c
-index ceeec74..c44cb36 100644
---- a/src/tethering.c
-+++ b/src/tethering.c
+Index: connman-1.30/src/tethering.c
+===================================================================
+--- connman-1.30.orig/src/tethering.c
++++ connman-1.30/src/tethering.c
 @@ -31,10 +31,8 @@
  #include <stdio.h>
  #include <sys/ioctl.h>
@@ -56,10 +56,10 @@ index ceeec74..c44cb36 100644
  #include <netinet/in.h>
  #include <linux/if_bridge.h>
  
-diff --git a/tools/dhcp-test.c b/tools/dhcp-test.c
-index c34e10a..eae66fc 100644
---- a/tools/dhcp-test.c
-+++ b/tools/dhcp-test.c
+Index: connman-1.30/tools/dhcp-test.c
+===================================================================
+--- connman-1.30.orig/tools/dhcp-test.c
++++ connman-1.30/tools/dhcp-test.c
 @@ -33,7 +33,6 @@
  #include <arpa/inet.h>
  #include <net/route.h>
@@ -68,10 +68,10 @@ index c34e10a..eae66fc 100644
  
  #include <gdhcp/gdhcp.h>
  
-diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
-index 551cae9..226ba86 100644
---- a/tools/dnsproxy-test.c
-+++ b/tools/dnsproxy-test.c
+Index: connman-1.30/tools/dnsproxy-test.c
+===================================================================
+--- connman-1.30.orig/tools/dnsproxy-test.c
++++ connman-1.30/tools/dnsproxy-test.c
 @@ -27,6 +27,7 @@
  #include <stdlib.h>
  #include <string.h>
@@ -80,6 +80,39 @@ index 551cae9..226ba86 100644
  #include <arpa/inet.h>
  #include <netinet/in.h>
  #include <sys/types.h>
--- 
-2.5.1
-
+Index: connman-1.30/configure.ac
+===================================================================
+--- connman-1.30.orig/configure.ac
++++ connman-1.30/configure.ac
+@@ -173,6 +173,8 @@ AM_CONDITIONAL(PPTP_BUILTIN, test "${ena
+ 
+ AC_CHECK_HEADERS([execinfo.h])
+ 
++AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
++
+ AC_CHECK_HEADERS(resolv.h, dummy=yes,
+ 	AC_MSG_ERROR(resolver header files are required))
+ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
+Index: connman-1.30/gdhcp/common.h
+===================================================================
+--- connman-1.30.orig/gdhcp/common.h
++++ connman-1.30/gdhcp/common.h
+@@ -19,6 +19,7 @@
+  *
+  */
+ 
++#include <config.h>
+ #include <netinet/udp.h>
+ #include <netinet/ip.h>
+ 
+@@ -170,8 +171,8 @@ static const uint8_t dhcp_option_lengths
+ 	[OPTION_U32]	= 4,
+ };
+ 
+-/* already defined within netinet/in.h if using GNU compiler */
+-#ifndef __USE_GNU
++/* already defined within netinet/in.h if using GNU or musl libc */
++#ifndef HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
+ struct in6_pktinfo {
+ 	struct in6_addr ipi6_addr;  /* src/dst IPv6 address */
+ 	unsigned int ipi6_ifindex;  /* send/recv interface index */
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 08/53] libcgroup: Add dependency on fts when building on musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (6 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 07/53] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 09/53] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
                   ` (47 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../libcgroup/libcgroup/musl-decls-compat.patch    | 235 +++++++++++++++++++++
 meta/recipes-core/libcgroup/libcgroup_0.41.bb      |   4 +
 2 files changed, 239 insertions(+)
 create mode 100644 meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch

diff --git a/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
new file mode 100644
index 0000000..65f4ef9
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
@@ -0,0 +1,235 @@
+commit ca780b4f7f71abeeb04a585f2a4d889caaa985fa
+Author: Isaac Dunham <ibid.ag@gmail.com>
+Date:   Fri Sep 5 22:35:32 2014 -0700
+
+    Remove __.*DECLS nonsense
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: libcgroup-0.41/include/libcgroup/config.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/config.h
++++ libcgroup-0.41/include/libcgroup/config.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_config 5. Configuration
+@@ -107,6 +109,8 @@ int cgroup_config_create_template_group(
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /*_LIBCGROUP_CONFIG_H*/
+Index: libcgroup-0.41/include/libcgroup/error.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/error.h
++++ libcgroup-0.41/include/libcgroup/error.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_errors 6. Error handling
+@@ -99,6 +101,8 @@ int cgroup_get_last_errno(void);
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+Index: libcgroup-0.41/include/libcgroup/groups.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/groups.h
++++ libcgroup-0.41/include/libcgroup/groups.h
+@@ -11,7 +11,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * Flags for cgroup_delete_cgroup_ext().
+@@ -577,6 +579,8 @@ char *cgroup_get_cgroup_name(struct cgro
+  */
+ 
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_GROUPS_H */
+Index: libcgroup-0.41/include/libcgroup/init.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/init.h
++++ libcgroup-0.41/include/libcgroup/init.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_init 1. Initialization
+@@ -58,6 +60,8 @@ int cgroup_get_subsys_mount_point(const
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_INIT_H */
+Index: libcgroup-0.41/include/libcgroup/iterators.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/iterators.h
++++ libcgroup-0.41/include/libcgroup/iterators.h
+@@ -11,7 +11,9 @@
+ #include <features.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_iterators 3. Iterators
+@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(vo
+  * @}
+  */
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_ITERATORS_H */
+Index: libcgroup-0.41/include/libcgroup/tasks.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/tasks.h
++++ libcgroup-0.41/include/libcgroup/tasks.h
+@@ -12,7 +12,9 @@
+ #include <stdbool.h>
+ #endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /** Flags for cgroup_change_cgroup_uid_gid(). */
+ enum cgflags {
+@@ -204,6 +206,8 @@ int cgroup_register_unchanged_process(pi
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_TASKS_H */
+Index: libcgroup-0.41/src/daemon/cgrulesengd.h
+===================================================================
+--- libcgroup-0.41.orig/src/daemon/cgrulesengd.h
++++ libcgroup-0.41/src/daemon/cgrulesengd.h
+@@ -17,7 +17,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include "libcgroup.h"
+@@ -119,7 +121,9 @@ void cgre_flash_templates(int signum);
+  */
+ void cgre_catch_term(int signum);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _CGRULESENGD_H */
+ 
+Index: libcgroup-0.41/src/libcgroup-internal.h
+===================================================================
+--- libcgroup-0.41.orig/src/libcgroup-internal.h
++++ libcgroup-0.41/src/libcgroup-internal.h
+@@ -16,7 +16,9 @@
+ 
+ #define __LIBCG_INTERNAL
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #include "config.h"
+ #include <fts.h>
+@@ -279,6 +281,8 @@ extern void cgroup_dictionary_iterator_e
+  */
+ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif
+Index: libcgroup-0.41/include/libcgroup/log.h
+===================================================================
+--- libcgroup-0.41.orig/include/libcgroup/log.h
++++ libcgroup-0.41/include/libcgroup/log.h
+@@ -11,7 +11,9 @@
+ 
+ #include <stdarg.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /**
+  * @defgroup group_log 7. Logging
+@@ -142,6 +144,8 @@ extern int cgroup_parse_log_level_str(co
+  * @}
+  * @}
+  */
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* _LIBCGROUP_LOG_H */
diff --git a/meta/recipes-core/libcgroup/libcgroup_0.41.bb b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
index 287aecd..9597963 100644
--- a/meta/recipes-core/libcgroup/libcgroup_0.41.bb
+++ b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
@@ -11,12 +11,16 @@ inherit autotools pkgconfig
 DEPENDS = "bison-native flex-native ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/project/libcg/${BPN}/v0.41/${BPN}-${PV}.tar.bz2"
+SRC_URI_append_libc-musl = " file://musl-decls-compat.patch"
 
 SRC_URI[md5sum] = "3dea9d50b8a5b73ff0bf1cdcb210f63f"
 SRC_URI[sha256sum] = "e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51"
 
 UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/libcg/files/libcgroup/"
 
+DEPENDS_append_libc-musl = " fts "
+EXTRA_OEMAKE_append_libc-musl = "LIBS=-lfts"
+
 EXTRA_OECONF = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes', '--enable-pam=no', d)}"
 
 PACKAGES =+ "cgroups-pam-plugin"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 09/53] linux-libc-headers: Port patches for linux-headers for musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (7 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 08/53] libcgroup: Add dependency on fts when building on musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 10/53] xserver-xorg: Fix build with musl Khem Raj
                   ` (46 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

These patches have revealed issues with linux kernel headers which has
been proposed upstream but hasnt been applied yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...mpat.h-fix-some-issues-arising-from-in6.h.patch | 82 ++++++++++++++++++++++
 ...t.h-prevent-redefinition-of-struct-ethhdr.patch | 59 ++++++++++++++++
 ...remove-inclusion-of-sysinfo.h-in-kernel.h.patch | 32 +++++++++
 .../linux-libc-headers/linux-libc-headers_4.1.bb   |  5 ++
 4 files changed, 178 insertions(+)
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch

diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
new file mode 100644
index 0000000..3db52cf
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
@@ -0,0 +1,82 @@
+From 2872f5d8bcef84e62b15b37ba4ffeccfb6402dad Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Wed, 22 Jan 2014 00:48:28 +0100
+Subject: [PATCH 1/3] libc-compat.h: fix some issues arising from in6.h
+
+namely redefinition of some structs provided by netinet/in.h.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/libc-compat.h | 25 ++++++++-----------------
+ 1 file changed, 8 insertions(+), 17 deletions(-)
+
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index fa673e9..afe15c2 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -48,24 +48,15 @@
+ #ifndef _UAPI_LIBC_COMPAT_H
+ #define _UAPI_LIBC_COMPAT_H
+ 
+-/* We have included glibc headers... */
+-#if defined(__GLIBC__)
++#ifndef __KERNEL__ /* we're used from userspace */
+ 
+-/* Coordinate with glibc netinet/in.h header. */
++/* Coordinate with libc netinet/in.h header. */
+ #if defined(_NETINET_IN_H)
+ 
+-/* GLIBC headers included first so don't define anything
++/* libc headers included first so don't define anything
+  * that would already be defined. */
+ #define __UAPI_DEF_IN6_ADDR		0
+-/* The exception is the in6_addr macros which must be defined
+- * if the glibc code didn't define them. This guard matches
+- * the guard in glibc/inet/netinet/in.h which defines the
+- * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
+-#if defined(__USE_MISC) || defined (__USE_GNU)
+ #define __UAPI_DEF_IN6_ADDR_ALT		0
+-#else
+-#define __UAPI_DEF_IN6_ADDR_ALT		1
+-#endif
+ #define __UAPI_DEF_SOCKADDR_IN6		0
+ #define __UAPI_DEF_IPV6_MREQ		0
+ #define __UAPI_DEF_IPPROTO_V6		0
+@@ -73,13 +64,13 @@
+ #define __UAPI_DEF_IN6_PKTINFO		0
+ #define __UAPI_DEF_IP6_MTUINFO		0
+ 
+-#else
++#else /* defined(_NETINET_IN_H) */
+ 
+ /* Linux headers included first, and we must define everything
+- * we need. The expectation is that glibc will check the
++ * we need. The expectation is that the libc will check the
+  * __UAPI_DEF_* defines and adjust appropriately. */
+ #define __UAPI_DEF_IN6_ADDR		1
+-/* We unconditionally define the in6_addr macros and glibc must
++/* We unconditionally define the in6_addr macros and libc must
+  * coordinate. */
+ #define __UAPI_DEF_IN6_ADDR_ALT		1
+ #define __UAPI_DEF_SOCKADDR_IN6		1
+@@ -101,7 +92,7 @@
+ /* If we did not see any headers from any supported C libraries,
+  * or we are being included in the kernel, then define everything
+  * that we need. */
+-#else /* !defined(__GLIBC__) */
++#else /* __KERNEL__ */
+ 
+ /* Definitions for in6.h */
+ #define __UAPI_DEF_IN6_ADDR		1
+@@ -116,6 +107,6 @@
+ /* Definitions for xattr.h */
+ #define __UAPI_DEF_XATTR		1
+ 
+-#endif /* __GLIBC__ */
++#endif /* __KERNEL__ */
+ 
+ #endif /* _UAPI_LIBC_COMPAT_H */
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
new file mode 100644
index 0000000..c617093
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
@@ -0,0 +1,59 @@
+From 75ba4a547282f91d653872a4bba5f5eae234ea6c Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Wed, 22 Jan 2014 00:57:48 +0100
+Subject: [PATCH 2/3] libc-compat.h: prevent redefinition of struct ethhdr
+
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/if_ether.h    | 4 +++-
+ include/uapi/linux/libc-compat.h | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
+index aa63ed0..e94da57 100644
+--- a/include/uapi/linux/if_ether.h
++++ b/include/uapi/linux/if_ether.h
+@@ -22,6 +22,7 @@
+ #define _UAPI_LINUX_IF_ETHER_H
+ 
+ #include <linux/types.h>
++#include <linux/libc-compat.h>
+ 
+ /*
+  *	IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
+@@ -134,11 +135,12 @@
+  *	This is an Ethernet frame header.
+  */
+ 
++#if __UAPI_DEF_ETHHDR
+ struct ethhdr {
+ 	unsigned char	h_dest[ETH_ALEN];	/* destination eth addr	*/
+ 	unsigned char	h_source[ETH_ALEN];	/* source ether addr	*/
+ 	__be16		h_proto;		/* packet type ID field	*/
+ } __attribute__((packed));
+-
++#endif
+ 
+ #endif /* _UAPI_LINUX_IF_ETHER_H */
+diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
+index afe15c2..7d0c78a 100644
+--- a/include/uapi/linux/libc-compat.h
++++ b/include/uapi/linux/libc-compat.h
+@@ -50,6 +50,12 @@
+ 
+ #ifndef __KERNEL__ /* we're used from userspace */
+ 
++#ifdef _NETINET_IF_ETHER_H /* musl */
++#define __UAPI_DEF_ETHHDR 0
++#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
++#define __UAPI_DEF_ETHHDR 1
++#endif
++
+ /* Coordinate with libc netinet/in.h header. */
+ #if defined(_NETINET_IN_H)
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
new file mode 100644
index 0000000..6d9e8d8
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
@@ -0,0 +1,32 @@
+From 8e69b663d6ddef132041a1186f081fdd74d4a31d Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg@gmx.net>
+Date: Mon, 20 Jan 2014 21:31:34 +0100
+Subject: [PATCH 3/3] remove inclusion of sysinfo.h in kernel.h
+
+the declaration of struct sysinfo clashes with userspace.
+it's not quite clear why that header was included from kernel.h,
+as none of its functionality is needed.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Submitted
+
+ include/uapi/linux/kernel.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
+index 321e399..e8ff821 100644
+--- a/include/uapi/linux/kernel.h
++++ b/include/uapi/linux/kernel.h
+@@ -1,7 +1,9 @@
+ #ifndef _UAPI_LINUX_KERNEL_H
+ #define _UAPI_LINUX_KERNEL_H
+ 
++#ifdef __GLIBC__
+ #include <linux/sysinfo.h>
++#endif
+ 
+ /*
+  * 'kernel.h' contains some often-used function prototypes etc
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
index 01037c1..6f2c427 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.1.bb
@@ -1,4 +1,9 @@
 require linux-libc-headers.inc
 
+SRC_URI_append_libc-musl = "\
+    file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \
+    file://0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch \
+    file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \
+   "
 SRC_URI[md5sum] = "fe9dc0f6729f36400ea81aa41d614c37"
 SRC_URI[sha256sum] = "caf51f085aac1e1cea4d00dbbf3093ead07b551fc07b31b2a989c05f8ea72d9f"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 10/53] xserver-xorg: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (8 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 09/53] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 11/53] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
                   ` (45 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

inb/outb are implemented for ARM on glibc but not on linux in general
therefore the conditional has to reflect that

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch  | 18 ++++++++++++++++++
 .../xorg-xserver/xserver-xorg_1.18.0.bb                |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch

diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
new file mode 100644
index 0000000..4be441f
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
@@ -0,0 +1,18 @@
+inb/outb family for arm is only implemented on glibc
+so assumption across linux is wrong
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: xorg-server-1.18.0/hw/xfree86/common/compiler.h
+===================================================================
+--- xorg-server-1.18.0.orig/hw/xfree86/common/compiler.h
++++ xorg-server-1.18.0/hw/xfree86/common/compiler.h
+@@ -758,7 +758,7 @@ inl(unsigned short port)
+     return xf86ReadMmio32Le((void *) ioBase, port);
+ }
+ 
+-#elif defined(__arm__) && defined(__linux__)
++#elif defined(__arm__) && defined(__GLIBC__)
+ 
+ /* for Linux on ARM, we use the LIBC inx/outx routines */
+ /* note that the appropriate setup via "ioperm" needs to be done */
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
index 60973c5..e606dac 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg_1.18.0.bb
@@ -1,6 +1,8 @@
 require xserver-xorg.inc
 
-SRC_URI += "file://configure.ac-Use-libsystemd-in-REQUIRED_LIBS-check.patch"
+SRC_URI += "file://configure.ac-Use-libsystemd-in-REQUIRED_LIBS-check.patch \
+            file://musl-arm-inb-outb.patch \
+           "
 SRC_URI[md5sum] = "3c1c1057d3ad27380d8dd87ffcc182cd"
 SRC_URI[sha256sum] = "195670819695d9cedd8dde95fbe069be0d0f488a77797a2d409f9f702daf312e"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 11/53] gdk-pixbuf: Fix latent build issue exposed by musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (9 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 10/53] xserver-xorg: Fix build with musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 12/53] argp-standalone: Add recipe Khem Raj
                   ` (44 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch      | 63 ++++++++++++++++++++++
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch

diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
new file mode 100644
index 0000000..82a27c3
--- /dev/null
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
@@ -0,0 +1,63 @@
+From 205a3b04e1216c1df199aec95185f7f48b8e0491 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 6 Oct 2015 09:11:38 +0200
+Subject: Run only pixbuf-lowmem test on GNU libc
+
+The test case depends on GNU libc specific internals so we only run it
+on GNU libc.
+
+This fixes build on Linux with musl libc.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=756078
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ tests/Makefile.am     | 5 -----
+ tests/pixbuf-lowmem.c | 8 ++++++++
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index bdd68f3..c122188 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -19,13 +19,8 @@ LDADD = \
+ noinst_PROGRAMS += 			\
+ 	pixbuf-read			\
+ 	pixbuf-random			\
+-	$(NULL)
+-
+-if OS_LINUX
+-noinst_PROGRAMS += 			\
+ 	pixbuf-lowmem			\
+ 	$(NULL)
+-endif
+ 
+ test_programs = 			\
+ 	animation			\
+diff --git a/tests/pixbuf-lowmem.c b/tests/pixbuf-lowmem.c
+index ae71788..9e9571f 100644
+--- a/tests/pixbuf-lowmem.c
++++ b/tests/pixbuf-lowmem.c
+@@ -24,6 +24,7 @@
+ #include <time.h>
+ #include <string.h>
+ 
++#ifdef __GLIBC__
+ #define PRETEND_MEM_SIZE (16 * 1024 * 1024)
+ #define REMAINING_MEM_SIZE 100000
+ 
+@@ -225,3 +226,10 @@ main (int argc, char **argv)
+   
+   return 0;
+ }
++#else
++int
++main (int argc, char **argv)
++{
++	return 0;
++}
++#endif
+-- 
+cgit v0.11.2
+
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
index 084fe36..104c743 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb
@@ -17,6 +17,7 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
            file://extending-libinstall-dependencies.patch \
            file://run-ptest \
            file://fatal-loader.patch \
+           file://libc_memfuncs.patch \
            "
 
 SRC_URI[md5sum] = "b1590189a2e89fab9f871959c168508c"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 12/53] argp-standalone: Add recipe
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (10 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 11/53] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 13/53] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
                   ` (43 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

This helps packages like gnutls to compile with musl
any package that needs glibc's implementation of argp
can link to this library

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../argp-standalone/argp-standalone_1.3.bb         | 28 ++++++++
 .../files/0001-throw-in-funcdef.patch              | 84 ++++++++++++++++++++++
 .../argp-standalone/files/0002-isprint.patch       | 51 +++++++++++++
 3 files changed, 163 insertions(+)
 create mode 100644 meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
 create mode 100644 meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
 create mode 100644 meta/recipes-support/argp-standalone/files/0002-isprint.patch

diff --git a/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
new file mode 100644
index 0000000..a5d20d3
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
@@ -0,0 +1,28 @@
+# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Glibc hierarchical argument parsing standalone library"
+HOMEPAGE = "http://www.lysator.liu.se/~nisse/misc/"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://argp.h;beginline=1;endline=20;md5=008b7e53dea6f9e1d9fdef0d9cf3184a"
+SECTION = "libs"
+
+SRC_URI = "http://www.lysator.liu.se/~nisse/misc/argp-standalone-${PV}.tar.gz \
+           file://0001-throw-in-funcdef.patch \
+           file://0002-isprint.patch \
+          "
+SRC_URI[md5sum] = "720704bac078d067111b32444e24ba69"
+SRC_URI[sha256sum] = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be"
+
+inherit autotools
+
+CFLAGS += "-fPIC -U__OPTIMIZE__"
+
+do_install() {
+	install -D -m 0644 ${B}/libargp.a ${D}${libdir}/libargp.a
+	install -D -m 0644 ${S}/argp.h ${D}${includedir}/argp.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
diff --git a/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
new file mode 100644
index 0000000..a6e2759
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
@@ -0,0 +1,84 @@
+# --- T2-COPYRIGHT-NOTE-BEGIN ---
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+# 
+# T2 SDE: package/.../rng-tools/throw-in-funcdef.patch.argp-standalone
+# Copyright (C) 2006 The T2 SDE Project
+# 
+# More information can be found in the files COPYING and README.
+# 
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# --- T2-COPYRIGHT-NOTE-END ---
+
+
+No __THROW in function implementation.
+	--jsaw
+
+Taken from buildroot
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- argp-standalone-1.4-test2/argp.h.orig	2006-01-06 02:29:59.000000000 +0100
++++ argp-standalone-1.4-test2/argp.h	2006-01-06 02:41:10.000000000 +0100
+@@ -560,17 +560,17 @@
+ # endif
+ 
+ # ifndef ARGP_EI
+-#  define ARGP_EI extern __inline__
++#  define ARGP_EI extern inline
+ # endif
+ 
+ ARGP_EI void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ ARGP_EI int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt)
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -582,7 +582,7 @@
+ }
+ 
+ ARGP_EI int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt)
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
+--- argp-standalone-1.4-test2/argp-parse.c.orig	2006-01-06 02:47:48.000000000 +0100
++++ argp-standalone-1.4-test2/argp-parse.c	2006-01-06 02:48:16.000000000 +0100
+@@ -1290,13 +1290,13 @@
+ /* Defined here, in case a user is not inlining the definitions in
+  * argp.h */
+ void
+-__argp_usage (__const struct argp_state *__state) __THROW
++__argp_usage (__const struct argp_state *__state)
+ {
+   __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+ }
+ 
+ int
+-__option_is_short (__const struct argp_option *__opt) __THROW
++__option_is_short (__const struct argp_option *__opt) 
+ {
+   if (__opt->flags & OPTION_DOC)
+     return 0;
+@@ -1310,7 +1310,7 @@
+ }
+ 
+ int
+-__option_is_end (__const struct argp_option *__opt) __THROW
++__option_is_end (__const struct argp_option *__opt) 
+ {
+   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+ }
diff --git a/meta/recipes-support/argp-standalone/files/0002-isprint.patch b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
new file mode 100644
index 0000000..1c07eea
--- /dev/null
+++ b/meta/recipes-support/argp-standalone/files/0002-isprint.patch
@@ -0,0 +1,51 @@
+Subject: restrict value range passed to isprint function
+
+According to C standards isprint argument shall be representable as an
+unsigned char or be equal to EOF, otherwise the behaviour is undefined.
+
+Passing arbitrary ints leads to segfault in nm program from elfutils.
+
+Restrict isprint argument range to values representable by unsigned char.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+
+Taken from buildroot
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+Index: b/argp.h
+===================================================================
+--- a/argp.h
++++ b/argp.h
+@@ -23,6 +23,7 @@
+ 
+ #include <stdio.h>
+ #include <ctype.h>
++#include <limits.h>
+ 
+ #define __need_error_t
+ #include <errno.h>
+@@ -577,7 +578,7 @@
+   else
+     {
+       int __key = __opt->key;
+-      return __key > 0 && isprint (__key);
++      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+     }
+ }
+ 
+Index: b/argp-parse.c
+===================================================================
+--- a/argp-parse.c
++++ b/argp-parse.c
+@@ -1292,7 +1292,7 @@
+       int __key = __opt->key;
+       /* FIXME: whether or not a particular key implies a short option
+        * ought not to be locale dependent. */
+-      return __key > 0 && isprint (__key);
++      return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+     }
+ }
+ 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 13/53] gnutls: Link with libargp on musl and depend on argp-standalone
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (11 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 12/53] argp-standalone: Add recipe Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 14/53] util-linux: Fix ptest builds on musl Khem Raj
                   ` (42 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/gnutls/gnutls.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-support/gnutls/gnutls.inc b/meta/recipes-support/gnutls/gnutls.inc
index c1ec120..5bcfc9c 100644
--- a/meta/recipes-support/gnutls/gnutls.inc
+++ b/meta/recipes-support/gnutls/gnutls.inc
@@ -2,6 +2,7 @@ SUMMARY = "GNU Transport Layer Security Library"
 HOMEPAGE = "http://www.gnu.org/software/gnutls/"
 BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
 DEPENDS = "nettle libidn"
+DEPENDS_append_libc-musl = " argp-standalone "
 
 LICENSE = "GPLv3+ & LGPLv2.1+"
 LICENSE_${PN} = "LGPLv2.1+"
@@ -28,6 +29,7 @@ EXTRA_OECONF="--disable-rpath \
               --without-p11-kit \
               --enable-openssl-compatibility \
               "
+LDFLAGS_append_libc-musl = " -largp "
 
 do_configure_prepend() {
 	for dir in . lib; do
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 14/53] util-linux: Fix ptest builds on musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (12 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 13/53] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 15/53] webkitgtk: Fix build with clang Khem Raj
                   ` (41 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

musl doesnt implement error() API, hence provide one

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../util-linux/uuid-test-error-api.patch           | 92 ++++++++++++++++++++++
 meta/recipes-core/util-linux/util-linux_2.27.1.bb  |  1 +
 2 files changed, 93 insertions(+)
 create mode 100644 meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch

diff --git a/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
new file mode 100644
index 0000000..1b0ff79
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
@@ -0,0 +1,92 @@
+This patch adds error() API implementation for non-glibc system C libs
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: util-linux-2.27.1/tests/helpers/test_uuidd.c
+===================================================================
+--- util-linux-2.27.1.orig/tests/helpers/test_uuidd.c
++++ util-linux-2.27.1/tests/helpers/test_uuidd.c
+@@ -23,7 +23,6 @@
+  *
+  *	make uuidd uuidgen localstatedir=/var
+  */
+-#include <error.h>
+ #include <libgen.h>
+ #include <pthread.h>
+ #include <stdio.h>
+@@ -39,6 +38,17 @@
+ #include "xalloc.h"
+ #include "strutils.h"
+ 
++#ifdef __GLIBC__
++#include <error.h>
++#else
++extern void (*error_print_progname)(void);
++extern unsigned int error_message_count;
++extern int error_one_per_line;
++
++void error(int, int, const char *, ...);
++void error_at_line(int, int, const char *, unsigned int, const char *, ...);
++#endif
++
+ #define LOG(level,args) if (loglev >= level) { fprintf args; }
+ 
+ size_t nprocesses = 4;
+@@ -257,6 +267,56 @@ static void object_dump(size_t idx, obje
+ 	fprintf(stderr, "}\n");
+ }
+ 
++#ifndef __GLIBC__
++extern char *__progname;
++
++void (*error_print_progname)(void) = 0;
++unsigned int error_message_count = 0;
++int error_one_per_line = 0;
++
++static void eprint(int status, int e, const char *file, unsigned int line, const char *fmt, va_list ap)
++{
++	if (file && error_one_per_line) {
++		static const char *oldfile;
++		static unsigned int oldline;
++		if (line == oldline && strcmp(file, oldfile) == 0)
++			return;
++		oldfile = file;
++		oldline = line;
++	}
++	if (error_print_progname)
++		error_print_progname();
++	else
++		fprintf(stderr, "%s: ", __progname);
++	if (file)
++		fprintf(stderr, "%s:%u: ", file, line);
++	vfprintf(stderr, fmt, ap);
++	if (e)
++		fprintf(stderr, ": %s", strerror(e));
++	putc('\n', stderr);
++	fflush(stderr);
++	error_message_count++;
++	if (status)
++		exit(status);
++}
++
++void error(int status, int e, const char *fmt, ...)
++{
++	va_list ap;
++	va_start(ap,fmt);
++	eprint(status, e, 0, 0, fmt, ap);
++	va_end(ap);
++}
++
++void error_at_line(int status, int e, const char *file, unsigned int line, const char *fmt, ...)
++{
++	va_list ap;
++	va_start(ap,fmt);
++	eprint(status, e, file, line, fmt, ap);
++	va_end(ap);
++}
++#endif /* __GLIBC__ */
++
+ int main(int argc, char *argv[])
+ {
+ 	size_t i, nfailed = 0, nignored = 0;
diff --git a/meta/recipes-core/util-linux/util-linux_2.27.1.bb b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
index 14a77ca..7549158 100644
--- a/meta/recipes-core/util-linux/util-linux_2.27.1.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
@@ -19,6 +19,7 @@ SRC_URI += "file://util-linux-ng-2.16-mount_lock_path.patch \
             file://avoid_unsupported_grep_opts.patch \
             file://display_testname_for_subtest.patch \
             file://avoid_parallel_tests.patch \
+            file://uuid-test-error-api.patch \
 "
 SRC_URI[md5sum] = "3cd2698d1363a2c64091c2dadc974647"
 SRC_URI[sha256sum] = "0a818fcdede99aec43ffe6ca5b5388bff80d162f2f7bd4541dca94fecb87a290"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 15/53] webkitgtk: Fix build with clang
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (13 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 14/53] util-linux: Fix ptest builds on musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 16/53] elfutils: Fix build with uclibc Khem Raj
                   ` (40 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

backtrace is glibc only feature on linux so check for glibc before using
it
Clangs clear_cache has different signature than gcc provided builtin
make it compatible for both

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...nable-backtrace-on-linux-when-using-glibc.patch | 39 ++++++++++++++++++++++
 meta/recipes-sato/webkit/webkitgtk/clang.patch     | 25 ++++++++++++++
 meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |  2 ++
 3 files changed, 66 insertions(+)
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/clang.patch

diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
new file mode 100644
index 0000000..146087b
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
@@ -0,0 +1,39 @@
+From 0b68ad206d2d90df78d91cad4da19152084014cf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Sep 2015 05:15:04 +0000
+Subject: [PATCH] Enable backtrace on linux when using glibc
+
+We dont have backtrace() implemented on non-glibc libc's on linux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ Source/WTF/wtf/Assertions.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp
+index 191d53f..a4d86b5 100644
+--- a/Source/WTF/wtf/Assertions.cpp
++++ b/Source/WTF/wtf/Assertions.cpp
+@@ -68,7 +68,7 @@
+ #include <unistd.h>
+ #endif
+ 
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+ #include <cxxabi.h>
+ #include <dlfcn.h>
+ #include <execinfo.h>
+@@ -225,7 +225,7 @@ void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f
+ 
+ void WTFGetBacktrace(void** stack, int* size)
+ {
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+     *size = backtrace(stack, *size);
+ #elif OS(WINDOWS)
+     // The CaptureStackBackTrace function is available in XP, but it is not defined
+-- 
+2.5.2
+
diff --git a/meta/recipes-sato/webkit/webkitgtk/clang.patch b/meta/recipes-sato/webkit/webkitgtk/clang.patch
new file mode 100644
index 0000000..ef77755
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/clang.patch
@@ -0,0 +1,25 @@
+Clang's builtin for clear_cache accepts char* and errors out when using void*,
+using char* work on both gcc and clang since char* is auto-converted to void* in gcc case
+
+Source/JavaScriptCore/assembler/ARM64Assembler.h:2857:33: error: cannot initialize a parameter of type 'char *' with an rvalue of type 'void *'
+        __builtin___clear_cache(reinterpret_cast<void*>(begin), reinterpret_cast<void*>(end));
+                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1 error generated.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+
+Index: webkitgtk-2.8.5/Source/JavaScriptCore/assembler/ARM64Assembler.h
+===================================================================
+--- webkitgtk-2.8.5.orig/Source/JavaScriptCore/assembler/ARM64Assembler.h
++++ webkitgtk-2.8.5/Source/JavaScriptCore/assembler/ARM64Assembler.h
+@@ -2854,7 +2854,7 @@ public:
+ #if OS(LINUX) && COMPILER(GCC)
+     static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
+     {
+-        __builtin___clear_cache(reinterpret_cast<void*>(begin), reinterpret_cast<void*>(end));
++        __builtin___clear_cache(reinterpret_cast<char*>(begin), reinterpret_cast<char*>(end));
+     }
+ #endif
+ 
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
index 4d5aeb4..f5add32 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
@@ -12,6 +12,8 @@ LIC_FILES_CHKSUM = "file://Source/JavaScriptCore/COPYING.LIB;md5=d0c6d6397a5d842
 
 SRC_URI = "\
   http://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
+  file://clang.patch \
+  file://0001-Enable-backtrace-on-linux-when-using-glibc.patch \
   "
 SRC_URI[md5sum] = "fb010031c6f61c3a1a00793b112badb5"
 SRC_URI[sha256sum] = "dbf8260da5cac0c74de2d3cce1fe7c519da3cd816a2c769cb6c6d56addd2f055"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 16/53] elfutils: Fix build with uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (14 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 15/53] webkitgtk: Fix build with clang Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 17/53] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
                   ` (39 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Remove mempcpy patch its already in uclibc now
refresh libargp patch to match latest elfutils

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../uclibc-support-for-elfutils-0.161.patch        | 79 ++++++++++++++--------
 .../elfutils/elfutils/mempcpy.patch                | 24 -------
 meta/recipes-devtools/elfutils/elfutils_0.148.bb   |  1 -
 meta/recipes-devtools/elfutils/elfutils_0.163.bb   |  3 +-
 4 files changed, 52 insertions(+), 55 deletions(-)
 delete mode 100644 meta/recipes-devtools/elfutils/elfutils/mempcpy.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils-0.163/uclibc-support-for-elfutils-0.161.patch b/meta/recipes-devtools/elfutils/elfutils-0.163/uclibc-support-for-elfutils-0.161.patch
index f1533bf..7167965 100644
--- a/meta/recipes-devtools/elfutils/elfutils-0.163/uclibc-support-for-elfutils-0.161.patch
+++ b/meta/recipes-devtools/elfutils/elfutils-0.163/uclibc-support-for-elfutils-0.161.patch
@@ -25,11 +25,11 @@ Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
  libelf/Makefile.am | 5 +++++
  4 files changed, 23 insertions(+), 1 deletion(-)
 
-diff --git a/configure.ac b/configure.ac
-index a1ad6db..81fc33f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -70,6 +70,14 @@ AS_IF([test "$use_locks" = yes],
+Index: elfutils-0.163/configure.ac
+===================================================================
+--- elfutils-0.163.orig/configure.ac
++++ elfutils-0.163/configure.ac
+@@ -64,6 +64,14 @@ AS_IF([test "$use_locks" = yes],
  
  AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
  
@@ -44,63 +44,86 @@ index a1ad6db..81fc33f 100644
  AC_PROG_CC
  AC_PROG_RANLIB
  AC_PROG_YACC
-diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am
-index 3beccf3..9ba6c04 100644
---- a/libcpu/Makefile.am
-+++ b/libcpu/Makefile.am
-@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
+@@ -346,18 +354,13 @@ AC_LINK_IFELSE(
+ )
+ 
+ dnl If our libc doesn't provide argp, then test for libargp
+-if test "$libc_has_argp" = "false" ; then
+-	AC_MSG_WARN("libc does not have argp")
+-	AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
+-
+-	if test "$have_argp" = "false"; then
+-		AC_MSG_ERROR("no libargp found")
+-	else
+-		argp_LDADD="-largp"
+-	fi
+-else
+-	argp_LDADD=""
+-fi
++AS_IF([test "x$libc_has_argp" = "xfalse"],
++	[AC_MSG_WARN("libc does not have argp")
++	AC_CHECK_LIB([argp], [argp_parse], [have_argp="true" argp_LDADD="-largp"], [have_argp="false"])], [argp_LDADD=""])
++
++AS_IF([test "x$libc_has_argp" = "xfalse" -a "x$have_argp" = "xfalse"],
++	AC_CHECK_LIB([uargp], [argp_parse], [have_uargp="true" argp_LDADD="-luargp"], [have_uargp="false"])], [argp_LDADD=""])
++
+ AC_SUBST([argp_LDADD])
+ 
+ dnl The directories with content.
+Index: elfutils-0.163/libcpu/Makefile.am
+===================================================================
+--- elfutils-0.163.orig/libcpu/Makefile.am
++++ elfutils-0.163/libcpu/Makefile.am
+@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i3
  i386_lex.o: i386_parse.h
  i386_gendis_LDADD = $(libeu) -lm
  
 +if USE_UCLIBC
-+i386_gendis_LDADD += -luargp -lintl
++i386_gendis_LDADD += -lintl
 +endif
 +
  i386_parse.h: i386_parse.c ;
  
  EXTRA_DIST = defs/i386
-diff --git a/libdw/Makefile.am b/libdw/Makefile.am
-index 887da6b..d31b428 100644
---- a/libdw/Makefile.am
-+++ b/libdw/Makefile.am
+Index: elfutils-0.163/libdw/Makefile.am
+===================================================================
+--- elfutils-0.163.orig/libdw/Makefile.am
++++ elfutils-0.163/libdw/Makefile.am
 @@ -102,6 +102,11 @@ endif
  libdw_pic_a_SOURCES =
  am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
  
 +libdw_so_LDLIBS =
 +if USE_UCLIBC
-+libdw_so_LDLIBS += -lintl -luargp
++libdw_so_LDLIBS += -lintl
 +endif
 +
  libdw_so_SOURCES =
  libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
  	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
-@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
+@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
  		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
  		-Wl,--version-script,$<,--no-undefined \
  		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
--		-ldl $(zip_LIBS)
-+		-ldl $(zip_LIBS) $(libdw_so_LDLIBS)
+-		-ldl $(argp_LDADD) $(zip_LIBS)
++		-ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
  	@$(textrel_check)
  	ln -fs $@ $@.$(VERSION)
  
-diff --git a/libelf/Makefile.am b/libelf/Makefile.am
-index afcb2aa..02836a1 100644
---- a/libelf/Makefile.am
-+++ b/libelf/Makefile.am
-@@ -93,7 +93,12 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
+Index: elfutils-0.163/libelf/Makefile.am
+===================================================================
+--- elfutils-0.163.orig/libelf/Makefile.am
++++ elfutils-0.163/libelf/Makefile.am
+@@ -93,7 +93,12 @@ libelf_a_SOURCES = elf_version.c elf_has
  libelf_pic_a_SOURCES =
  am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
  
 +
  libelf_so_LDLIBS =
 +if USE_UCLIBC
-+libelf_so_LDLIBS += -lintl -luargp
++libelf_so_LDLIBS += -lintl
 +endif
 +
  if USE_LOCKS
  libelf_so_LDLIBS += -lpthread
  endif
--- 
-1.8.3.4
-
diff --git a/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch b/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
deleted file mode 100644
index 24e31fa..0000000
--- a/meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-
-uclibc does not export __mempcpy like glibc so we alias it here.
-This patch may make sense for upstream but elfutils uses more
-glibc specific features like obstack_printf which are missing in
-uclibc they need to be fixed along to make it work all the way
-
-Upstream-Status: Inappropriate[Elfutils uses more glibc specific features]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Index: elfutils-0.148/libelf/elf_begin.c
-===================================================================
---- elfutils-0.148.orig/libelf/elf_begin.c
-+++ elfutils-0.148/libelf/elf_begin.c
-@@ -68,6 +68,9 @@
- #include "libelfP.h"
- #include "common.h"
- 
-+#ifdef __UCLIBC__
-+#define __mempcpy mempcpy
-+#endif
- 
- /* Create descriptor for archive in memory.  */
- static inline Elf *
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
index 0d8490d..ff53257 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -27,7 +27,6 @@ SRC_URI += "\
         file://elf_additions.diff \
         file://elfutils-fsize.patch \
         file://remove-unused.patch \
-        file://mempcpy.patch \
         file://fix_for_gcc-4.7.patch \
         file://dso-link-change.patch \
         file://nm-Fix-size-passed-to-snprintf-for-invalid-sh_name-case.patch \
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.163.bb b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
index e391813..41bfbdc 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.163.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
@@ -11,7 +11,6 @@ SRC_URI[md5sum] = "77ce87f259987d2e54e4d87b86cbee41"
 SRC_URI[sha256sum] = "7c774f1eef329309f3b05e730bdac50013155d437518a2ec0e24871d312f2e23"
 
 SRC_URI += "\
-        file://mempcpy.patch \
         file://dso-link-change.patch \
         file://Fix_elf_cvt_gunhash.patch \
         file://fixheadercheck.patch \
@@ -51,7 +50,7 @@ EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"
 
 do_install_append() {
 	if [ "${TARGET_ARCH}" != "x86_64" ] && [ -z `echo "${TARGET_ARCH}"|grep 'i.86'` ];then
-		rm ${D}${bindir}/eu-objdump
+		rm -f ${D}${bindir}/eu-objdump
 	fi
 }
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 17/53] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (15 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 16/53] elfutils: Fix build with uclibc Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 18/53] guile: Fix build with uclibc Khem Raj
                   ` (38 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

This package is not provided by non-glibc libcs therefore add it only
when libc is glibc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/packagegroups/packagegroup-self-hosted.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
index d38be26..bb8371e 100644
--- a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -67,7 +67,6 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
     cpp \
     cpp-symlinks \
     distcc \
-    glibc-gconv-ibm850 \
     file \
     findutils \
     g++ \
@@ -93,6 +92,7 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
     "
 # glibc-utils: for rpcgen
 RDEPENDS_packagegroup-self-hosted-sdk_append_libc-glibc = "\
+    glibc-gconv-ibm850 \
     glibc-utils \
     "
 RDEPENDS_packagegroup-self-hosted-debug = " \
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 18/53] guile: Fix build with uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (16 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 17/53] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 19/53] gnutls: Link with libuargp on uclibc Khem Raj
                   ` (37 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../guile/files/remove_strcase_l_funcs.patch       | 38 ++++++++++++++++++++++
 meta/recipes-devtools/guile/guile_2.0.11.bb        |  3 +-
 2 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch

diff --git a/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch b/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
new file mode 100644
index 0000000..e7a06fe
--- /dev/null
+++ b/meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
@@ -0,0 +1,38 @@
+These unused functions cause build failures with uclibc since they reference __uclibc_locale_struct
+and this is exposed by uclibc API headers only if C locales are built, but for OE we build full locale
+support
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+Index: guile-2.0.11/libguile/i18n.c
+===================================================================
+--- guile-2.0.11.orig/libguile/i18n.c
++++ guile-2.0.11/libguile/i18n.c
+@@ -851,27 +851,6 @@ str_downcase (register char *dst, regist
+   *dst = '\0';
+ }
+ 
+-#ifdef USE_GNU_LOCALE_API
+-static inline void
+-str_upcase_l (register char *dst, register const char *src,
+-	      scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = toupper_l (*src, locale);
+-  *dst = '\0';
+-}
+-
+-static inline void
+-str_downcase_l (register char *dst, register const char *src,
+-		scm_t_locale locale)
+-{
+-  for (; *src != '\0'; src++, dst++)
+-    *dst = tolower_l (*src, locale);
+-  *dst = '\0';
+-}
+-#endif
+-
+-
+ SCM_DEFINE (scm_string_locale_lt, "string-locale<?", 2, 1, 0,
+ 	    (SCM s1, SCM s2, SCM locale),
+ 	    "Compare strings @var{s1} and @var{s2} in a locale-dependent way."
diff --git a/meta/recipes-devtools/guile/guile_2.0.11.bb b/meta/recipes-devtools/guile/guile_2.0.11.bb
index fa45008..413c81d 100644
--- a/meta/recipes-devtools/guile/guile_2.0.11.bb
+++ b/meta/recipes-devtools/guile/guile_2.0.11.bb
@@ -23,6 +23,7 @@ SRC_URI = "${GNU_MIRROR}/guile/guile-${PV}.tar.xz \
            file://workaround-ice-ssa-corruption.patch \
            file://libguile-Makefile.am-hook.patch \
            file://libguile-VM-ASM_MUL-for-ARM-Add-earlyclobber.patch \
+           file://remove_strcase_l_funcs.patch \
            "
 
 #           file://debian/0001-Change-guile-to-guile-X.Y-for-info-pages.patch
@@ -50,7 +51,7 @@ EXTRA_OECONF += "${@['--without-libltdl-prefix --without-libgmp-prefix --without
 EXTRA_OECONF_append_class-target = " --with-libunistring-prefix=${STAGING_LIBDIR} \
                                      --with-libgmp-prefix=${STAGING_LIBDIR} \
                                      --with-libltdl-prefix=${STAGING_LIBDIR}"
-
+EXTRA_OECONF_append_libc-uclibc = " guile_cv_use_csqrt=no "
 do_configure_prepend() {
 	mkdir -p po
 }
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 19/53] gnutls: Link with libuargp on uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (17 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 18/53] guile: Fix build with uclibc Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 20/53] mtools: Fix build with uclibc Khem Raj
                   ` (36 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

uclibc has its own implementation for libargp

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-support/gnutls/gnutls.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-support/gnutls/gnutls.inc b/meta/recipes-support/gnutls/gnutls.inc
index 5bcfc9c..90597db 100644
--- a/meta/recipes-support/gnutls/gnutls.inc
+++ b/meta/recipes-support/gnutls/gnutls.inc
@@ -1,7 +1,7 @@
 SUMMARY = "GNU Transport Layer Security Library"
 HOMEPAGE = "http://www.gnu.org/software/gnutls/"
 BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
-DEPENDS = "nettle libidn"
+DEPENDS = "nettle libidn virtual/libiconv"
 DEPENDS_append_libc-musl = " argp-standalone "
 
 LICENSE = "GPLv3+ & LGPLv2.1+"
@@ -30,6 +30,7 @@ EXTRA_OECONF="--disable-rpath \
               --enable-openssl-compatibility \
               "
 LDFLAGS_append_libc-musl = " -largp "
+LDFLAGS_append_libc-uclibc = " -luargp "
 
 do_configure_prepend() {
 	for dir in . lib; do
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 20/53] mtools: Fix build with uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (18 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 19/53] gnutls: Link with libuargp on uclibc Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 16:17   ` Burton, Ross
  2016-01-08 10:18 ` [PATCH 21/53] parted: " Khem Raj
                   ` (35 subsequent siblings)
  55 siblings, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

unlike glibc, uclibc does not have internal APIs implemented for
libiconv, so it needs to depend upon libiconv

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/mtools/mtools_4.0.18.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-devtools/mtools/mtools_4.0.18.bb b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
index bc9b79c..479fd32 100644
--- a/meta/recipes-devtools/mtools/mtools_4.0.18.bb
+++ b/meta/recipes-devtools/mtools/mtools_4.0.18.bb
@@ -5,6 +5,7 @@ SECTION = "optional"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
+DEPENDS += "virtual/libiconv"
 
 RDEPENDS_${PN}_libc-glibc = "glibc-gconv-ibm850"
 RRECOMMENDS_${PN}_libc-glibc = "\
@@ -35,6 +36,8 @@ inherit autotools texinfo
 
 EXTRA_OECONF = "--without-x"
 
+LDFLAGS_append_libc-uclibc = " -liconv "
+
 BBCLASSEXTEND = "native nativesdk"
 
 PACKAGECONFIG ??= ""
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 21/53] parted: Fix build with uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (19 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 20/53] mtools: Fix build with uclibc Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 22/53] net-tools: Link with libintl on uclibc Khem Raj
                   ` (34 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

unlike glibc, uclibc does not have internal APIs implemented for
libiconv, so it needs to depend upon libiconv

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/parted/parted_3.2.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-extended/parted/parted_3.2.bb b/meta/recipes-extended/parted/parted_3.2.bb
index ff8ae09..30c00c8 100644
--- a/meta/recipes-extended/parted/parted_3.2.bb
+++ b/meta/recipes-extended/parted/parted_3.2.bb
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.gnu.org/software/parted/parted.html"
 LICENSE = "GPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2f31b266d3440dd7ee50f92cf67d8e6c"
 SECTION = "console/tools"
-DEPENDS = "ncurses readline util-linux"
+DEPENDS = "ncurses readline util-linux virtual/libiconv"
 PR = "r1"
 
 SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.xz \
@@ -21,6 +21,7 @@ SRC_URI[md5sum] = "0247b6a7b314f8edeb618159fa95f9cb"
 SRC_URI[sha256sum] = "858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4"
 
 EXTRA_OECONF = "--disable-device-mapper"
+LDFLAGS_append_libc-uclibc = " -liconv "
 
 inherit autotools pkgconfig gettext texinfo ptest
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 22/53] net-tools: Link with libintl on uclibc
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (20 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 21/53] parted: " Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 23/53] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
                   ` (33 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

libintl is needed explicitly on linker cmdline on uclibc since the APIs
are not in libc itelf.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/net-tools/net-tools_1.60-26.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
index 923d048..04ea76f 100644
--- a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
+++ b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
@@ -30,7 +30,7 @@ SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e4
 UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/"
 
 inherit gettext
-
+LDFLAGS_append_libc-uclibc = " -lintl "
 # The Makefile is lame, no parallel build
 PARALLEL_MAKE = ""
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 23/53] libdrm: Upgrade 2.4.65 -> 2.4.66
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (21 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 22/53] net-tools: Link with libintl on uclibc Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 24/53] directfb: Fix build with musl Khem Raj
                   ` (32 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Fix test build failures

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...tests-kms-steal-crtc-Include-sys-select.h.patch | 33 ++++++++++++++++++++++
 .../recipes-graphics/drm/libdrm/installtests.patch | 24 +++++-----------
 .../drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb}     |  8 ++++--
 3 files changed, 45 insertions(+), 20 deletions(-)
 create mode 100644 meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
 rename meta/recipes-graphics/drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb} (86%)

diff --git a/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch b/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
new file mode 100644
index 0000000..c18228e
--- /dev/null
+++ b/meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
@@ -0,0 +1,33 @@
+From 46fb5516fb0ab17bcf46a0306a11e8966bb36e14 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 29 Dec 2015 22:17:21 +0000
+Subject: [PATCH] tests/kms-steal-crtc: Include sys/select.h
+
+Fixes errors e.g.
+
+error: implicit declaration of function 'select'
+
+and missing definitions of FD_* defines
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ tests/kms/kms-steal-crtc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c
+index 2f7f327..24d70ab 100644
+--- a/tests/kms/kms-steal-crtc.c
++++ b/tests/kms/kms-steal-crtc.c
+@@ -31,6 +31,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <sys/select.h>
+ 
+ #include <drm_fourcc.h>
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-graphics/drm/libdrm/installtests.patch b/meta/recipes-graphics/drm/libdrm/installtests.patch
index f460ef5..30e0a61 100644
--- a/meta/recipes-graphics/drm/libdrm/installtests.patch
+++ b/meta/recipes-graphics/drm/libdrm/installtests.patch
@@ -4,22 +4,12 @@ Upstream-Status: Inappropriate [configuration]
 
 Signed-off-by: Yu Ke <ke.yu@intel.com>
 
-Index: libdrm-2.4.65/tests/Makefile.am
+Index: libdrm-2.4.66/tests/Makefile.am
 ===================================================================
---- libdrm-2.4.65.orig/tests/Makefile.am
-+++ libdrm-2.4.65/tests/Makefile.am
-@@ -29,9 +29,11 @@ AM_CFLAGS = \
- 
- LDADD = $(top_builddir)/libdrm.la
- 
--check_PROGRAMS = \
--	dristat \
--	drmstat
-+bin_PROGRAMS = \
-+        dristat \
-+        drmstat
-+ 
-+check_PROGRAMS =
- 
- dristat_LDADD = -lm
+--- libdrm-2.4.66.orig/tests/Makefile.am
++++ libdrm-2.4.66/tests/Makefile.am
+@@ -73,3 +73,4 @@ TESTS +=					\
+ endif
  
+ check_PROGRAMS += $(TESTS)
++bin_PROGRAMS = $(check_PROGRAMS)
diff --git a/meta/recipes-graphics/drm/libdrm_2.4.65.bb b/meta/recipes-graphics/drm/libdrm_2.4.66.bb
similarity index 86%
rename from meta/recipes-graphics/drm/libdrm_2.4.65.bb
rename to meta/recipes-graphics/drm/libdrm_2.4.66.bb
index e5ed260..214dccc 100644
--- a/meta/recipes-graphics/drm/libdrm_2.4.65.bb
+++ b/meta/recipes-graphics/drm/libdrm_2.4.66.bb
@@ -11,10 +11,12 @@ PROVIDES = "drm"
 DEPENDS = "libpthread-stubs udev libpciaccess"
 
 SRC_URI = "http://dri.freedesktop.org/libdrm/${BP}.tar.bz2 \
-           file://installtests.patch "
+           file://installtests.patch \
+           file://0001-tests-kms-steal-crtc-Include-sys-select.h.patch \
+          "
 
-SRC_URI[md5sum] = "de49916e5f8aef4eba55223c79709b05"
-SRC_URI[sha256sum] = "71960ac8bde7d710992b1bc8879935e8300a870c36bd06f22412d0447e3d96c4"
+SRC_URI[md5sum] = "c6809c48538d6e5999588832045ff014"
+SRC_URI[sha256sum] = "79cb8e988749794edfb2d777b298d5292eff353bbbb71ed813589e61d2bc2d76"
 
 inherit autotools pkgconfig
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 24/53] directfb: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (22 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 23/53] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-09  3:27   ` Andre McCurdy
  2016-01-08 10:18 ` [PATCH 25/53] gzip: " Khem Raj
                   ` (31 subsequent siblings)
  55 siblings, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

compar_fn_t, sigval_t and non-posix recursive mutexes
are not available in musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-graphics/directfb/directfb.inc        |  5 ++
 .../directfb/directfb/compar_fn_t.patch            | 62 ++++++++++++++++++++++
 .../directfb/directfb/union-sigval.patch           | 19 +++++++
 .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     | 19 +++++++
 4 files changed, 105 insertions(+)
 create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch

diff --git a/meta/recipes-graphics/directfb/directfb.inc b/meta/recipes-graphics/directfb/directfb.inc
index 603aba3..3a79a8f 100644
--- a/meta/recipes-graphics/directfb/directfb.inc
+++ b/meta/recipes-graphics/directfb/directfb.inc
@@ -16,7 +16,12 @@ SRC_URI = "http://www.directfb.org/downloads/Core/DirectFB-1.7/DirectFB-${PV}.ta
            file://fusion.patch \
            file://bashism.patch \
            file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \
+           file://compar_fn_t.patch \
           "
+SRC_URI_append_libc-musl = "\
+                            file://union-sigval.patch \
+                            file://use-PTHREAD_MUTEX_RECURSIVE.patch \
+                           "
 
 S = "${WORKDIR}/DirectFB-${PV}"
 
diff --git a/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
new file mode 100644
index 0000000..ee4d900
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
@@ -0,0 +1,62 @@
+test for __compar_fn_t and if not defined by libc then define it
+help make directfb compile with musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: DirectFB-1.7.7/configure.in
+===================================================================
+--- DirectFB-1.7.7.orig/configure.in
++++ DirectFB-1.7.7/configure.in
+@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ AC_CHECK_FUNCS(fork)
+ 
++AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
++    AC_TRY_COMPILE(
++        [#include <stdlib.h>],
++        [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
++        ccache_cv_COMPAR_FN_T=yes,
++        ccache_cv_COMPAR_FN_T=no)])
++if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
++   AC_DEFINE(HAVE_COMPAR_FN_T, 1,
++             Define to 1 if you have the `__compar_fn_t' typedef.)
++fi
++
+ AC_PATH_PROGS(PERL, perl5 perl)
+ 
+ AC_PATH_PROG(MAN2HTML, man2html, no)
+Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+===================================================================
+--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c
++++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+@@ -59,6 +59,11 @@
+ 
+ #include <core/input_driver.h>
+ 
++#if HAVE_COMPAR_FN_T
++#define COMPAR_FN_T __compar_fn_t
++#else
++typedef int (*COMPAR_FN_T)(const void *, const void *);
++#endif
+ 
+ DFB_INPUT_DRIVER( lirc )
+ 
+@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+           qsort ( keynames,
+                   D_ARRAY_SIZE( keynames ),
+                   sizeof(keynames[0]),
+-                  (__compar_fn_t) keynames_sort_compare );
++                  (COMPAR_FN_T) keynames_sort_compare );
+           keynames_sorted = true;
+      }
+ 
+@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+                symbol_name = bsearch( name, keynames,
+                                       D_ARRAY_SIZE( keynames ),
+                                       sizeof(keynames[0]),
+-                                      (__compar_fn_t) keynames_compare );
++                                      (COMPAR_FN_T) keynames_compare );
+                if (symbol_name)
+                     return symbol_name->symbol;
+                break;
diff --git a/meta/recipes-graphics/directfb/directfb/union-sigval.patch b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
new file mode 100644
index 0000000..29f45c7
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
@@ -0,0 +1,19 @@
+This patch is taken from gentoo musl overlay
+sigval_t is glibc only construct, we use a union of sigval
+which pretty much is same effect as sigval_t
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c
+--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c	2014-07-15 02:54:58.000000000 -0400
++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c	2015-07-18 16:55:35.077989166 -0400
+@@ -111,7 +111,7 @@
+ void
+ direct_trap( const char *domain, int sig )
+ {
+-     sigval_t val;
++     union sigval val;
+ 
+      if (direct_config->delay_trap_ms) {
+           D_LOG( Direct_Trap, VERBOSE, "NOT RAISING signal %d from %s, waiting for %dms... attach gdb --pid=%d\n", sig, domain, direct_config->delay_trap_ms, getpid() );
diff --git a/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
new file mode 100644
index 0000000..e65f59e
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
@@ -0,0 +1,19 @@
+This patch is taken from gentoo musl overlay
+uses recursive mutex directly instead of non-posix version
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h
+--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h	2013-12-18 19:16:24.000000000 -0500
++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h	2015-07-18 16:57:47.178982835 -0400
+@@ -46,7 +46,7 @@
+ /**********************************************************************************************************************/
+ 
+ #define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
+-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
++#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_MUTEX_RECURSIVE }
+ 
+ #endif
+ 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 25/53] gzip: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (23 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 24/53] directfb: Fix build with musl Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 26/53] watchdog: " Khem Raj
                   ` (30 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

gzip 1.6 uses an older version of gnulib when cross compiling it treats
fseeko as broken since it cant do runtime checks for it during configure
this only shows up on musl since for glibc since it has special check
for gnu c library, so we aid the system by telling it that fflush on
stdin works well with musl

Use NO_ASM to avoid textrels

Delete charset.alias for musl which is again another issue in gnulib not
knowing musl platform

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/gzip/gzip.inc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/recipes-extended/gzip/gzip.inc b/meta/recipes-extended/gzip/gzip.inc
index 58e5e0c..6e81883 100644
--- a/meta/recipes-extended/gzip/gzip.inc
+++ b/meta/recipes-extended/gzip/gzip.inc
@@ -6,8 +6,10 @@ SECTION = "console/utils"
 # change to GPLv3+ in 2007/07. Previous GPLv2 version is 1.3.12
 
 inherit autotools texinfo
+export DEFS="NO_ASM"
 
 EXTRA_OEMAKE_class-target = "GREP=${base_bindir}/grep"
+EXTRA_OECONF_append_libc-musl = " gl_cv_func_fflush_stdin=yes "
 
 do_install_append () {
 	if [ "${base_bindir}" != "${bindir}" ]; then
@@ -20,6 +22,11 @@ do_install_append () {
 	fi
 }
 
+do_install_append_libc-musl () {
+	rm ${D}${libdir}/charset.alias
+	rmdir ${D}${libdir}
+}
+
 inherit update-alternatives
 
 ALTERNATIVE_PRIORITY = "100"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 26/53] watchdog: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (24 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 25/53] gzip: " Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 27/53] xinetd: " Khem Raj
                   ` (29 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

This patch is generic but is found during compiling watchdog with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...d-issues-found-with-non-glibc-C-libraries.patch | 99 ++++++++++++++++++++++
 meta/recipes-extended/watchdog/watchdog_5.14.bb    |  8 +-
 2 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch

diff --git a/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch b/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
new file mode 100644
index 0000000..8afed5c
--- /dev/null
+++ b/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
@@ -0,0 +1,99 @@
+From 83ec34df357218a1c9cfc13a23d3367d333652c3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 01:01:15 +0000
+Subject: [PATCH] Fix build issues found with non glibc C libraries
+
+Add time.h for getting time_t definition
+limits.h for PATH_MAX
+linux/param.h for EXEC_PAGESIZE
+Replace deprecated MNTTAB with _PATH_MNTTAB
+include ext2_mnt.h for MNTOPT_USRQUOTA and MNTOPT_GRPQUOTA and
+MNTTYPE_EXT2
+Include sys/types.h for u_char definition
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+
+Upstream-Status: Submitted
+
+ include/extern.h | 1 +
+ src/configfile.c | 1 +
+ src/memory.c     | 3 +++
+ src/net.c        | 1 +
+ src/shutdown.c   | 3 ++-
+ 5 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/include/extern.h b/include/extern.h
+index 21db11b..04b16bc 100644
+--- a/include/extern.h
++++ b/include/extern.h
+@@ -3,6 +3,7 @@
+ 
+ #include <netinet/in.h>
+ #include <stdio.h>
++#include <time.h>
+ 
+ #include "logmessage.h"
+ #include "xmalloc.h"
+diff --git a/src/configfile.c b/src/configfile.c
+index be5d7b3..7c1d1dd 100644
+--- a/src/configfile.c
++++ b/src/configfile.c
+@@ -16,6 +16,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <limits.h>
+ #include <sys/stat.h>
+ 
+ #include "extern.h"
+diff --git a/src/memory.c b/src/memory.c
+index e9607e4..b5e08aa 100644
+--- a/src/memory.c
++++ b/src/memory.c
+@@ -21,6 +21,9 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/mman.h>
++#ifdef __linux__
++#include <linux/param.h>
++#endif
+ 
+ #include "extern.h"
+ #include "watch_err.h"
+diff --git a/src/net.c b/src/net.c
+index 21823ae..8930caf 100644
+--- a/src/net.c
++++ b/src/net.c
+@@ -17,6 +17,7 @@
+ #include <string.h>
+ #include <unistd.h>		/* for gethostname() etc */
+ #include <netdb.h>		/* for gethostbyname() */
++#include <sys/types.h>
+ #include <sys/param.h>	/* for MAXHOSTNAMELEN */
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+diff --git a/src/shutdown.c b/src/shutdown.c
+index 74aafa5..46b99cf 100644
+--- a/src/shutdown.c
++++ b/src/shutdown.c
+@@ -25,6 +25,7 @@
+ 
+ #include "watch_err.h"
+ #include "extern.h"
++#include "ext2_mnt.h"
+ 
+ #if defined __GLIBC__
+ #include "ext2_mnt.h"
+@@ -123,7 +124,7 @@ static void mnt_off()
+ 	FILE *fp;
+ 	struct mntent *mnt;
+ 
+-	fp = setmntent(MNTTAB, "r");
++	fp = setmntent(_PATH_MNTTAB, "r");
+ 	/* in some rare cases fp might be NULL so be careful */
+ 	while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *)0)) {
+ 		/* First check if swap */
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/watchdog/watchdog_5.14.bb b/meta/recipes-extended/watchdog/watchdog_5.14.bb
index 9cb89d5..fc717bc 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.14.bb
+++ b/meta/recipes-extended/watchdog/watchdog_5.14.bb
@@ -12,7 +12,9 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://fixsepbuild.patch \
 	   file://fix-ping-failure.patch \
 	   file://watchdog-init.patch \
-	   file://watchdog-conf.patch"
+	   file://watchdog-conf.patch \
+	   file://0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch \
+"
 
 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
 SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1"
@@ -23,6 +25,10 @@ UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"
 inherit autotools
 inherit update-rc.d
 
+DEPENDS_append_libc-musl = " libtirpc "
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
+
 INITSCRIPT_NAME = "watchdog.sh"
 INITSCRIPT_PARAMS = "start 15 1 2 3 4 5 . stop 85 0 6 ."
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 27/53] xinetd: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (25 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 26/53] watchdog: " Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 28/53] dpkg: Add musleabi to known architectures Khem Raj
                   ` (28 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

musl relies on external rpc implemetation (libtirpc)
and exposed a bug in configury when checking for rlim_t

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...se-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch | 100 +++++++++++++++++++++
 meta/recipes-extended/xinetd/xinetd_2.3.15.bb      |   5 ++
 2 files changed, 105 insertions(+)
 create mode 100644 meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch

diff --git a/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch b/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
new file mode 100644
index 0000000..3c1b2f6
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
@@ -0,0 +1,100 @@
+From e8b0ffc7ea04cc71dba97a38e1a134aaf2285c2d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 07:14:50 +0000
+Subject: [PATCH] configure: Use HAVE_SYS_RESOURCE_H to guard sys/resource.h
+ inclusion
+
+HAVE_RLIM_T check will not let sys/resource.h to be checked and
+rlim_t is defined in sys/resource.h so the check would fail.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ aclocal.m4 |  2 +-
+ configure  | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 6e6f32c..70e7076 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -11,7 +11,7 @@ AC_CACHE_VAL(xinetd_cv_type_$1,
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+diff --git a/configure b/configure
+index b507d38..bec56ea 100755
+--- a/configure
++++ b/configure
+@@ -7640,7 +7640,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7686,7 +7686,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7732,7 +7732,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7778,7 +7778,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7824,7 +7824,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7870,7 +7870,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+@@ -7916,7 +7916,7 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #if HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+-#if HAVE_RLIM_T
++#if HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif
+ #if HAVE_STDINT_H
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/xinetd/xinetd_2.3.15.bb b/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
index 652fe91..6bfaabe 100644
--- a/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
+++ b/meta/recipes-extended/xinetd/xinetd_2.3.15.bb
@@ -7,6 +7,7 @@ LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=8ad8615198542444f84d28a6cf226dd8"
 
 DEPENDS = ""
+DEPENDS_append_libc-musl = " libtirpc "
 PR = "r2"
 
 # Blacklist a bogus tag in upstream check
@@ -20,6 +21,7 @@ SRC_URI = "git://github.com/xinetd-org/xinetd.git;protocol=https \
       file://Disable-services-from-inetd.conf-if-a-service-with-t.patch \
       file://xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch \
       file://xinetd-CVE-2013-4342.patch \
+      file://0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch \
       file://xinetd.service \
       "
 
@@ -39,6 +41,9 @@ EXTRA_OECONF="--disable-nls"
 PACKAGECONFIG ??= "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-libwrap,,tcp-wrappers"
 
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
+
 do_configure() {
 	# Looks like configure.in is broken, so we are skipping
 	# rebuilding configure and are just using the shipped one
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 28/53] dpkg: Add musleabi to known architectures
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (26 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 27/53] xinetd: " Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 29/53] puzzles: Zero'ise structs before use Khem Raj
                   ` (27 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Remove a glibc specific patch to be applied only for native version,
this is a dpkg-native specific patch needed for Centos 5.8, this patch
should be redone to be glibc independent for it to be applied to all
types of dpkg recipes

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...0006-add-musleabi-to-known-target-tripets.patch | 42 ++++++++++++++++++++++
 meta/recipes-devtools/dpkg/dpkg_1.18.2.bb          |  3 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch

diff --git a/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch b/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
new file mode 100644
index 0000000..a6b0088
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
@@ -0,0 +1,42 @@
+From f8910022dc3ec622272f168cd0022dbdf6dff93a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 23:05:41 +0000
+Subject: [PATCH] add musleabi to known target tripets
+
+helps compiling dpkg for musl/arm-softfloat
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ ostable      | 1 +
+ triplettable | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/ostable b/ostable
+index 3bb6819..d0ffdc7 100644
+--- a/ostable
++++ b/ostable
+@@ -15,6 +15,7 @@
+ uclibceabi-linux	linux-uclibceabi	linux[^-]*-uclibceabi
+ uclibc-linux		linux-uclibc		linux[^-]*-uclibc
+ musleabihf-linux	linux-musleabihf	linux[^-]*-musleabihf
++musleabi-linux		linux-musleabi		linux[^-]*-musleabi
+ musl-linux		linux-musl		linux[^-]*-musl
+ gnueabihf-linux		linux-gnueabihf		linux[^-]*-gnueabihf
+ gnueabi-linux		linux-gnueabi		linux[^-]*-gnueabi
+diff --git a/triplettable b/triplettable
+index 1213584..70d24c1 100644
+--- a/triplettable
++++ b/triplettable
+@@ -6,6 +6,7 @@
+ uclibceabi-linux-arm	uclibc-linux-armel
+ uclibc-linux-<cpu>	uclibc-linux-<cpu>
+ musleabihf-linux-arm	musl-linux-armhf
++musleabi-linux-arm	musl-linux-armel
+ musl-linux-<cpu>	musl-linux-<cpu>
+ gnueabihf-linux-arm	armhf
+ gnueabi-linux-arm	armel
+-- 
+2.6.4
+
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb b/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
index 4c3fa4f..dd1109b 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.18.2.bb
@@ -1,17 +1,18 @@
 require dpkg.inc
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 
+SRC_URI_append_class-native =" file://glibc2.5-sync_file_range.patch "
 SRC_URI += "file://noman.patch \
             file://remove-tar-no-timestamp.patch \
             file://fix-abs-redefine.patch \
             file://arch_pm.patch \
             file://dpkg-configure.service \
-            file://glibc2.5-sync_file_range.patch \
             file://add_armeb_triplet_entry.patch \
 	    file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \
 	    file://0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch \
 	    file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \
 	    file://0005-dpkg-compiler.m4-remove-Wvla.patch \
+	    file://0006-add-musleabi-to-known-target-tripets.patch \
            "
 
 SRC_URI[md5sum] = "63b9d869081ec49adeef6c5ff62d6576"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 29/53] puzzles: Zero'ise structs before use
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (27 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 28/53] dpkg: Add musleabi to known architectures Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:18 ` [PATCH 30/53] Revert "glib-2.0: build dependency cleanup" Khem Raj
                   ` (26 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Fixes build failures with musl where gcc5 flags it used before
initialized.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...mpiler-errors-about-uninitialized-use-of-.patch | 32 ++++++++++++++++++++++
 meta/recipes-sato/puzzles/puzzles_git.bb           |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch

diff --git a/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch b/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
new file mode 100644
index 0000000..0b971c4
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
@@ -0,0 +1,32 @@
+From 78d6d1706c21ad467520075ff7a8bf15cfbd68b3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 30 Dec 2015 22:13:16 +0000
+Subject: [PATCH] rect: Fix compiler errors about uninitialized use of
+ variables
+
+error: 'r2.x' may be used uninitialized in this function
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ rect.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/rect.c b/rect.c
+index 55667c0..fa3a786 100644
+--- a/rect.c
++++ b/rect.c
+@@ -1317,7 +1317,8 @@ static char *new_game_desc(const game_params *params_in, random_state *rs,
+                     if (ndirs > 0) {
+                         int which, dir;
+                         struct rect r1, r2;
+-
++                        memset(&r1, 0, sizeof(struct rect));
++                        memset(&r2, 0, sizeof(struct rect));
+                         which = random_upto(rs, ndirs);
+                         dir = dirs[which];
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 1e3bac7..9c8170c 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=33bcd4bce8f3c197f2aefbdbd2d299bc"
 SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
            file://fix-compiling-failure-with-option-g-O.patch \
            file://0001-Use-labs-instead-of-abs.patch \
+           file://0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch \
 "
 SRCREV = "346584bf6e38232be8773c24fd7dedcbd7b3d9ed"
 PE = "1"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 30/53] Revert "glib-2.0: build dependency cleanup"
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (28 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 29/53] puzzles: Zero'ise structs before use Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:39   ` Burton, Ross
  2016-01-08 10:18 ` [PATCH 31/53] apt: Add support for building for musl targets Khem Raj
                   ` (25 subsequent siblings)
  55 siblings, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

From: Kai Kang <kai.kang@windriver.com>

This reverts commit fcd7494b347423185c883b2897c4908929843a71.

It uses command glib-genmarshal to build glib-2.0 which is from
glibc-2.0-native. If the command doesn't exist on host, build fails
with error:

| /bin/sh: --prefix=test_marshal: command not found
| make[4]: *** [testmarshal.c] Error 127

So add the dependency back.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/glib-2.0/glib.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 86f7e0e..8e4dcd7 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -17,10 +17,10 @@ SECTION = "libs"
 
 BBCLASSEXTEND = "native nativesdk"
 
-DEPENDS = "virtual/libiconv libffi zlib"
-DEPENDS_append = " ${@bb.utils.contains('PTEST_ENABLED', '1', ' glib-2.0-native dbus', '', d)}"
+DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
+DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', ' dbus', '', d)}"
 DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native zlib-native"
-DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib"
+DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib ${BPN}-native"
 
 PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 31/53] apt: Add support for building for musl targets
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (29 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 30/53] Revert "glib-2.0: build dependency cleanup" Khem Raj
@ 2016-01-08 10:18 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 32/53] libunwind: backtrace APIs are glibc specific Khem Raj
                   ` (24 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:18 UTC (permalink / raw)
  To: openembedded-core

Turn bzip2 support into a PACKAGECONFIG
zlibs is a must have and therefore add it to DEPENDS will make the build
consistent

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/apt/apt.inc                  |  1 +
 ....mak-musl-based-systems-can-generate-shar.patch | 29 ++++++++++++++++++++++
 meta/recipes-devtools/apt/apt_1.0.10.1.bb          |  3 ++-
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch

diff --git a/meta/recipes-devtools/apt/apt.inc b/meta/recipes-devtools/apt/apt.inc
index 312c6a9..78ef5a7 100644
--- a/meta/recipes-devtools/apt/apt.inc
+++ b/meta/recipes-devtools/apt/apt.inc
@@ -11,6 +11,7 @@ SRC_URI = "http://snapshot.debian.org/archive/debian/20150805T094928Z/pool/main/
            file://nodoc.patch \
            file://disable-configure-in-makefile.patch \
            file://disable-test.patch \
+           file://0001-environment.mak-musl-based-systems-can-generate-shar.patch \
            "
 SRC_URI[md5sum] = "6505c4297b338adb2087ce87bbc4a276"
 SRC_URI[sha256sum] = "3fb1de9598363c416591d49e3c285458e095b035e6c06d5b944a54e15fc9b543"
diff --git a/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch b/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
new file mode 100644
index 0000000..042372b
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
@@ -0,0 +1,29 @@
+From 2f8aa21ace375c18977ed908b291c80a210a93c6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:06:12 +0000
+Subject: [PATCH] environment.mak: musl based systems can generate shared
+ objects too
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ buildlib/environment.mak.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in
+index b0a8d9d..3a52344 100644
+--- a/buildlib/environment.mak.in
++++ b/buildlib/environment.mak.in
+@@ -68,7 +68,7 @@ NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@
+ 
+ # Shared library things
+ HOST_OS = @host_os@
+-ifneq ($(words $(filter gnu% linux-gnu% kfreebsd-gnu% %-gnu,$(HOST_OS))),0)
++ifneq ($(words $(filter gnu% linux-gnu% kfreebsd-gnu% %-gnu linux-musl%,$(HOST_OS))),0)
+    SONAME_MAGIC=-Wl,-soname -Wl,
+    LFLAGS_SO=
+ else
+-- 
+2.6.4
+
diff --git a/meta/recipes-devtools/apt/apt_1.0.10.1.bb b/meta/recipes-devtools/apt/apt_1.0.10.1.bb
index bf77e2a..85c0d56 100644
--- a/meta/recipes-devtools/apt/apt_1.0.10.1.bb
+++ b/meta/recipes-devtools/apt/apt_1.0.10.1.bb
@@ -1,4 +1,4 @@
-DEPENDS = "curl db"
+DEPENDS = "curl db zlib"
 RDEPENDS_${PN} = "dpkg bash debianutils"
 require apt.inc
 
@@ -6,6 +6,7 @@ require apt-package.inc
 
 PACKAGECONFIG ??= "lzma"
 PACKAGECONFIG[lzma] = "ac_cv_lib_lzma_lzma_easy_encoder=yes,ac_cv_lib_lzma_lzma_easy_encoder=no,xz"
+PACKAGECONFIG[bz2] = "ac_cv_lib_bz2_BZ2_bzopen=yes,ac_cv_lib_bz2_BZ2_bzopen=no,bzip2"
 
 FILES_${PN} += "${bindir}/apt-key"
 apt-manpages += "doc/apt-key.8"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 32/53] libunwind: backtrace APIs are glibc specific
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (30 preceding siblings ...)
  2016-01-08 10:18 ` [PATCH 31/53] apt: Add support for building for musl targets Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 33/53] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
                   ` (23 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Make backtrace() API's use conditional on glibc
this helps make libunwind compile on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-backtrace-Use-only-with-glibc-and-uclibc.patch | 45 ++++++++++++++++++++++
 meta/recipes-support/libunwind/libunwind_1.1.bb    |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch

diff --git a/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch b/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
new file mode 100644
index 0000000..9aed419
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
@@ -0,0 +1,45 @@
+From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 06:44:07 +0000
+Subject: [PATCH] backtrace: Use only with glibc and uclibc
+
+backtrace API is glibc specific not linux specific
+so make it behave so.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ tests/test-coredump-unwind.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
+index 5254708..8767b42 100644
+--- a/tests/test-coredump-unwind.c
++++ b/tests/test-coredump-unwind.c
+@@ -57,7 +57,9 @@
+ #include <grp.h>
+ 
+ /* For SIGSEGV handler code */
++#ifdef __GLIBC__
+ #include <execinfo.h>
++#endif
+ #include <sys/ucontext.h>
+ 
+ #include <libunwind-coredump.h>
+@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+ 			ip);
+ 
+   {
++#ifdef __GLIBC__
+     /* glibc extension */
+     void *array[50];
+     int size;
+     size = backtrace(array, 50);
+-#ifdef __linux__
+     backtrace_symbols_fd(array, size, 2);
+ #endif
+   }
+-- 
+2.6.4
+
diff --git a/meta/recipes-support/libunwind/libunwind_1.1.bb b/meta/recipes-support/libunwind/libunwind_1.1.bb
index aa62bcc..7df9f5e 100644
--- a/meta/recipes-support/libunwind/libunwind_1.1.bb
+++ b/meta/recipes-support/libunwind/libunwind_1.1.bb
@@ -7,6 +7,7 @@ SRC_URI += "\
     file://Link-libunwind-to-libgcc_s-rather-than-libgcc.patch \
     file://0001-Invalid-dwarf-opcodes-can-cause-references-beyond-th.patch \
     file://Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch \
+    file://0001-backtrace-Use-only-with-glibc-and-uclibc.patch \
 "
 
 SRC_URI[md5sum] = "fb4ea2f6fbbe45bf032cd36e586883ce"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 33/53] babeltrace: Add missing header for MAXNAMLEN define
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (31 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 32/53] libunwind: backtrace APIs are glibc specific Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 34/53] elfutils: Fix build with musl Khem Raj
                   ` (22 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Fix bug exposed on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...Include-sys-param.h-for-MAXNAMLEN-definti.patch | 29 ++++++++++++++++++++++
 meta/recipes-kernel/lttng/babeltrace_1.3.1.bb      |  5 ++--
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch

diff --git a/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch b/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
new file mode 100644
index 0000000..eb16cd1
--- /dev/null
+++ b/meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
@@ -0,0 +1,29 @@
+From 8331b87845cafdda40e59a682f2ca8120ed0c472 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:17:40 +0000
+Subject: [PATCH] lttng-live: Include sys/param.h for MAXNAMLEN defintion
+
+exposed on musl based systems
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: pending
+
+ formats/lttng-live/lttng-live.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/formats/lttng-live/lttng-live.h b/formats/lttng-live/lttng-live.h
+index 4ab641d..808ed2b 100644
+--- a/formats/lttng-live/lttng-live.h
++++ b/formats/lttng-live/lttng-live.h
+@@ -25,6 +25,7 @@
+  */
+ 
+ #include <stdint.h>
++#include <sys/param.h>
+ #include "lttng-viewer-abi.h"
+ 
+ #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT	5344
+-- 
+2.6.4
+
diff --git a/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb b/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
index 36345e3..1766026 100644
--- a/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
+++ b/meta/recipes-kernel/lttng/babeltrace_1.3.1.bb
@@ -6,14 +6,15 @@ BUGTRACKER = "https://bugs.lttng.org/projects/babeltrace"
 LICENSE = "MIT & GPLv2"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa"
 
-inherit autotools pkgconfig
-
 DEPENDS = "glib-2.0 util-linux popt bison-native flex-native"
 
+inherit autotools pkgconfig
+
 SRCREV = "6e2b9096c77138593097335b9b27202d98918089"
 
 SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-1.3 \
            file://0001-Fix-invalid-pointer-free-with-trace-collection.patch \
+           file://0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch \
 "
 
 S = "${WORKDIR}/git"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 34/53] elfutils: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (32 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 33/53] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 35/53] sysklogd: untangle header inclusion maze Khem Raj
                   ` (21 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Just compile libelf on musl similar to uclibc
Provide alternatives to glibc assumptions

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...de-alternatives-for-glibc-assumptions-hel.patch | 132 +++++++++++++++++++++
 meta/recipes-devtools/elfutils/elfutils_0.163.bb   |   3 +
 2 files changed, 135 insertions(+)
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.163/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils-0.163/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/elfutils-0.163/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
new file mode 100644
index 0000000..29d9c84
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.163/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -0,0 +1,132 @@
+From 43c2c618d205f4fdffbc8d75217c127c824cdb67 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 06:35:34 +0000
+Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
+ compiling it on musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ lib/fixedsizehash.h              | 4 ++--
+ lib/system.h                     | 4 ++++
+ libdwfl/dwfl_build_id_find_elf.c | 2 +-
+ libdwfl/find-debuginfo.c         | 2 +-
+ libelf/elf.h                     | 9 ++++++---
+ libelf/libelf.h                  | 1 +
+ libelf/libelfP.h                 | 1 +
+ 7 files changed, 16 insertions(+), 7 deletions(-)
+
+diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
+index 06ce6a2..566def2 100644
+--- a/lib/fixedsizehash.h
++++ b/lib/fixedsizehash.h
+@@ -30,12 +30,12 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/cdefs.h>
+ #include <sys/param.h>
+ 
+ #include <system.h>
+ 
+-#define CONCAT(t1,t2) __CONCAT (t1,t2)
++#define CONCAT1(x,y) x##y
++#define CONCAT(x,y) CONCAT1(x,y)
+ 
+ /* Before including this file the following macros must be defined:
+ 
+diff --git a/lib/system.h b/lib/system.h
+index f31cfd0..78b629a 100644
+--- a/lib/system.h
++++ b/lib/system.h
+@@ -49,6 +49,10 @@
+ #else
+ # error "Unknown byte order"
+ #endif
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(x) x
++#define rawmemchr(s,c) memchr((s),(size_t)-1,(c))
++#endif
+ 
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
+index 99a5059..a796ef9 100644
+--- a/libdwfl/dwfl_build_id_find_elf.c
++++ b/libdwfl/dwfl_build_id_find_elf.c
+@@ -94,7 +94,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
+ 	{
+ 	  if (*file_name != NULL)
+ 	    free (*file_name);
+-	  *file_name = canonicalize_file_name (name);
++	  *file_name = realpath (name, NULL);
+ 	  if (*file_name == NULL)
+ 	    {
+ 	      *file_name = name;
+diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
+index 1faa494..6932402 100644
+--- a/libdwfl/find-debuginfo.c
++++ b/libdwfl/find-debuginfo.c
+@@ -361,7 +361,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
+       /* If FILE_NAME is a symlink, the debug file might be associated
+ 	 with the symlink target name instead.  */
+ 
+-      char *canon = canonicalize_file_name (file_name);
++      char *canon = realpath (file_name, NULL);
+       if (canon != NULL && strcmp (file_name, canon))
+ 	fd = find_debuginfo_in_path (mod, canon,
+ 				     debuglink_file, debuglink_crc,
+diff --git a/libelf/elf.h b/libelf/elf.h
+index aff6edc..0bd4f55 100644
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -21,7 +21,9 @@
+ 
+ #include <features.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ /* Standard ELF types.  */
+ 
+@@ -3552,7 +3554,8 @@ enum
+ 
+ #define R_TILEGX_NUM		130
+ 
+-
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif	/* elf.h */
+diff --git a/libelf/libelf.h b/libelf/libelf.h
+index 5a2b3af..5705e9c 100644
+--- a/libelf/libelf.h
++++ b/libelf/libelf.h
+@@ -29,6 +29,7 @@
+ #ifndef _LIBELF_H
+ #define _LIBELF_H 1
+ 
++#include <fcntl.h>
+ #include <sys/types.h>
+ 
+ /* Get the ELF types.  */
+diff --git a/libelf/libelfP.h b/libelf/libelfP.h
+index 3f4d654..5c811ec 100644
+--- a/libelf/libelfP.h
++++ b/libelf/libelfP.h
+@@ -36,6 +36,7 @@
+ 
+ #include <ar.h>
+ #include <gelf.h>
++#include <libelf.h>
+ 
+ #include <errno.h>
+ #include <stdint.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.163.bb b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
index 41bfbdc..0a7dd88 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.163.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
@@ -4,6 +4,7 @@ SECTION = "base"
 LICENSE = "(GPLv3 & Elfutils-Exception)"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 DEPENDS = "libtool bzip2 zlib virtual/libintl"
+DEPENDS_append_libc-musl = " argp-standalone "
 
 SRC_URI = "https://fedorahosted.org/releases/e/l/elfutils/${PV}/${BP}.tar.bz2"
 
@@ -37,6 +38,7 @@ SRC_URI += "\
 
 # Only apply when building uclibc based target recipe
 SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.161.patch"
+SRC_URI_append_libc-musl = " file://0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch "
 
 # The buildsystem wants to generate 2 .h files from source using a binary it just built,
 # which can not pass the cross compiling, so let's work around it by adding 2 .h files
@@ -59,6 +61,7 @@ do_install_append() {
 # build only libelf for uclibc case
 
 EXTRA_OEMAKE_libc-uclibc = "-C libelf"
+EXTRA_OEMAKE_libc-musl = "-C libelf"
 EXTRA_OEMAKE_class-native = ""
 EXTRA_OEMAKE_class-nativesdk = ""
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 35/53] sysklogd: untangle header inclusion maze
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (33 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 34/53] elfutils: Fix build with musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 36/53] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
                   ` (20 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

wait is not union per posix it is int
remove assumption about glibc is linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../sysklogd/files/0001-Fix-build-with-musl.patch  | 132 +++++++++++++++++++++
 meta/recipes-extended/sysklogd/sysklogd.inc        |   1 +
 2 files changed, 133 insertions(+)
 create mode 100644 meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch

diff --git a/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch b/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..9567946
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
@@ -0,0 +1,132 @@
+From f0af5bcfd753691652eac35efbcb208c933253f1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 31 Aug 2015 05:11:53 +0000
+Subject: [PATCH] Fix build with musl
+
+Explicitly include fcntl.h since with glibc is comes in as indirect
+include but not with musl
+
+linux/time.h inclusion is not required on musl so using !__GLIBC__ is
+not right for musl here
+
+wait type is glibc specific
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ klogd.c    | 10 +---------
+ ksym_mod.c |  5 +----
+ pidfile.c  |  1 +
+ syslog.c   |  3 ++-
+ syslogd.c  |  4 +---
+ 5 files changed, 6 insertions(+), 17 deletions(-)
+
+diff --git a/klogd.c b/klogd.c
+index 6cc80ed..9219671 100644
+--- a/klogd.c
++++ b/klogd.c
+@@ -260,11 +260,8 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <errno.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <sys/stat.h>
+-#if !defined(__GLIBC__)
+-#include <linux/time.h>
+-#endif /* __GLIBC__ */
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <stdlib.h>
+@@ -277,13 +274,8 @@
+ 
+ #define __LIBRARY__
+ #include <linux/unistd.h>
+-#if !defined(__GLIBC__)
+-# define __NR_ksyslog __NR_syslog
+-_syscall3(int,ksyslog,int, type, char *, buf, int, len);
+-#else
+ #include <sys/klog.h>
+ #define ksyslog klogctl
+-#endif
+ 
+ #define LOG_BUFFER_SIZE 4096
+ #define LOG_LINE_LENGTH 1000
+diff --git a/ksym_mod.c b/ksym_mod.c
+index 68cd6b6..6e26da1 100644
+--- a/ksym_mod.c
++++ b/ksym_mod.c
+@@ -113,12 +113,9 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <errno.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <sys/stat.h>
+ #include "module.h"
+-#if !defined(__GLIBC__)
+-#include <linux/time.h>
+-#endif /* __GLIBC__ */
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <linux/version.h>
+diff --git a/pidfile.c b/pidfile.c
+index e0959a0..6daa2e0 100644
+--- a/pidfile.c
++++ b/pidfile.c
+@@ -31,6 +31,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <signal.h>
++#include <fcntl.h>
+ 
+ /* read_pid
+  *
+diff --git a/syslog.c b/syslog.c
+index bdb3ff2..ef7b34e 100644
+--- a/syslog.c
++++ b/syslog.c
+@@ -55,7 +55,7 @@ static char sccsid[] = "@(#)syslog.c	5.28 (Berkeley) 6/27/90";
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/file.h>
+-#include <sys/signal.h>
++//#include <sys/signal.h>
+ #include <sys/syslog.h>
+ #if 0
+ #include "syslog.h"
+@@ -72,6 +72,7 @@ static char sccsid[] = "@(#)syslog.c	5.28 (Berkeley) 6/27/90";
+ #include <stdarg.h>
+ #include <paths.h>
+ #include <stdio.h>
++#include <fcntl.h>
+ 
+ #define	_PATH_LOGNAME	"/dev/log"
+ 
+diff --git a/syslogd.c b/syslogd.c
+index ea73ea5..1ca0595 100644
+--- a/syslogd.c
++++ b/syslogd.c
+@@ -818,9 +818,7 @@ void doexit(int sig);
+ void init();
+ void cfline(char *line, register struct filed *f);
+ int decode(char *name, struct code *codetab);
+-#if defined(__GLIBC__)
+ #define dprintf mydprintf
+-#endif /* __GLIBC__ */
+ static void dprintf(char *, ...);
+ static void allocate_log(void);
+ void sighup_handler();
+@@ -2094,7 +2092,7 @@ void reapchild()
+ 	(void) signal(SIGCHLD, reapchild);	/* reset signal handler -ASP */
+ 	wait ((int *)0);
+ #else
+-	union wait status;
++	int status;
+ 
+ 	while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
+ 		;
+-- 
+2.5.1
+
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
index 85b3cdc..f789c54 100644
--- a/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -15,6 +15,7 @@ inherit update-rc.d update-alternatives
 
 SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
            file://no-strip-install.patch \
+           file://0001-Fix-build-with-musl.patch \
            file://sysklogd \
            file://syslog.conf \
            "
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 00/53] musl fixes 3
@ 2016-01-08 10:19 Khem Raj
  2016-01-08 10:18 ` [PATCH 01/53] powertop: Include right headers for timval struct Khem Raj
                   ` (55 more replies)
  0 siblings, 56 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

This set of fixes let core-image-full-cmdline build with musl along with core-image-sato
and core-image-weston

Here is a qemuarm world build results.

http://errors.yoctoproject.org/Errors/Build/11421/

Few fixes are also for uclibc

The following changes since commit 5661d8cb7849df62358368743134c0aaf523965e:

  image: Really remove lockfiles flag (2016-01-07 13:41:47 +0000)

are available in the git repository at:

  git://github.com/kraj/openembedded-core kraj/musl-fixes
  https://github.com/kraj/openembedded-core/tree/kraj/musl-fixes

Kai Kang (1):
  Revert "glib-2.0: build dependency cleanup"

Khem Raj (52):
  powertop: Include right headers for timval struct
  dhcp: Include sys/types.h for u_int* defs
  blktrace: Include <sys/types.h for dev_t
  ppp: Fix build with musl
  tcp-wrappers: Fix build with musl
  fts: Add recipe
  connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR
  libcgroup: Add dependency on fts when building on musl
  linux-libc-headers: Port patches for linux-headers for musl
  xserver-xorg: Fix build with musl
  gdk-pixbuf: Fix latent build  issue exposed by musl
  argp-standalone: Add recipe
  gnutls: Link with libargp on musl and depend on argp-standalone
  util-linux: Fix ptest builds on musl
  webkitgtk: Fix build with clang
  elfutils: Fix build with uclibc
  packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only
    case
  guile: Fix build with uclibc
  gnutls: Link with libuargp on uclibc
  mtools: Fix build with uclibc
  parted: Fix build with uclibc
  net-tools: Link with libintl on uclibc
  libdrm: Upgrade 2.4.65 -> 2.4.66
  directfb: Fix build with musl
  gzip: Fix build with musl
  watchdog: Fix build with musl
  xinetd: Fix build with musl
  dpkg: Add musleabi to known architectures
  puzzles: Zero'ise structs before use
  apt: Add support for building for musl targets
  libunwind: backtrace APIs are glibc specific
  babeltrace: Add missing header for MAXNAMLEN define
  elfutils: Fix build with musl
  sysklogd: untangle header inclusion maze
  console-tools: Include sys/types.h for u_char and u_short defs
  webkitgtk: Fix build on non-glibc linux systems
  rt-tests: Fix build with non-gcc compilers
  webkitgtk: Update patch status
  tar: Fix build for musl based targets
  net-tools: Fix build on musl
  pax: Fix build with musl
  iputils: Fix build with musl
  libuser: Fix build when secure getenv is not there
  iproute2: Fix build with musl
  irda-utils: Fix header inclusions
  nspr: Drop older glibc code
  chkconfig: Avoid using caddr_t
  tcf-agent: Implement canonicalize_file_name() for musl as well
  bsd-headers,musl: Add recipe for bsd missing features
  nfs-utils: Disable tcp-wrappers for musl
  portmap: Point to tirpc headers and libraries on musl
  elfutils: Add ALLOW_EMPTY for musl

 .../0003-Fix-header-inclusions-for-musl.patch      |   79 +-
 .../dhcp/0001-include-missing-sys-types.h.patch    |   58 +
 meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb       |    1 +
 .../iproute2/iproute2/iproute2-4.3.0-musl.patch    |   97 ++
 .../iproute2/iproute2_4.3.0.bb                     |    1 +
 .../irda-utils/irda-utils-0.9.18/musl.patch        |   29 +
 .../irda-utils/irda-utils_0.9.18.bb                |    1 +
 .../nfs-utils/nfs-utils_1.3.3.bb                   |    1 +
 meta/recipes-connectivity/portmap/portmap_6.0.bb   |    4 +
 .../ppp/ppp/0001-Fix-build-with-musl.patch         |  163 +++
 meta/recipes-connectivity/ppp/ppp_2.4.7.bb         |    3 +
 meta/recipes-core/bsd-headers/bsd-headers.bb       |   25 +
 .../bsd-headers/bsd-headers/sys-queue.h            |  846 ++++++++++++
 .../bsd-headers/bsd-headers/sys-tree.h             |  761 +++++++++++
 ...clude-sys-types.h-for-u_char-and-u_short-.patch |   44 +
 .../console-tools/console-tools_0.3.2.bb           |    1 +
 meta/recipes-core/fts/fts.bb                       |   39 +
 .../fts/fts/fts-header-correctness.patch           |   25 +
 meta/recipes-core/fts/fts/fts-uclibc.patch         |   50 +
 meta/recipes-core/fts/fts/gcc5.patch               | 1368 ++++++++++++++++++++
 meta/recipes-core/fts/fts/remove_cdefs.patch       |   69 +
 meta/recipes-core/fts/fts/stdint.patch             |   15 +
 meta/recipes-core/glib-2.0/glib.inc                |    6 +-
 .../libcgroup/libcgroup/musl-decls-compat.patch    |  235 ++++
 meta/recipes-core/libcgroup/libcgroup_0.41.bb      |    4 +
 meta/recipes-core/musl/musl_git.bb                 |    1 +
 .../packagegroups/packagegroup-self-hosted.bb      |    2 +-
 .../util-linux/uuid-test-error-api.patch           |   92 ++
 meta/recipes-core/util-linux/util-linux_2.27.1.bb  |    1 +
 meta/recipes-devtools/apt/apt.inc                  |    1 +
 ....mak-musl-based-systems-can-generate-shar.patch |   29 +
 meta/recipes-devtools/apt/apt_1.0.10.1.bb          |    3 +-
 ...0006-add-musleabi-to-known-target-tripets.patch |   42 +
 meta/recipes-devtools/dpkg/dpkg_1.18.2.bb          |    3 +-
 ...de-alternatives-for-glibc-assumptions-hel.patch |  132 ++
 .../uclibc-support-for-elfutils-0.161.patch        |   79 +-
 .../elfutils/elfutils/mempcpy.patch                |   24 -
 meta/recipes-devtools/elfutils/elfutils_0.148.bb   |    1 -
 meta/recipes-devtools/elfutils/elfutils_0.163.bb   |    8 +-
 .../guile/files/remove_strcase_l_funcs.patch       |   38 +
 meta/recipes-devtools/guile/guile_2.0.11.bb        |    3 +-
 meta/recipes-devtools/mtools/mtools_4.0.18.bb      |    3 +
 ...nonicalize_file_name-is-specific-to-glibc.patch |   46 +
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    1 +
 .../chkconfig/chkconfig/replace_caddr_t.patch      |   33 +
 .../recipes-extended/chkconfig/chkconfig_1.3.58.bb |    4 +-
 meta/recipes-extended/gzip/gzip.inc                |    7 +
 .../files/0001-Fix-header-inclusion-for-musl.patch |   92 ++
 meta/recipes-extended/iputils/iputils_s20121221.bb |    1 +
 .../libuser/libuser/0001-Check-for-issetugid.patch |   62 +
 .../libuser/0002-remove-unused-execinfo.h.patch    |   27 +
 meta/recipes-extended/libuser/libuser_0.62.bb      |    4 +-
 .../net-tools/net-tools/musl-fixes.patch           |  100 ++
 .../net-tools/net-tools_1.60-26.bb                 |    3 +-
 meta/recipes-extended/parted/parted_3.2.bb         |    3 +-
 .../pax/pax/0001-Fix-build-with-musl.patch         | 1287 ++++++++++++++++++
 .../pax/0001-use-strtoll-instead-of-strtoq.patch   |   33 +
 meta/recipes-extended/pax/pax_3.4.bb               |   10 +
 .../sysklogd/files/0001-Fix-build-with-musl.patch  |  132 ++
 meta/recipes-extended/sysklogd/sysklogd.inc        |    1 +
 meta/recipes-extended/tar/tar/musl_dirent.patch    |   19 +
 meta/recipes-extended/tar/tar_1.28.bb              |    6 +
 .../tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch |   31 +
 .../tcp-wrappers/tcp-wrappers_7.6.bb               |    4 +
 ...d-issues-found-with-non-glibc-C-libraries.patch |   99 ++
 meta/recipes-extended/watchdog/watchdog_5.14.bb    |    8 +-
 ...se-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch |  100 ++
 meta/recipes-extended/xinetd/xinetd_2.3.15.bb      |    5 +
 .../gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch      |   63 +
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.32.1.bb |    1 +
 meta/recipes-graphics/directfb/directfb.inc        |    5 +
 .../directfb/directfb/compar_fn_t.patch            |   62 +
 .../directfb/directfb/union-sigval.patch           |   19 +
 .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     |   19 +
 ...tests-kms-steal-crtc-Include-sys-select.h.patch |   33 +
 .../recipes-graphics/drm/libdrm/installtests.patch |   24 +-
 .../drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb}     |    8 +-
 .../xserver-xorg/musl-arm-inb-outb.patch           |   18 +
 .../xorg-xserver/xserver-xorg_1.18.0.bb            |    4 +-
 ...-include-sys-types.h-for-dev_t-definition.patch |   30 +
 meta/recipes-kernel/blktrace/blktrace_git.bb       |    4 +-
 ...mpat.h-fix-some-issues-arising-from-in6.h.patch |   82 ++
 ...t.h-prevent-redefinition-of-struct-ethhdr.patch |   59 +
 ...remove-inclusion-of-sysinfo.h-in-kernel.h.patch |   32 +
 .../linux-libc-headers/linux-libc-headers_4.1.bb   |    5 +
 ...Include-sys-param.h-for-MAXNAMLEN-definti.patch |   29 +
 meta/recipes-kernel/lttng/babeltrace_1.3.1.bb      |    5 +-
 ...0001-include-rquired-headers-for-typedefs.patch |   47 +
 meta/recipes-kernel/powertop/powertop_2.8.bb       |    4 +-
 ...t-CC-AR-variable-only-if-it-doesn-t-have-.patch |   30 +
 meta/recipes-rt/rt-tests/rt-tests_0.96.bb          |    3 +-
 ...mpiler-errors-about-uninitialized-use-of-.patch |   32 +
 meta/recipes-sato/puzzles/puzzles_git.bb           |    1 +
 ...nable-backtrace-on-linux-when-using-glibc.patch |   39 +
 ...x-build-with-non-glibc-libraries-on-linux.patch |   61 +
 meta/recipes-sato/webkit/webkitgtk/clang.patch     |   25 +
 meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |    3 +
 .../argp-standalone/argp-standalone_1.3.bb         |   28 +
 .../files/0001-throw-in-funcdef.patch              |   84 ++
 .../argp-standalone/files/0002-isprint.patch       |   51 +
 meta/recipes-support/gnutls/gnutls.inc             |    5 +-
 ...-backtrace-Use-only-with-glibc-and-uclibc.patch |   45 +
 meta/recipes-support/libunwind/libunwind_1.1.bb    |    1 +
 ...001-Remove-the-check-for-LINUX-glibc-case.patch |   35 +
 meta/recipes-support/nspr/nspr_4.11.bb             |    9 +
 105 files changed, 7393 insertions(+), 117 deletions(-)
 create mode 100644 meta/recipes-connectivity/dhcp/dhcp/0001-include-missing-sys-types.h.patch
 create mode 100644 meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
 create mode 100644 meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
 create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers.bb
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
 create mode 100644 meta/recipes-core/fts/fts.bb
 create mode 100644 meta/recipes-core/fts/fts/fts-header-correctness.patch
 create mode 100644 meta/recipes-core/fts/fts/fts-uclibc.patch
 create mode 100644 meta/recipes-core/fts/fts/gcc5.patch
 create mode 100644 meta/recipes-core/fts/fts/remove_cdefs.patch
 create mode 100644 meta/recipes-core/fts/fts/stdint.patch
 create mode 100644 meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
 create mode 100644 meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
 create mode 100644 meta/recipes-devtools/apt/apt/0001-environment.mak-musl-based-systems-can-generate-shar.patch
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/0006-add-musleabi-to-known-target-tripets.patch
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.163/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
 delete mode 100644 meta/recipes-devtools/elfutils/elfutils/mempcpy.patch
 create mode 100644 meta/recipes-devtools/guile/files/remove_strcase_l_funcs.patch
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
 create mode 100644 meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
 create mode 100644 meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
 create mode 100644 meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
 create mode 100644 meta/recipes-extended/sysklogd/files/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/tar/tar/musl_dirent.patch
 create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/musl-decls.patch
 create mode 100644 meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch
 create mode 100644 meta/recipes-extended/xinetd/xinetd/0001-configure-Use-HAVE_SYS_RESOURCE_H-to-guard-sys-resou.patch
 create mode 100644 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf/libc_memfuncs.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
 create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
 create mode 100644 meta/recipes-graphics/drm/libdrm/0001-tests-kms-steal-crtc-Include-sys-select.h.patch
 rename meta/recipes-graphics/drm/{libdrm_2.4.65.bb => libdrm_2.4.66.bb} (86%)
 create mode 100644 meta/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch
 create mode 100644 meta/recipes-kernel/blktrace/blktrace/0001-include-sys-types.h-for-dev_t-definition.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-libc-compat.h-prevent-redefinition-of-struct-ethhdr.patch
 create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch
 create mode 100644 meta/recipes-kernel/lttng/babeltrace/0001-lttng-live-Include-sys-param.h-for-MAXNAMLEN-definti.patch
 create mode 100644 meta/recipes-kernel/powertop/powertop/0001-include-rquired-headers-for-typedefs.patch
 create mode 100644 meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
 create mode 100644 meta/recipes-sato/puzzles/files/0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/clang.patch
 create mode 100644 meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
 create mode 100644 meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch
 create mode 100644 meta/recipes-support/argp-standalone/files/0002-isprint.patch
 create mode 100644 meta/recipes-support/libunwind/libunwind-1.1/0001-backtrace-Use-only-with-glibc-and-uclibc.patch
 create mode 100644 meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch

-- 
2.7.0



^ permalink raw reply	[flat|nested] 84+ messages in thread

* [PATCH 36/53] console-tools: Include sys/types.h for u_char and u_short defs
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (34 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 35/53] sysklogd: untangle header inclusion maze Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 37/53] webkitgtk: Fix build on non-glibc linux systems Khem Raj
                   ` (19 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...clude-sys-types.h-for-u_char-and-u_short-.patch | 44 ++++++++++++++++++++++
 .../console-tools/console-tools_0.3.2.bb           |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch

diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
new file mode 100644
index 0000000..64b5b04
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch
@@ -0,0 +1,44 @@
+From 0fd5dda51d68e1ec2a87e27b5ed0dff3503b4681 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 08:12:38 +0000
+Subject: [PATCH] kbdtools: Include sys/types.h for u_char and u_short
+ definition
+
+on musl this gets exposed since sys/types.h is not
+included via some other indirect inclusion as is the case with glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ kbdtools/dumpkeys.c | 1 +
+ kbdtools/loadkeys.y | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/kbdtools/dumpkeys.c b/kbdtools/dumpkeys.c
+index 6159d49..c19fb21 100644
+--- a/kbdtools/dumpkeys.c
++++ b/kbdtools/dumpkeys.c
+@@ -26,6 +26,7 @@
+ #include <errno.h>
+ #include <sysexits.h>
+ #include <sys/ioctl.h>
++#include <sys/types.h>
+ #include <linux/types.h>
+ #include <linux/kd.h>
+ #include <linux/keyboard.h>
+diff --git a/kbdtools/loadkeys.y b/kbdtools/loadkeys.y
+index b6a8e01..4468f77 100644
+--- a/kbdtools/loadkeys.y
++++ b/kbdtools/loadkeys.y
+@@ -71,6 +71,7 @@
+ #include <linux/kd.h>
+ #include <linux/keyboard.h>
+ #include <sys/ioctl.h>
++#include <sys/types.h>
+ #include <ctype.h>
+ #include <sysexits.h>
+ #include <signal.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-core/console-tools/console-tools_0.3.2.bb b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
index 7e14b31..d14d683 100644
--- a/meta/recipes-core/console-tools/console-tools_0.3.2.bb
+++ b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
@@ -14,6 +14,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
            file://nodocs.patch \
            file://fix-libconsole-linking.patch \
            file://no-dep-on-libfl.patch \
+           file://0001-kbdtools-Include-sys-types.h-for-u_char-and-u_short-.patch \
            file://lcmessage.m4 \
            file://Makevars"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 37/53] webkitgtk: Fix build on non-glibc linux systems
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (35 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 36/53] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 38/53] rt-tests: Fix build with non-gcc compilers Khem Raj
                   ` (18 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...x-build-with-non-glibc-libraries-on-linux.patch | 61 ++++++++++++++++++++++
 meta/recipes-sato/webkit/webkitgtk_2.10.4.bb       |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch

diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
new file mode 100644
index 0000000..c57fcde
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
@@ -0,0 +1,61 @@
+From 30e2ef302a329850ba55c7c458c98cbf396186ec Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 21:47:34 +0000
+Subject: [PATCH] Fix build with non-glibc libraries on linux
+
+qualify isnan() calls with std namespace
+malloc_trim is glibc specific API so guard it with __GLIBC__
+let ctype be used on non-glibc ( musl ) C library
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ Source/JavaScriptCore/runtime/Options.cpp                    | 2 +-
+ Source/WTF/wtf/DisallowCType.h                               | 2 +-
+ Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp | 2 ++
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/Source/JavaScriptCore/runtime/Options.cpp b/Source/JavaScriptCore/runtime/Options.cpp
+index fe830b4..c49aade 100644
+--- a/Source/JavaScriptCore/runtime/Options.cpp
++++ b/Source/JavaScriptCore/runtime/Options.cpp
+@@ -610,7 +610,7 @@ bool Option::operator==(const Option& other) const
+     case Options::Type::unsignedType:
+         return m_entry.unsignedVal == other.m_entry.unsignedVal;
+     case Options::Type::doubleType:
+-        return (m_entry.doubleVal == other.m_entry.doubleVal) || (isnan(m_entry.doubleVal) && isnan(other.m_entry.doubleVal));
++        return (m_entry.doubleVal == other.m_entry.doubleVal) || (std::isnan(m_entry.doubleVal) && std::isnan(other.m_entry.doubleVal));
+     case Options::Type::int32Type:
+         return m_entry.int32Val == other.m_entry.int32Val;
+     case Options::Type::optionRangeType:
+diff --git a/Source/WTF/wtf/DisallowCType.h b/Source/WTF/wtf/DisallowCType.h
+index d85e767..dc6bcab 100644
+--- a/Source/WTF/wtf/DisallowCType.h
++++ b/Source/WTF/wtf/DisallowCType.h
+@@ -40,7 +40,7 @@
+ // are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h>
+ // or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
+ // isacii(). 
+-#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION)
++#if !(OS(DARWIN) && PLATFORM(GTK)) && !PLATFORM(EFL) && !defined(_LIBCPP_VERSION) && defined(__GLIBC__)
+ 
+ #include <ctype.h>
+ 
+diff --git a/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp b/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
+index ea61909..1495642 100644
+--- a/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
++++ b/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
+@@ -202,7 +202,9 @@ void MemoryPressureHandler::respondToMemoryPressure(Critical critical, Synchrono
+ void MemoryPressureHandler::platformReleaseMemory(Critical)
+ {
+     ReliefLogger log("Run malloc_trim");
++#ifdef __GLIBC__
+     malloc_trim(0);
++#endif
+ }
+ 
+ void MemoryPressureHandler::ReliefLogger::platformLog()
+-- 
+2.6.4
+
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
index f5add32..098bbbb 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.10.4.bb
@@ -14,6 +14,7 @@ SRC_URI = "\
   http://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
   file://clang.patch \
   file://0001-Enable-backtrace-on-linux-when-using-glibc.patch \
+  file://0001-Fix-build-with-non-glibc-libraries-on-linux.patch \
   "
 SRC_URI[md5sum] = "fb010031c6f61c3a1a00793b112badb5"
 SRC_URI[sha256sum] = "dbf8260da5cac0c74de2d3cce1fe7c519da3cd816a2c769cb6c6d56addd2f055"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 38/53] rt-tests: Fix build with non-gcc compilers
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (36 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 37/53] webkitgtk: Fix build on non-glibc linux systems Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 39/53] webkitgtk: Update patch status Khem Raj
                   ` (17 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Makery hard sets CC to be some form of gcc, make it set only if CC
variable is absent in environment.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...t-CC-AR-variable-only-if-it-doesn-t-have-.patch | 30 ++++++++++++++++++++++
 meta/recipes-rt/rt-tests/rt-tests_0.96.bb          |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch

diff --git a/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch b/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
new file mode 100644
index 0000000..00fcc7d
--- /dev/null
+++ b/meta/recipes-rt/rt-tests/files/0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch
@@ -0,0 +1,30 @@
+From 9640dde4241e1314b8e8ea35b0c8dab0b30ae51f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 3 Jan 2016 10:50:56 -0800
+Subject: [PATCH] Makefile: Set CC/AR variable only if it doesn't have a value
+
+This helps it compile with clang or any other compilers besides gcc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1e4b7d1..2c2d396 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 0.96
+-CC=$(CROSS_COMPILE)gcc
+-AR=$(CROSS_COMPILE)ar
++CC?=$(CROSS_COMPILE)gcc
++AR?=$(CROSS_COMPILE)ar
+ 
+ OBJDIR = bld
+ 
+-- 
+2.6.4
+
diff --git a/meta/recipes-rt/rt-tests/rt-tests_0.96.bb b/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
index 7d70392..2f96fea 100644
--- a/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
+++ b/meta/recipes-rt/rt-tests/rt-tests_0.96.bb
@@ -10,7 +10,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
 require rt-tests.inc
 inherit ptest
 
-SRC_URI += "file://run-ptest \
+SRC_URI += "file://0001-Makefile-Set-CC-AR-variable-only-if-it-doesn-t-have-.patch \
+            file://run-ptest \
             file://rt_bmark.py \
            "
 # Do not install hwlatdetect
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 39/53] webkitgtk: Update patch status
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (37 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 38/53] rt-tests: Fix build with non-gcc compilers Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 40/53] tar: Fix build for musl based targets Khem Raj
                   ` (16 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch     | 2 +-
 .../webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch    | 2 +-
 meta/recipes-sato/webkit/webkitgtk/clang.patch                          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
index 146087b..d7e4ef6 100644
--- a/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Enable-backtrace-on-linux-when-using-glibc.patch
@@ -7,7 +7,7 @@ We dont have backtrace() implemented on non-glibc libc's on linux
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
-Upstream-Status: Pending
+Upstream-Status: Accepted
 
  Source/WTF/wtf/Assertions.cpp | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
index c57fcde..77ebf37 100644
--- a/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
+++ b/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-with-non-glibc-libraries-on-linux.patch
@@ -9,7 +9,7 @@ let ctype be used on non-glibc ( musl ) C library
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
-Upstream-Status: Submitted
+Upstream-Status: Accepted
 
  Source/JavaScriptCore/runtime/Options.cpp                    | 2 +-
  Source/WTF/wtf/DisallowCType.h                               | 2 +-
diff --git a/meta/recipes-sato/webkit/webkitgtk/clang.patch b/meta/recipes-sato/webkit/webkitgtk/clang.patch
index ef77755..e526713 100644
--- a/meta/recipes-sato/webkit/webkitgtk/clang.patch
+++ b/meta/recipes-sato/webkit/webkitgtk/clang.patch
@@ -8,7 +8,7 @@ Source/JavaScriptCore/assembler/ARM64Assembler.h:2857:33: error: cannot initiali
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 
-Upstream-Status: Pending
+Upstream-Status: Accepted
 
 Index: webkitgtk-2.8.5/Source/JavaScriptCore/assembler/ARM64Assembler.h
 ===================================================================
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 40/53] tar: Fix build for musl based targets
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (38 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 39/53] webkitgtk: Update patch status Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 41/53] net-tools: Fix build on musl Khem Raj
                   ` (15 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

It only considered linux-gnu hosts when cross compiling
here we add linux-musl to the mix as well

Fixes errors e.g.

1.28-r0/tar-1.28/src/tar.c:1351:5: error: 'SAVEDIR_SORT_INODE'
undeclared here (not in a function)
|      SAVEDIR_SORT_INODE
|      ^

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-extended/tar/tar/musl_dirent.patch | 19 +++++++++++++++++++
 meta/recipes-extended/tar/tar_1.28.bb           |  6 ++++++
 2 files changed, 25 insertions(+)
 create mode 100644 meta/recipes-extended/tar/tar/musl_dirent.patch

diff --git a/meta/recipes-extended/tar/tar/musl_dirent.patch b/meta/recipes-extended/tar/tar/musl_dirent.patch
new file mode 100644
index 0000000..b0dc16c
--- /dev/null
+++ b/meta/recipes-extended/tar/tar/musl_dirent.patch
@@ -0,0 +1,19 @@
+musl has valid d_ino implementation
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: tar-1.28/m4/d-ino.m4
+===================================================================
+--- tar-1.28.orig/m4/d-ino.m4
++++ tar-1.28/m4/d-ino.m4
+@@ -40,7 +40,8 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_
+            [gl_cv_struct_dirent_d_ino=no],
+            [case "$host_os" in
+                            # Guess yes on glibc systems with Linux kernel.
+-              linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
++              linux*-gnu*|linux*-musl*)
++                           gl_cv_struct_dirent_d_ino="guessing yes" ;;
+                            # If we don't know, assume the worst.
+               *)           gl_cv_struct_dirent_d_ino="guessing no" ;;
+             esac
diff --git a/meta/recipes-extended/tar/tar_1.28.bb b/meta/recipes-extended/tar/tar_1.28.bb
index 8816000..518e622 100644
--- a/meta/recipes-extended/tar/tar_1.28.bb
+++ b/meta/recipes-extended/tar/tar_1.28.bb
@@ -7,6 +7,12 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI += "file://remove-gets.patch \
+            file://musl_dirent.patch \
            "
 SRC_URI[md5sum] = "8f32b2bc1ed7ddf4cf4e4a39711341b0"
 SRC_URI[sha256sum] = "60e4bfe0602fef34cd908d91cf638e17eeb09394d7b98c2487217dc4d3147562"
+
+do_install_append_libc-musl() {
+	rm -f ${D}${libdir}/charset.alias
+	rmdir ${D}${libdir}
+}
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 41/53] net-tools: Fix build on musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (39 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 40/53] tar: Fix build for musl based targets Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 42/53] pax: Fix build with musl Khem Raj
                   ` (14 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../net-tools/net-tools/musl-fixes.patch           | 100 +++++++++++++++++++++
 .../net-tools/net-tools_1.60-26.bb                 |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 meta/recipes-extended/net-tools/net-tools/musl-fixes.patch

diff --git a/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch b/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
new file mode 100644
index 0000000..f694d59
--- /dev/null
+++ b/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch
@@ -0,0 +1,100 @@
+Adjust headers for non-glibc cases
+especially exposed by musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: net-tools-1.60/lib/inet6_gr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet6_gr.c
++++ net-tools-1.60/lib/inet6_gr.c
+@@ -23,7 +23,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
+-#ifndef __GLIBC__
++#ifdef HAVE_IPV6_ROUTE_H
+ #include <netinet6/ipv6_route.h>	/* glibc doesn't have this */
+ #endif
+ #include "version.h"
+Index: net-tools-1.60/lib/inet6_sr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet6_sr.c
++++ net-tools-1.60/lib/inet6_sr.c
+@@ -23,10 +23,10 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
+-#ifdef __GLIBC__
+-#include <net/route.h>
+-#else
++#ifdef HAVE_IPV6_ROUTE_H
+ #include <netinet6/ipv6_route.h>	/* glibc does not have this */
++#else
++#include <net/route.h>
+ #endif
+ #include "version.h"
+ #include "net-support.h"
+Index: net-tools-1.60/lib/inet_sr.c
+===================================================================
+--- net-tools-1.60.orig/lib/inet_sr.c
++++ net-tools-1.60/lib/inet_sr.c
+@@ -26,6 +26,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <unistd.h>
++#include <asm-generic/param.h>
+ #include "version.h"
+ #include "net-support.h"
+ #include "pathnames.h"
+Index: net-tools-1.60/lib/util-ank.c
+===================================================================
+--- net-tools-1.60.orig/lib/util-ank.c
++++ net-tools-1.60/lib/util-ank.c
+@@ -14,6 +14,7 @@
+  * Rani Assaf <rani@magic.metawire.com> 980929:	resolve addresses
+  */
+ 
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+Index: net-tools-1.60/mii-tool.c
+===================================================================
+--- net-tools-1.60.orig/mii-tool.c
++++ net-tools-1.60/mii-tool.c
+@@ -47,10 +47,6 @@ static char Version[] = "$Id: mii-tool.c
+ #include <net/if.h>
+ #include <linux/sockios.h>
+ 
+-#ifndef __GLIBC__
+-#include <linux/if_arp.h>
+-#include <linux/if_ether.h>
+-#endif
+ #include "mii.h"
+ #include "version.h"
+ 
+Index: net-tools-1.60/netstat.c
+===================================================================
+--- net-tools-1.60.orig/netstat.c
++++ net-tools-1.60/netstat.c
+@@ -87,6 +87,7 @@
+ #include <dirent.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <asm-generic/param.h>
+ 
+ #include "net-support.h"
+ #include "pathnames.h"
+Index: net-tools-1.60/slattach.c
+===================================================================
+--- net-tools-1.60.orig/slattach.c
++++ net-tools-1.60/slattach.c
+@@ -44,6 +44,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <getopt.h>
++#include <termios.h>
+ #include <linux/if_slip.h>
+ 
+ #if defined(__GLIBC__)
diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
index 04ea76f..79c7291 100644
--- a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
+++ b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
@@ -11,6 +11,7 @@ SRC_URI = "http://snapshot.debian.org/archive/debian/20050312T000000Z/pool/main/
            file://net-tools-config.h \
            file://net-tools-config.make \
            file://ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch \
+           file://musl-fixes.patch \
 	   "
 
 # for this package we're mostly interested in tracking debian patches,
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 42/53] pax: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (40 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 41/53] net-tools: Fix build on musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 43/53] iputils: " Khem Raj
                   ` (13 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

There are several BSD specific assumptions
and some GNU specific ones.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../pax/pax/0001-Fix-build-with-musl.patch         | 1287 ++++++++++++++++++++
 .../pax/0001-use-strtoll-instead-of-strtoq.patch   |   33 +
 meta/recipes-extended/pax/pax_3.4.bb               |   10 +
 3 files changed, 1330 insertions(+)
 create mode 100644 meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
 create mode 100644 meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch

diff --git a/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch b/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
new file mode 100644
index 0000000..61bf2de
--- /dev/null
+++ b/meta/recipes-extended/pax/pax/0001-Fix-build-with-musl.patch
@@ -0,0 +1,1287 @@
+From 47c4db8d37248d968fac7ee4a71ca64398890723 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 11:57:21 -0800
+Subject: [PATCH] Fix build with musl
+
+Remove BSDisms
+Remove fts, and link to libfts thats provided externally
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate[musl specific]
+
+ lib/Makefile.am |    4 +-
+ lib/fts.c       | 1025 -------------------------------------------------------
+ lib/fts.h       |  131 -------
+ lib/vis.h       |   13 +-
+ src/Makefile.am |    2 +-
+ src/extern.h    |    2 -
+ src/file_subs.c |    2 +-
+ src/tables.c    |    2 +-
+ 8 files changed, 14 insertions(+), 1167 deletions(-)
+ delete mode 100644 lib/fts.c
+ delete mode 100644 lib/fts.h
+
+diff --git a/lib/Makefile.am b/lib/Makefile.am
+index 56d0859..7f5045a 100644
+--- a/lib/Makefile.am
++++ b/lib/Makefile.am
+@@ -8,8 +8,8 @@ AUTOMAKE_OPTIONS = 1.7 gnits
+ CLEANFILES = *~
+ 
+ noinst_LIBRARIES = libbsdfunc.a
+-noinst_HEADERS = vis.h bsdfunc.h fts.h
++noinst_HEADERS = vis.h bsdfunc.h
+ 
+ AM_CFLAGS = @EXTRA_CFLAGS@
+ 
+-libbsdfunc_a_SOURCES = vis.c strlcpy.c strmode.c fts.c
++libbsdfunc_a_SOURCES = vis.c strlcpy.c strmode.c
+diff --git a/lib/fts.c b/lib/fts.c
+deleted file mode 100644
+index 45e90ca..0000000
+--- a/lib/fts.c
++++ /dev/null
+@@ -1,1025 +0,0 @@
+-/*-
+- * Copyright (c) 1990, 1993, 1994
+- *      The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- */
+-
+-#ifdef HAVE_CONFIG_H
+-#include <config.h>
+-#endif
+-
+-#include <sys/stat.h>
+-#include <fcntl.h>
+-#include <dirent.h>
+-#include <errno.h>
+-#include <fts.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-
+-/* Largest alignment size needed, minus one.
+-   Usually long double is the worst case.  */
+-#ifndef ALIGNBYTES
+-#define ALIGNBYTES	(__alignof__ (long double) - 1)
+-#endif
+-/* Align P to that size.  */
+-#ifndef ALIGN
+-#define	ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
+-#endif
+-
+-
+-static FTSENT	*fts_alloc (FTS *, const char *, int);
+-static FTSENT	*fts_build (FTS *, int);
+-static void	 fts_lfree (FTSENT *);
+-static void	 fts_load (FTS *, FTSENT *);
+-static size_t	 fts_maxarglen (char * const *);
+-static void	 fts_padjust (FTS *, FTSENT *);
+-static int	 fts_palloc (FTS *, size_t);
+-static FTSENT	*fts_sort (FTS *, FTSENT *, int);
+-static u_short	 fts_stat (FTS *, FTSENT *, int);
+-static int      fts_safe_changedir (FTS *, FTSENT *, int, const char *);
+-
+-#ifndef MAX
+-#define MAX(a, b)	(a > b ? a : b)
+-#endif
+-
+-#define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
+-
+-#define CLR(opt)	(sp->fts_options &= ~(opt))
+-#define	ISSET(opt)	(sp->fts_options & (opt))
+-#define	SET(opt)	(sp->fts_options |= (opt))
+-
+-#define	FCHDIR(sp, fd)	(!ISSET(FTS_NOCHDIR) && fchdir(fd))
+-
+-#define	BREAD		3		/* fts_read */
+-
+-FTS *
+-fts_open(argv, koptions, compar)
+-	char * const *argv;
+-	register int koptions;
+-	int (*compar) (const FTSENT **, const FTSENT **);
+-{
+-	register FTS *sp;
+-	register FTSENT *p, *root;
+-	register int nitems;
+-	FTSENT *parent, *tmp;
+-	int len;
+-
+-tmp = NULL;	/* stop compiler whinging */
+-	/* Options check. */
+-	if (koptions & ~FTS_OPTIONMASK) {
+-		errno = EINVAL;
+-		return (NULL);
+-	}
+-
+-	/* Allocate/initialize the stream */
+-	if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
+-		return (NULL);
+-	memset(sp, 0, sizeof(FTS));
+-	sp->fts_compar = (int (*) (const void *, const void *)) compar;
+-	sp->fts_options = koptions;
+-
+-	/* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+-	if (ISSET(FTS_LOGICAL))
+-		SET(FTS_NOCHDIR);
+-
+-	/*
+-	 * Start out with 1K of path space, and enough, in any case,
+-	 * to hold the user's paths.
+-	 */
+-#ifndef MAXPATHLEN
+-#define MAXPATHLEN 1024
+-#endif
+-	if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
+-		goto mem1;
+-
+-	/* Allocate/initialize root's parent. */
+-	if ((parent = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem2;
+-	parent->fts_level = FTS_ROOTPARENTLEVEL;
+-
+-	/* Allocate/initialize root(s). */
+-	for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
+-		/* Don't allow zero-length paths. */
+-		if ((len = strlen(*argv)) == 0) {
+-			errno = ENOENT;
+-			goto mem3;
+-		}
+-
+-		p = fts_alloc(sp, *argv, len);
+-		p->fts_level = FTS_ROOTLEVEL;
+-		p->fts_parent = parent;
+-		p->fts_accpath = p->fts_name;
+-		p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
+-
+-		/* Command-line "." and ".." are real directories. */
+-		if (p->fts_info == FTS_DOT)
+-			p->fts_info = FTS_D;
+-
+-		/*
+-		 * If comparison routine supplied, traverse in sorted
+-		 * order; otherwise traverse in the order specified.
+-		 */
+-		if (compar) {
+-			p->fts_link = root;
+-			root = p;
+-		} else {
+-			p->fts_link = NULL;
+-			if (root == NULL)
+-				tmp = root = p;
+-			else {
+-				tmp->fts_link = p;
+-				tmp = p;
+-			}
+-		}
+-	}
+-	if (compar && nitems > 1)
+-		root = fts_sort(sp, root, nitems);
+-
+-	/*
+-	 * Allocate a dummy pointer and make fts_read think that we've just
+-	 * finished the node before the root(s); set p->fts_info to FTS_INIT
+-	 * so that everything about the "current" node is ignored.
+-	 */
+-	if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+-		goto mem3;
+-	sp->fts_cur->fts_link = root;
+-	sp->fts_cur->fts_info = FTS_INIT;
+-
+-	/*
+-	 * If using chdir(2), grab a file descriptor pointing to dot to ensure
+-	 * that we can get back here; this could be avoided for some paths,
+-	 * but almost certainly not worth the effort.  Slashes, symbolic links,
+-	 * and ".." are all fairly nasty problems.  Note, if we can't get the
+-	 * descriptor we run anyway, just more slowly.
+-	 */
+-	if (!ISSET(FTS_NOCHDIR)
+-	    && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+-		SET(FTS_NOCHDIR);
+-
+-	return (sp);
+-
+-mem3:	fts_lfree(root);
+-	free(parent);
+-mem2:	free(sp->fts_path);
+-mem1:	free(sp);
+-	return (NULL);
+-}
+-
+-static void
+-fts_load(sp, p)
+-	FTS *sp;
+-	register FTSENT *p;
+-{
+-	register int len;
+-	register char *cp;
+-
+-	/*
+-	 * Load the stream structure for the next traversal.  Since we don't
+-	 * actually enter the directory until after the preorder visit, set
+-	 * the fts_accpath field specially so the chdir gets done to the right
+-	 * place and the user can access the first node.  From fts_open it's
+-	 * known that the path will fit.
+-	 */
+-	len = p->fts_pathlen = p->fts_namelen;
+-	memmove(sp->fts_path, p->fts_name, len + 1);
+-	if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
+-		len = strlen(++cp);
+-		memmove(p->fts_name, cp, len + 1);
+-		p->fts_namelen = len;
+-	}
+-	p->fts_accpath = p->fts_path = sp->fts_path;
+-	sp->fts_dev = p->fts_dev;
+-}
+-
+-int
+-fts_close(sp)
+-	FTS *sp;
+-{
+-	register FTSENT *freep, *p;
+-	int saved_errno;
+-
+-	/*
+-	 * This still works if we haven't read anything -- the dummy structure
+-	 * points to the root list, so we step through to the end of the root
+-	 * list which has a valid parent pointer.
+-	 */
+-	if (sp->fts_cur) {
+-		for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
+-			freep = p;
+-			p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
+-			free(freep);
+-		}
+-		free(p);
+-	}
+-
+-	/* Free up child linked list, sort array, path buffer. */
+-	if (sp->fts_child)
+-		fts_lfree(sp->fts_child);
+-	if (sp->fts_array)
+-		free(sp->fts_array);
+-	free(sp->fts_path);
+-
+-	/* Return to original directory, save errno if necessary. */
+-	if (!ISSET(FTS_NOCHDIR)) {
+-		saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
+-		(void)close(sp->fts_rfd);
+-
+-		/* Set errno and return. */
+-		if (saved_errno != 0) {
+-			/* Free up the stream pointer. */
+-			free(sp);
+-			errno = saved_errno;
+-			return (-1);
+-		}
+-	}
+-
+-	/* Free up the stream pointer. */
+-	free(sp);
+-	return (0);
+-}
+-
+-/*
+- * Special case of "/" at the end of the path so that slashes aren't
+- * appended which would cause paths to be written as "....//foo".
+- */
+-#define	NAPPEND(p)							\
+-	(p->fts_path[p->fts_pathlen - 1] == '/'				\
+-	    ? p->fts_pathlen - 1 : p->fts_pathlen)
+-
+-FTSENT *
+-fts_read(sp)
+-	register FTS *sp;
+-{
+-	register FTSENT *p, *tmp;
+-	register int instr;
+-	register char *t;
+-	int saved_errno;
+-
+-	/* If finished or unrecoverable error, return NULL. */
+-	if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+-		return (NULL);
+-
+-	/* Set current node pointer. */
+-	p = sp->fts_cur;
+-
+-	/* Save and zero out user instructions. */
+-	instr = p->fts_instr;
+-	p->fts_instr = FTS_NOINSTR;
+-
+-	/* Any type of file may be re-visited; re-stat and re-turn. */
+-	if (instr == FTS_AGAIN) {
+-		p->fts_info = fts_stat(sp, p, 0);
+-		return (p);
+-	}
+-
+-	/*
+-	 * Following a symlink -- SLNONE test allows application to see
+-	 * SLNONE and recover.  If indirecting through a symlink, have
+-	 * keep a pointer to current location.  If unable to get that
+-	 * pointer, follow fails.
+-	 */
+-	if (instr == FTS_FOLLOW &&
+-	    (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+-		p->fts_info = fts_stat(sp, p, 1);
+-		if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+-			if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
+-				p->fts_errno = errno;
+-				p->fts_info = FTS_ERR;
+-			} else
+-				p->fts_flags |= FTS_SYMFOLLOW;
+-		}
+-		return (p);
+-	}
+-
+-	/* Directory in pre-order. */
+-	if (p->fts_info == FTS_D) {
+-		/* If skipped or crossed mount point, do post-order visit. */
+-		if (instr == FTS_SKIP ||
+-		    (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
+-			if (p->fts_flags & FTS_SYMFOLLOW)
+-				(void)close(p->fts_symfd);
+-			if (sp->fts_child) {
+-				fts_lfree(sp->fts_child);
+-				sp->fts_child = NULL;
+-			}
+-			p->fts_info = FTS_DP;
+-			return (p);
+-		}
+-
+-		/* Rebuild if only read the names and now traversing. */
+-		if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
+-			CLR(FTS_NAMEONLY);
+-			fts_lfree(sp->fts_child);
+-			sp->fts_child = NULL;
+-		}
+-
+-		/*
+-		 * Cd to the subdirectory.
+-		 *
+-		 * If have already read and now fail to chdir, whack the list
+-		 * to make the names come out right, and set the parent errno
+-		 * so the application will eventually get an error condition.
+-		 * Set the FTS_DONTCHDIR flag so that when we logically change
+-		 * directories back to the parent we don't do a chdir.
+-		 *
+-		 * If haven't read do so.  If the read fails, fts_build sets
+-		 * FTS_STOP or the fts_info field of the node.
+-		 */
+-		if (sp->fts_child != NULL) {
+-			if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
+-				p->fts_errno = errno;
+-				p->fts_flags |= FTS_DONTCHDIR;
+-				for (p = sp->fts_child; p != NULL;
+-				     p = p->fts_link)
+-					p->fts_accpath =
+-					    p->fts_parent->fts_accpath;
+-			}
+-		} else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+-			if (ISSET(FTS_STOP))
+-				return (NULL);
+-			return (p);
+-		}
+-		p = sp->fts_child;
+-		sp->fts_child = NULL;
+-		goto name;
+-	}
+-
+-	/* Move to the next node on this level. */
+-next:	tmp = p;
+-	if ((p = p->fts_link) != NULL) {
+-		free(tmp);
+-
+-		/*
+-		 * If reached the top, return to the original directory (or
+-		 * the root of the tree), and load the paths for the next root.
+-		 */
+-		if (p->fts_level == FTS_ROOTLEVEL) {
+-			if (FCHDIR(sp, sp->fts_rfd)) {
+-				SET(FTS_STOP);
+-				return (NULL);
+-			}
+-			fts_load(sp, p);
+-			return (sp->fts_cur = p);
+-		}
+-
+-		/*
+-		 * User may have called fts_set on the node.  If skipped,
+-		 * ignore.  If followed, get a file descriptor so we can
+-		 * get back if necessary.
+-		 */
+-		if (p->fts_instr == FTS_SKIP)
+-			goto next;
+-		if (p->fts_instr == FTS_FOLLOW) {
+-			p->fts_info = fts_stat(sp, p, 1);
+-			if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+-				if ((p->fts_symfd =
+-				    open(".", O_RDONLY, 0)) < 0) {
+-					p->fts_errno = errno;
+-					p->fts_info = FTS_ERR;
+-				} else
+-					p->fts_flags |= FTS_SYMFOLLOW;
+-			}
+-			p->fts_instr = FTS_NOINSTR;
+-		}
+-
+-name:		t = sp->fts_path + NAPPEND(p->fts_parent);
+-		*t++ = '/';
+-		memmove(t, p->fts_name, p->fts_namelen + 1);
+-		return (sp->fts_cur = p);
+-	}
+-
+-	/* Move up to the parent node. */
+-	p = tmp->fts_parent;
+-	free(tmp);
+-
+-	if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+-		/*
+-		 * Done; free everything up and set errno to 0 so the user
+-		 * can distinguish between error and EOF.
+-		 */
+-		free(p);
+-		errno = 0;
+-		return (sp->fts_cur = NULL);
+-	}
+-
+-	/* NUL terminate the pathname. */
+-	sp->fts_path[p->fts_pathlen] = '\0';
+-
+-	/*
+-	 * Return to the parent directory.  If at a root node or came through
+-	 * a symlink, go back through the file descriptor.  Otherwise, cd up
+-	 * one directory.
+-	 */
+-	if (p->fts_level == FTS_ROOTLEVEL) {
+-		if (FCHDIR(sp, sp->fts_rfd)) {
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-	} else if (p->fts_flags & FTS_SYMFOLLOW) {
+-		if (FCHDIR(sp, p->fts_symfd)) {
+-			saved_errno = errno;
+-			(void)close(p->fts_symfd);
+-			errno = saved_errno;
+-			SET(FTS_STOP);
+-			return (NULL);
+-		}
+-		(void)close(p->fts_symfd);
+-	} else if (!(p->fts_flags & FTS_DONTCHDIR) &&
+-		   fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
+-	p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+-	return (sp->fts_cur = p);
+-}
+-
+-/*
+- * Fts_set takes the stream as an argument although it's not used in this
+- * implementation; it would be necessary if anyone wanted to add global
+- * semantics to fts using fts_set.  An error return is allowed for similar
+- * reasons.
+- */
+-/* ARGSUSED */
+-int
+-fts_set(sp, p, instr)
+-	FTS __attribute__((__unused__)) *sp;
+-	FTSENT *p;
+-	int instr;
+-{
+-sp = NULL;	/* stop compiler whinging */
+-	if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+-	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
+-		errno = EINVAL;
+-		return (1);
+-	}
+-	p->fts_instr = instr;
+-	return (0);
+-}
+-
+-/*
+- * This is the tricky part -- do not casually change *anything* in here.  The
+- * idea is to build the linked list of entries that are used by fts_children
+- * and fts_read.  There are lots of special cases.
+- *
+- * The real slowdown in walking the tree is the stat calls.  If FTS_NOSTAT is
+- * set and it's a physical walk (so that symbolic links can't be directories),
+- * we can do things quickly.  First, if it's a 4.4BSD file system, the type
+- * of the file is in the directory entry.  Otherwise, we assume that the number
+- * of subdirectories in a node is equal to the number of links to the parent.
+- * The former skips all stat calls.  The latter skips stat calls in any leaf
+- * directories and for any files after the subdirectories in the directory have
+- * been found, cutting the stat calls by about 2/3.
+- */
+-static FTSENT *
+-fts_build(sp, type)
+-	register FTS *sp;
+-	int type;
+-{
+-	register struct dirent *dp;
+-	register FTSENT *p, *head;
+-	register int nitems;
+-	FTSENT *cur, *tail;
+-	DIR *dirp;
+-	void *oldaddr;
+-	int cderrno, descend, len, level, nlinks, saved_errno,
+-	    nostat, doadjust;
+-	size_t maxlen;
+-	char *cp;
+-
+-	/* Set current node pointer. */
+-	cur = sp->fts_cur;
+-
+-	/*
+-	 * Open the directory for reading.  If this fails, we're done.
+-	 * If being called from fts_read, set the fts_info field.
+-	 */
+-       if ((dirp = opendir(cur->fts_accpath)) == NULL) {
+-		if (type == BREAD) {
+-			cur->fts_info = FTS_DNR;
+-			cur->fts_errno = errno;
+-		}
+-		return (NULL);
+-	}
+-
+-	/*
+-	 * Nlinks is the number of possible entries of type directory in the
+-	 * directory if we're cheating on stat calls, 0 if we're not doing
+-	 * any stat calls at all, -1 if we're doing stats on everything.
+-	 */
+-	nlinks = -1;
+-	nostat = 0;
+-
+-	/*
+-	 * If we're going to need to stat anything or we want to descend
+-	 * and stay in the directory, chdir.  If this fails we keep going,
+-	 * but set a flag so we don't chdir after the post-order visit.
+-	 * We won't be able to stat anything, but we can still return the
+-	 * names themselves.  Note, that since fts_read won't be able to
+-	 * chdir into the directory, it will have to return different path
+-	 * names than before, i.e. "a/b" instead of "b".  Since the node
+-	 * has already been visited in pre-order, have to wait until the
+-	 * post-order visit to return the error.  There is a special case
+-	 * here, if there was nothing to stat then it's not an error to
+-	 * not be able to stat.  This is all fairly nasty.  If a program
+-	 * needed sorted entries or stat information, they had better be
+-	 * checking FTS_NS on the returned nodes.
+-	 */
+-	cderrno = 0;
+-	if (nlinks || type == BREAD) {
+-		if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
+-			if (nlinks && type == BREAD)
+-				cur->fts_errno = errno;
+-			cur->fts_flags |= FTS_DONTCHDIR;
+-			descend = 0;
+-			cderrno = errno;
+-			(void)closedir(dirp);
+-			dirp = NULL;
+-		} else
+-			descend = 1;
+-	} else
+-		descend = 0;
+-
+-	/*
+-	 * Figure out the max file name length that can be stored in the
+-	 * current path -- the inner loop allocates more path as necessary.
+-	 * We really wouldn't have to do the maxlen calculations here, we
+-	 * could do them in fts_read before returning the path, but it's a
+-	 * lot easier here since the length is part of the dirent structure.
+-	 *
+-	 * If not changing directories set a pointer so that can just append
+-	 * each new name into the path.
+-	 */
+-	len = NAPPEND(cur);
+-	if (ISSET(FTS_NOCHDIR)) {
+-		cp = sp->fts_path + len;
+-		*cp++ = '/';
+-	} else {
+-		/* GCC, you're too verbose. */
+-		cp = NULL;
+-	}
+-	len++;
+-	maxlen = sp->fts_pathlen - len;
+-
+-	level = cur->fts_level + 1;
+-
+-	/* Read the directory, attaching each entry to the `link' pointer. */
+-	doadjust = 0;
+-	for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+-		if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+-			continue;
+-
+-		if ((p = fts_alloc(sp, dp->d_name, (int)_D_EXACT_NAMLEN (dp))) == NULL)
+-			goto mem1;
+-		if (_D_EXACT_NAMLEN (dp) >= maxlen) {/* include space for NUL */
+-			oldaddr = sp->fts_path;
+-			if (fts_palloc(sp, _D_EXACT_NAMLEN (dp) + len + 1)) {
+-				/*
+-				 * No more memory for path or structures.  Save
+-				 * errno, free up the current structure and the
+-				 * structures already allocated.
+-				 */
+-mem1:				saved_errno = errno;
+-				if (p)
+-					free(p);
+-				fts_lfree(head);
+-				(void)closedir(dirp);
+-				cur->fts_info = FTS_ERR;
+-				SET(FTS_STOP);
+-				errno = saved_errno;
+-				return (NULL);
+-			}
+-			/* Did realloc() change the pointer? */
+-			if (oldaddr != sp->fts_path) {
+-				doadjust = 1;
+-				if (ISSET(FTS_NOCHDIR))
+-					cp = sp->fts_path + len;
+-			}
+-			maxlen = sp->fts_pathlen - len;
+-		}
+-
+-		if (len + _D_EXACT_NAMLEN (dp) >= 0x10000) {
+-			/*
+-			 * In an FTSENT, fts_pathlen is a u_short so it is
+-			 * possible to wraparound here.  If we do, free up
+-			 * the current structure and the structures already
+-			 * allocated, then error out with ENAMETOOLONG.
+-			 */
+-			free(p);
+-			fts_lfree(head);
+-			(void)closedir(dirp);
+-			cur->fts_info = FTS_ERR;
+-			SET(FTS_STOP);
+-			errno = ENAMETOOLONG;
+-			return (NULL);
+-		}
+-		p->fts_level = level;
+-		p->fts_parent = sp->fts_cur;
+-		p->fts_pathlen = len + _D_EXACT_NAMLEN (dp);
+-
+-#if defined FTS_WHITEOUT && 0
+-		if (dp->d_type == DT_WHT)
+-			p->fts_flags |= FTS_ISW;
+-#endif
+-
+-		if (cderrno) {
+-			if (nlinks) {
+-				p->fts_info = FTS_NS;
+-				p->fts_errno = cderrno;
+-			} else
+-				p->fts_info = FTS_NSOK;
+-			p->fts_accpath = cur->fts_accpath;
+-		} else if (nlinks == 0
+-#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
+-			   || (nostat &&
+-			       dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
+-#endif
+-		    ) {
+-			p->fts_accpath =
+-			    ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
+-			p->fts_info = FTS_NSOK;
+-		} else {
+-			/* Build a file name for fts_stat to stat. */
+-			if (ISSET(FTS_NOCHDIR)) {
+-				p->fts_accpath = p->fts_path;
+-				memmove(cp, p->fts_name, p->fts_namelen + 1);
+-			} else
+-				p->fts_accpath = p->fts_name;
+-			/* Stat it. */
+-			p->fts_info = fts_stat(sp, p, 0);
+-
+-			/* Decrement link count if applicable. */
+-			if (nlinks > 0 && (p->fts_info == FTS_D ||
+-			    p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
+-				--nlinks;
+-		}
+-
+-		/* We walk in directory order so "ls -f" doesn't get upset. */
+-		p->fts_link = NULL;
+-		if (head == NULL)
+-			head = tail = p;
+-		else {
+-			tail->fts_link = p;
+-			tail = p;
+-		}
+-		++nitems;
+-	}
+-	if (dirp)
+-		(void)closedir(dirp);
+-
+-	/*
+-	 * If realloc() changed the address of the path, adjust the
+-	 * addresses for the rest of the tree and the dir list.
+-	 */
+-	if (doadjust)
+-		fts_padjust(sp, head);
+-
+-	/*
+-	 * If not changing directories, reset the path back to original
+-	 * state.
+-	 */
+-	if (ISSET(FTS_NOCHDIR)) {
+-		if (len == sp->fts_pathlen || nitems == 0)
+-			--cp;
+-		*cp = '\0';
+-	}
+-
+-	/*
+-	 * If descended after called from fts_children or after called from
+-	 * fts_read and nothing found, get back.  At the root level we use
+-	 * the saved fd; if one of fts_open()'s arguments is a relative path
+-	 * to an empty directory, we wind up here with no other way back.  If
+-	 * can't get back, we're done.
+-	 */
+-	if (descend && nitems == 0 &&
+-	    (cur->fts_level == FTS_ROOTLEVEL ?
+-	     FCHDIR(sp, sp->fts_rfd) :
+-	     fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
+-		cur->fts_info = FTS_ERR;
+-		SET(FTS_STOP);
+-		return (NULL);
+-	}
+-
+-	/* If didn't find anything, return NULL. */
+-	if (!nitems) {
+-		if (type == BREAD)
+-			cur->fts_info = FTS_DP;
+-		return (NULL);
+-	}
+-
+-	/* Sort the entries. */
+-	if (sp->fts_compar && nitems > 1)
+-		head = fts_sort(sp, head, nitems);
+-	return (head);
+-}
+-
+-static u_short
+-fts_stat(sp, p, follow)
+-	FTS *sp;
+-	register FTSENT *p;
+-	int follow;
+-{
+-	register FTSENT *t;
+-	register dev_t dev;
+-	register ino_t ino;
+-	struct stat *sbp;
+-	int saved_errno;
+-
+-	/* If user needs stat info, stat buffer already allocated. */
+-	sbp = p->fts_statp;
+-
+-#if defined FTS_WHITEOUT && 0
+-	/* check for whiteout */
+-	if (p->fts_flags & FTS_ISW) {
+-		if (sbp != &sb) {
+-			memset(sbp, '\0', sizeof (*sbp));
+-			sbp->st_mode = S_IFWHT;
+-		}
+-		return (FTS_W);
+-       }
+-#endif
+-
+-	/*
+-	 * If doing a logical walk, or application requested FTS_FOLLOW, do
+-	 * a stat(2).  If that fails, check for a non-existent symlink.  If
+-	 * fail, set the errno from the stat call.
+-	 */
+-	if (ISSET(FTS_LOGICAL) || follow) {
+-		if (stat(p->fts_accpath, sbp)) {
+-			saved_errno = errno;
+-			if (!lstat(p->fts_accpath, sbp)) {
+-				errno = 0;
+-				return (FTS_SLNONE);
+-			}
+-			p->fts_errno = saved_errno;
+-			goto err;
+-		}
+-	} else if (lstat(p->fts_accpath, sbp)) {
+-		p->fts_errno = errno;
+-err:		memset(sbp, 0, sizeof(struct stat));
+-		return (FTS_NS);
+-	}
+-
+-	if (S_ISDIR(sbp->st_mode)) {
+-		/*
+-		 * Set the device/inode.  Used to find cycles and check for
+-		 * crossing mount points.  Also remember the link count, used
+-		 * in fts_build to limit the number of stat calls.  It is
+-		 * understood that these fields are only referenced if fts_info
+-		 * is set to FTS_D.
+-		 */
+-		dev = p->fts_dev = sbp->st_dev;
+-		ino = p->fts_ino = sbp->st_ino;
+-		p->fts_nlink = sbp->st_nlink;
+-
+-		if (ISDOT(p->fts_name))
+-			return (FTS_DOT);
+-
+-		/*
+-		 * Cycle detection is done by brute force when the directory
+-		 * is first encountered.  If the tree gets deep enough or the
+-		 * number of symbolic links to directories is high enough,
+-		 * something faster might be worthwhile.
+-		 */
+-		for (t = p->fts_parent;
+-		    t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+-			if (ino == t->fts_ino && dev == t->fts_dev) {
+-				p->fts_cycle = t;
+-				return (FTS_DC);
+-			}
+-		return (FTS_D);
+-	}
+-	if (S_ISLNK(sbp->st_mode))
+-		return (FTS_SL);
+-	if (S_ISREG(sbp->st_mode))
+-		return (FTS_F);
+-	return (FTS_DEFAULT);
+-}
+-
+-static FTSENT *
+-fts_sort(sp, head, nitems)
+-	FTS *sp;
+-	FTSENT *head;
+-	register int nitems;
+-{
+-	register FTSENT **ap, *p;
+-
+-	/*
+-	 * Construct an array of pointers to the structures and call qsort(3).
+-	 * Reassemble the array in the order returned by qsort.  If unable to
+-	 * sort for memory reasons, return the directory entries in their
+-	 * current order.  Allocate enough space for the current needs plus
+-	 * 40 so don't realloc one entry at a time.
+-	 */
+-	if (nitems > sp->fts_nitems) {
+-		struct _ftsent **a;
+-
+-		sp->fts_nitems = nitems + 40;
+-		if ((a = realloc(sp->fts_array,
+- 		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
+-			free(sp->fts_array);
+-			sp->fts_array = NULL;
+-			sp->fts_nitems = 0;
+-			return (head);
+-		}
+-		sp->fts_array = a;
+-	}
+-	for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+-		*ap++ = p;
+-	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+-	for (head = *(ap = sp->fts_array); --nitems; ++ap)
+-		ap[0]->fts_link = ap[1];
+-	ap[0]->fts_link = NULL;
+-	return (head);
+-}
+-
+-static FTSENT *
+-fts_alloc(sp, name, namelen)
+-	FTS *sp;
+-	const char *name;
+-	register int namelen;
+-{
+-	register FTSENT *p;
+-	size_t len;
+-
+-	/*
+-	 * The file name is a variable length array and no stat structure is
+-	 * necessary if the user has set the nostat bit.  Allocate the FTSENT
+-	 * structure, the file name and the stat structure in one chunk, but
+-	 * be careful that the stat structure is reasonably aligned.  Since the
+-	 * fts_name field is declared to be of size 1, the fts_name pointer is
+-	 * namelen + 2 before the first possible address of the stat structure.
+-	 */
+-	len = sizeof(FTSENT) + namelen;
+-	len += sizeof(struct stat) + ALIGNBYTES;
+-	if ((p = malloc(len)) == NULL)
+-		return (NULL);
+-
+-	/* Copy the name and guarantee NUL termination. */
+-	memmove(p->fts_name, name, namelen);
+-	p->fts_name[namelen] = '\0';
+-
+-	p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+-	p->fts_namelen = namelen;
+-	p->fts_path = sp->fts_path;
+-	p->fts_errno = 0;
+-	p->fts_flags = 0;
+-	p->fts_instr = FTS_NOINSTR;
+-	p->fts_number = 0;
+-	p->fts_pointer = NULL;
+-	return (p);
+-}
+-
+-static void
+-fts_lfree(head)
+-	register FTSENT *head;
+-{
+-	register FTSENT *p;
+-
+-	/* Free a linked list of structures. */
+-	while ((p = head)) {
+-		head = head->fts_link;
+-		free(p);
+-	}
+-}
+-
+-/*
+- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
+- * though the kernel won't resolve them.  Add the size (not just what's needed)
+- * plus 256 bytes so don't realloc the path 2 bytes at a time.
+- */
+-static int
+-fts_palloc(sp, more)
+-	FTS *sp;
+-	size_t more;
+-{
+-	char *p;
+-
+-	sp->fts_pathlen += more + 256;
+-	/*
+-	 * Check for possible wraparound.  In an FTS, fts_pathlen is
+-	 * a signed int but in an FTSENT it is an unsigned short.
+-	 * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
+-	 */
+-	if (sp->fts_pathlen < 0 || sp->fts_pathlen >= 0x10000) {
+-		if (sp->fts_path) {
+-			free(sp->fts_path);
+-			sp->fts_path = NULL;
+-		}
+-		sp->fts_path = NULL;
+-		errno = ENAMETOOLONG;
+-		return (1);
+-	}
+-	p = realloc(sp->fts_path, sp->fts_pathlen);
+-	if (p == NULL) {
+-		free(sp->fts_path);
+-		sp->fts_path = NULL;
+-		return 1;
+-	}
+-	sp->fts_path = p;
+-	return 0;
+-}
+-
+-/*
+- * When the path is realloc'd, have to fix all of the pointers in structures
+- * already returned.
+- */
+-static void
+-fts_padjust(sp, head)
+-	FTS *sp;
+-	FTSENT *head;
+-{
+-	FTSENT *p;
+-	char *addr = sp->fts_path;
+-
+-#define	ADJUST(p) do {							\
+-	if ((p)->fts_accpath != (p)->fts_name) {			\
+-		(p)->fts_accpath =					\
+-		    (char *)addr + ((p)->fts_accpath - (p)->fts_path);	\
+-	}								\
+-	(p)->fts_path = addr;						\
+-} while (0)
+-	/* Adjust the current set of children. */
+-	for (p = sp->fts_child; p; p = p->fts_link)
+-		ADJUST(p);
+-
+-	/* Adjust the rest of the tree, including the current level. */
+-	for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
+-		ADJUST(p);
+-		p = p->fts_link ? p->fts_link : p->fts_parent;
+-	}
+-}
+-
+-static size_t
+-fts_maxarglen(argv)
+-	char * const *argv;
+-{
+-	size_t len, max;
+-
+-	for (max = 0; *argv; ++argv)
+-		if ((len = strlen(*argv)) > max)
+-			max = len;
+-	return (max + 1);
+-}
+-
+-/*
+- * Change to dir specified by fd or p->fts_accpath without getting
+- * tricked by someone changing the world out from underneath us.
+- * Assumes p->fts_dev and p->fts_ino are filled in.
+- */
+-static int
+-fts_safe_changedir(sp, p, fd, path)
+-	FTS *sp;
+-	FTSENT *p;
+-	int fd;
+-	const char *path;
+-{
+-	int ret, oerrno, newfd;
+-	struct stat sb;
+-
+-	newfd = fd;
+-	if (ISSET(FTS_NOCHDIR))
+-		return (0);
+-	if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0)
+-		return (-1);
+-	if (fstat(newfd, &sb)) {
+-		ret = -1;
+-		goto bail;
+-	}
+-	if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
+-		errno = ENOENT;		/* disinformation */
+-		ret = -1;
+-		goto bail;
+-	}
+-	ret = fchdir(newfd);
+-bail:
+-	oerrno = errno;
+-	if (fd < 0)
+-		(void)close(newfd);
+-	errno = oerrno;
+-	return (ret);
+-}
+diff --git a/lib/fts.h b/lib/fts.h
+deleted file mode 100644
+index 58846b9..0000000
+--- a/lib/fts.h
++++ /dev/null
+@@ -1,131 +0,0 @@
+-/*
+- * Copyright (c) 1989, 1993
+- *	The Regents of the University of California.  All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 4. Neither the name of the University nor the names of its contributors
+- *    may be used to endorse or promote products derived from this software
+- *    without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- *
+- *	@(#)fts.h	8.3 (Berkeley) 8/14/94
+- */
+-
+-#ifndef	_FTS_H
+-#define	_FTS_H 1
+-
+-#include <features.h>
+-#include <sys/types.h>
+-
+-typedef struct {
+-	struct _ftsent *fts_cur;	/* current node */
+-	struct _ftsent *fts_child;	/* linked list of children */
+-	struct _ftsent **fts_array;	/* sort array */
+-	dev_t fts_dev;			/* starting device # */
+-	char *fts_path;			/* path for this descent */
+-	int fts_rfd;			/* fd for root */
+-	int fts_pathlen;		/* sizeof(path) */
+-	int fts_nitems;			/* elements in the sort array */
+-	int (*fts_compar) (const void *, const void *); /* compare fn */
+-
+-#define	FTS_COMFOLLOW	0x0001		/* follow command line symlinks */
+-#define	FTS_LOGICAL	0x0002		/* logical walk */
+-#define	FTS_NOCHDIR	0x0004		/* don't change directories */
+-#define	FTS_NOSTAT	0x0008		/* don't get stat info */
+-#define	FTS_PHYSICAL	0x0010		/* physical walk */
+-#define	FTS_SEEDOT	0x0020		/* return dot and dot-dot */
+-#define	FTS_XDEV	0x0040		/* don't cross devices */
+-#define FTS_WHITEOUT	0x0080		/* return whiteout information */
+-#define	FTS_OPTIONMASK	0x00ff		/* valid user option mask */
+-
+-#define	FTS_NAMEONLY	0x0100		/* (private) child names only */
+-#define	FTS_STOP	0x0200		/* (private) unrecoverable error */
+-	int fts_options;		/* fts_open options, global flags */
+-} FTS;
+-
+-typedef struct _ftsent {
+-	struct _ftsent *fts_cycle;	/* cycle node */
+-	struct _ftsent *fts_parent;	/* parent directory */
+-	struct _ftsent *fts_link;	/* next file in directory */
+-	long fts_number;	        /* local numeric value */
+-	void *fts_pointer;	        /* local address value */
+-	char *fts_accpath;		/* access path */
+-	char *fts_path;			/* root path */
+-	int fts_errno;			/* errno for this node */
+-	int fts_symfd;			/* fd for symlink */
+-	u_short fts_pathlen;		/* strlen(fts_path) */
+-	u_short fts_namelen;		/* strlen(fts_name) */
+-
+-	ino_t fts_ino;			/* inode */
+-	dev_t fts_dev;			/* device */
+-	nlink_t fts_nlink;		/* link count */
+-
+-#define	FTS_ROOTPARENTLEVEL	-1
+-#define	FTS_ROOTLEVEL		 0
+-	short fts_level;		/* depth (-1 to N) */
+-
+-#define	FTS_D		 1		/* preorder directory */
+-#define	FTS_DC		 2		/* directory that causes cycles */
+-#define	FTS_DEFAULT	 3		/* none of the above */
+-#define	FTS_DNR		 4		/* unreadable directory */
+-#define	FTS_DOT		 5		/* dot or dot-dot */
+-#define	FTS_DP		 6		/* postorder directory */
+-#define	FTS_ERR		 7		/* error; errno is set */
+-#define	FTS_F		 8		/* regular file */
+-#define	FTS_INIT	 9		/* initialized only */
+-#define	FTS_NS		10		/* stat(2) failed */
+-#define	FTS_NSOK	11		/* no stat(2) requested */
+-#define	FTS_SL		12		/* symbolic link */
+-#define	FTS_SLNONE	13		/* symbolic link without target */
+-#define FTS_W		14		/* whiteout object */
+-	u_short fts_info;		/* user flags for FTSENT structure */
+-
+-#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
+-#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
+-	u_short fts_flags;		/* private flags for FTSENT structure */
+-
+-#define	FTS_AGAIN	 1		/* read node again */
+-#define	FTS_FOLLOW	 2		/* follow symbolic link */
+-#define	FTS_NOINSTR	 3		/* no instructions */
+-#define	FTS_SKIP	 4		/* discard node */
+-	u_short fts_instr;		/* fts_set() instructions */
+-
+-	struct stat *fts_statp;		/* stat(2) information */
+-	char fts_name[1];		/* file name */
+-} FTSENT;
+-
+-__BEGIN_DECLS
+-
+-#define fts_children pax_fts_children
+-#define fts_close pax_fts_close
+-#define fts_open pax_fts_open
+-#define fts_read pax_fts_read
+-#define fts_set pax_fts_set
+-
+-FTSENT	*fts_children (FTS *, int);
+-int	 fts_close (FTS *);
+-FTS	*fts_open (char * const *, int,
+-		   int (*)(const FTSENT **, const FTSENT **));
+-FTSENT	*fts_read (FTS *);
+-int	 fts_set (FTS *, FTSENT *, int) __THROW;
+-__END_DECLS
+-
+-#endif /* fts.h */
+diff --git a/lib/vis.h b/lib/vis.h
+index d34d342..71fa5f4 100644
+--- a/lib/vis.h
++++ b/lib/vis.h
+@@ -73,14 +73,19 @@
+  */
+ #define	UNVIS_END	1	/* no more characters */
+ 
+-#include <sys/cdefs.h>
++#ifndef __P
++#define __P(x) x
++#endif
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ char	*vis __P((char *, int, int, int));
+ int	strvis __P((char *, const char *, int));
+ int	strvisx __P((char *, const char *, size_t, int));
+ int	strunvis __P((char *, const char *));
+ int	unvis __P((char *, char, int *, int));
+-__END_DECLS
+-
++#ifdef __cplusplus
++}
++#endif
+ #endif /* !_VIS_H_ */
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5ef52a3..227cdef 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -22,4 +22,4 @@ pax_SOURCES = ar_io.c ar_subs.c buf_subs.c cache.c cpio.c\
+ 	file_subs.c ftree.c gen_subs.c getoldopt.c options.c\
+ 	pat_rep.c pax.c sel_subs.c tables.c tar.c tty_subs.c
+ 
+-pax_LDADD = $(top_builddir)/lib/libbsdfunc.a
++pax_LDADD = $(top_builddir)/lib/libbsdfunc.a -lfts
+diff --git a/src/extern.h b/src/extern.h
+index 361fa81..3ed365d 100644
+--- a/src/extern.h
++++ b/src/extern.h
+@@ -37,8 +37,6 @@
+  * External references from each source file
+  */
+ 
+-#include <sys/cdefs.h>
+-
+ /*
+  * ar_io.c
+  */
+diff --git a/src/file_subs.c b/src/file_subs.c
+index 5590ff1..15bc339 100644
+--- a/src/file_subs.c
++++ b/src/file_subs.c
+@@ -52,7 +52,7 @@
+ #include "extern.h"
+ 
+ static int
+-mk_link __P((register char *,register struct stat *,register char *, int));
++mk_link (register char *,register struct stat *,register char *, int);
+ 
+ /*
+  * routines that deal with file operations such as: creating, removing;
+diff --git a/src/tables.c b/src/tables.c
+index 2275bf7..8fddca4 100644
+--- a/src/tables.c
++++ b/src/tables.c
+@@ -39,7 +39,7 @@
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch b/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
new file mode 100644
index 0000000..58ac9ce
--- /dev/null
+++ b/meta/recipes-extended/pax/pax/0001-use-strtoll-instead-of-strtoq.patch
@@ -0,0 +1,33 @@
+From b1f50320332c9c90fa33ab136ef0ec2d12cda461 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 12:30:52 -0800
+Subject: [PATCH] use strtoll instead of strtoq
+
+Use LLONG_MAX instead of LONG_LONG_MAX
+LONG_LONG_MAX is GNU specific
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ src/options.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/options.c b/src/options.c
+index da8b4cf..c663b4e 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -1547,8 +1547,8 @@ str_offt (char *val)
+ 
+ #if (SIZEOF_LONG == 4 && SIZEOF_OFF_T == 8) \
+     || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64)
+-  num = strtoq (val, &expr, 0);
+-  if ((num == LONG_LONG_MAX) || (num <= 0) || (expr == val))
++  num = strtoll (val, &expr, 0);
++  if ((num == LLONG_MAX) || (num <= 0) || (expr == val))
+ #else
+   num = strtol (val, &expr, 0);
+   if ((num == LONG_MAX) || (num <= 0) || (expr == val))
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/pax/pax_3.4.bb b/meta/recipes-extended/pax/pax_3.4.bb
index ad04871..cee52e3 100644
--- a/meta/recipes-extended/pax/pax_3.4.bb
+++ b/meta/recipes-extended/pax/pax_3.4.bb
@@ -12,11 +12,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4b0b674dfdc56daa3832d4069b820ea0 \
 SECTION = "base"
 PR = "r2"
 
+DEPENDS_append_libc-musl = " fts "
+
 SRC_URI = "http://pkgs.fedoraproject.org/repo/pkgs/${BPN}/${BP}.tar.bz2/fbd9023b590b45ac3ade95870702a0d6/${BP}.tar.bz2 \
 	file://fix_for_compile_with_gcc-4.6.0.patch \
 	file://pax-3.4_fix_for_x32.patch"
 
+SRC_URI_append_libc-musl = " file://0001-Fix-build-with-musl.patch \
+                             file://0001-use-strtoll-instead-of-strtoq.patch \
+                           "
+
 SRC_URI[md5sum] = "fbd9023b590b45ac3ade95870702a0d6"
 SRC_URI[sha256sum] = "ac3c06048e02828077cf7757d3d142241429238893b91d529af29a2e8cc5623b"
 
+# see https://lists.yoctoproject.org/pipermail/poky/2013-December/009435.html
+# We should ideally drop ac_cv_sizeof_off_t from site files but until then
+EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'ac_cv_sizeof_off_t=8', '', d)}"
+
 inherit autotools
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 43/53] iputils: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (41 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 42/53] pax: Fix build with musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 44/53] libuser: Fix build when secure getenv is not there Khem Raj
                   ` (12 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../files/0001-Fix-header-inclusion-for-musl.patch | 92 ++++++++++++++++++++++
 meta/recipes-extended/iputils/iputils_s20121221.bb |  1 +
 2 files changed, 93 insertions(+)
 create mode 100644 meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch

diff --git a/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch b/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
new file mode 100644
index 0000000..20ef07e
--- /dev/null
+++ b/meta/recipes-extended/iputils/files/0001-Fix-header-inclusion-for-musl.patch
@@ -0,0 +1,92 @@
+From be0bb81d72fea4d20da74f4f2236aa145684f332 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 6 Jan 2016 14:14:22 -0800
+Subject: [PATCH] Fix header inclusion for musl
+
+Fix errors e.g.
+
+In file included from tracepath.c:17:0:
+/usr/include/linux/errqueue.h:33:18:
+error: array type has incomplete element type 'struct timespec'
+  struct timespec ts[3];
+                  ^
+tracepath.c: In function 'main':
+tracepath.c:329:16: error: 'INT_MAX' undeclared (first use in this
+function)
+      overhead, INT_MAX);
+                ^
+tracepath.c:329:16: note: each undeclared identifier is reported only
+once for each function it appears in
+Makefile:131: recipe for target 'tracepath.o' failed
+make: *** [tracepath.o] Error 1
+
+ping_common.c: In function 'main_loop':
+ping_common.c:756:15: error: 'HZ' undeclared (first use in this
+function)
+    if (1000 % HZ == 0 ? next <= 1000 / HZ : (next < INT_MAX / HZ &&
+next * HZ <= 1000)) {
+
+protocols/timed.h is not needed and is absent in musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ clockdiff.c   | 1 -
+ ping_common.c | 1 +
+ tracepath.c   | 2 ++
+ tracepath6.c  | 1 +
+ 4 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/clockdiff.c b/clockdiff.c
+index 7c1ea1b..1d6341e 100644
+--- a/clockdiff.c
++++ b/clockdiff.c
+@@ -14,7 +14,6 @@
+ #include <netinet/ip.h>
+ #include <netinet/ip_icmp.h>
+ #define TSPTYPES
+-#include <protocols/timed.h>
+ #include <fcntl.h>
+ #include <netdb.h>
+ #include <arpa/inet.h>
+diff --git a/ping_common.c b/ping_common.c
+index 7f82851..3ce699d 100644
+--- a/ping_common.c
++++ b/ping_common.c
+@@ -2,6 +2,7 @@
+ #include <ctype.h>
+ #include <sched.h>
+ #include <math.h>
++#include <asm-generic/param.h>
+ 
+ int options;
+ 
+diff --git a/tracepath.c b/tracepath.c
+index 89e6d16..c9d6ddd 100644
+--- a/tracepath.c
++++ b/tracepath.c
+@@ -12,6 +12,8 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <limits.h>
++#include <time.h>
+ #include <sys/socket.h>
+ #include <linux/types.h>
+ #include <linux/errqueue.h>
+diff --git a/tracepath6.c b/tracepath6.c
+index 126fadf..9d5745c 100644
+--- a/tracepath6.c
++++ b/tracepath6.c
+@@ -12,6 +12,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <limits.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netinet/icmp6.h>
+-- 
+2.6.4
+
diff --git a/meta/recipes-extended/iputils/iputils_s20121221.bb b/meta/recipes-extended/iputils/iputils_s20121221.bb
index 49913d6..225c28b 100644
--- a/meta/recipes-extended/iputils/iputils_s20121221.bb
+++ b/meta/recipes-extended/iputils/iputils_s20121221.bb
@@ -19,6 +19,7 @@ SRC_URI = "http://www.skbuff.net/iputils/${BPN}-${PV}.tar.bz2 \
            file://debian/targets.diff \
            file://nsgmls-path-fix.patch \
            file://fix-build-command-line-argument-with-gnutls.patch \
+           file://0001-Fix-header-inclusion-for-musl.patch \
           "
 
 SRC_URI[md5sum] = "6072aef64205720dd1893b375e184171"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 44/53] libuser: Fix build when secure getenv is not there
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (42 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 43/53] iputils: " Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 45/53] iproute2: Fix build with musl Khem Raj
                   ` (11 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Fixes build on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../libuser/libuser/0001-Check-for-issetugid.patch | 62 ++++++++++++++++++++++
 .../libuser/0002-remove-unused-execinfo.h.patch    | 27 ++++++++++
 meta/recipes-extended/libuser/libuser_0.62.bb      |  4 +-
 3 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
 create mode 100644 meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch

diff --git a/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
new file mode 100644
index 0000000..79756b9
--- /dev/null
+++ b/meta/recipes-extended/libuser/libuser/0001-Check-for-issetugid.patch
@@ -0,0 +1,62 @@
+From d0537cb7f2dc5877700ad78dfd191515379d4edc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 02:22:51 +0000
+Subject: [PATCH 1/2] Check for issetugid()
+
+If secure version of getenv is not there then we can use
+issetugid() as aid to call getenv()
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac |  1 +
+ lib/config.c | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1ded1a2..ee19e1f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -125,6 +125,7 @@ AC_TYPE_OFF_T
+ AC_TYPE_SIZE_T
+ 
+ AC_CHECK_FUNCS([__secure_getenv secure_getenv])
++AC_CHECK_FUNCS([issetugid])
+ 
+ # Modify CFLAGS after all tests are run (some of them could fail because
+ # of the -Werror).
+diff --git a/lib/config.c b/lib/config.c
+index 29e7120..30f9daf 100644
+--- a/lib/config.c
++++ b/lib/config.c
+@@ -44,8 +44,10 @@
+ #  define safe_getenv(string) secure_getenv(string)
+ #elif defined(HAVE___SECURE_GETENV)
+ #  define safe_getenv(string) __secure_getenv(string)
++#elif defined(HAVE_ISSETUGID)
++#  define safe_getenv(string) safe_getenv_issetugid(string)
+ #else
+-#  error Neither secure_getenv not __secure_getenv are available
++#  error None of secure_getenv, __secure_getenv, or issetugid is available
+ #endif
+ 
+ struct config_config {
+@@ -59,6 +61,14 @@ struct config_key {
+ 	GList *values;
+ };
+ 
++static const char*
++safe_getenv_issetugid(const char* name)
++{
++	if (issetugid ())
++		return 0;
++	return getenv (name);
++}
++
+ /* Compare two section names */
+ static int
+ compare_section_names(gconstpointer a, gconstpointer b)
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
new file mode 100644
index 0000000..4bc0219
--- /dev/null
+++ b/meta/recipes-extended/libuser/libuser/0002-remove-unused-execinfo.h.patch
@@ -0,0 +1,27 @@
+From 4b2f81f307ffeac12956e5c16e894e5ebb937ea5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 02:26:00 +0000
+Subject: [PATCH 2/2] remove unused execinfo.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ lib/error.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/lib/error.c b/lib/error.c
+index a5ec30a..443e601 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -18,7 +18,6 @@
+ #include <config.h>
+ #include <sys/types.h>
+ #include <errno.h>
+-#include <execinfo.h>
+ #include <libintl.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
+-- 
+2.7.0
+
diff --git a/meta/recipes-extended/libuser/libuser_0.62.bb b/meta/recipes-extended/libuser/libuser_0.62.bb
index 4caa8a1..2d5bd35 100644
--- a/meta/recipes-extended/libuser/libuser_0.62.bb
+++ b/meta/recipes-extended/libuser/libuser_0.62.bb
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
 SECTION = "base"
 
 SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \
-           "
+           file://0001-Check-for-issetugid.patch \
+           file://0002-remove-unused-execinfo.h.patch \
+          "
 
 SRC_URI[md5sum] = "63e5e5c551e99dc5302b40b80bd6d4f2"
 SRC_URI[sha256sum] = "a58ff4fabb01a25043b142185a33eeea961109dd60d4b40b6a9df4fa3cace20b"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 45/53] iproute2: Fix build with musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (43 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 44/53] libuser: Fix build when secure getenv is not there Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 46/53] irda-utils: Fix header inclusions Khem Raj
                   ` (10 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../iproute2/iproute2/iproute2-4.3.0-musl.patch    | 97 ++++++++++++++++++++++
 .../iproute2/iproute2_4.3.0.bb                     |  1 +
 2 files changed, 98 insertions(+)
 create mode 100644 meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch

diff --git a/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch b/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
new file mode 100644
index 0000000..1b415a5
--- /dev/null
+++ b/meta/recipes-connectivity/iproute2/iproute2/iproute2-4.3.0-musl.patch
@@ -0,0 +1,97 @@
+From 48596709d8ab59727b79a5c6db33ebb251c36543 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Thu, 19 Nov 2015 17:44:25 +0100
+Subject: [PATCH] Avoid in6_addr redefinition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Due to both <netinet/in.h> and <linux/in6.h> being included, the
+in6_addr is being redefined: once from the C library headers and once
+from the kernel headers. This causes some build failures with for
+example the musl C library:
+
+In file included from ../include/linux/xfrm.h:4:0,
+                 from xfrm.h:29,
+                 from ipxfrm.c:39:
+../include/linux/in6.h:32:8: error: redefinition of ‘struct in6_addr’
+ struct in6_addr {
+        ^
+In file included from .../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netdb.h:9:0,
+                 from ipxfrm.c:34:
+.../output/host/usr/x86_64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:24:8: note: originally defined here
+ struct in6_addr
+        ^
+
+In order to fix this, use just the C library header <netinet/in.h>.
+
+Original patch taken from
+http://git.alpinelinux.org/cgit/aports/tree/main/iproute2/musl-fixes.patch.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+Upstream-Status: Pending
+
+ include/libiptc/ipt_kernel_headers.h | 2 --
+ include/linux/if_bridge.h            | 1 -
+ include/linux/netfilter.h            | 2 --
+ include/linux/xfrm.h                 | 1 -
+ 4 files changed, 6 deletions(-)
+
+diff --git a/include/libiptc/ipt_kernel_headers.h b/include/libiptc/ipt_kernel_headers.h
+index 7e87828..9566be5 100644
+--- a/include/libiptc/ipt_kernel_headers.h
++++ b/include/libiptc/ipt_kernel_headers.h
+@@ -15,12 +15,10 @@
+ #else /* libc5 */
+ #include <sys/socket.h>
+ #include <linux/ip.h>
+-#include <linux/in.h>
+ #include <linux/if.h>
+ #include <linux/icmp.h>
+ #include <linux/tcp.h>
+ #include <linux/udp.h>
+ #include <linux/types.h>
+-#include <linux/in6.h>
+ #endif
+ #endif
+diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
+index ee197a3..f823aa4 100644
+--- a/include/linux/if_bridge.h
++++ b/include/linux/if_bridge.h
+@@ -15,7 +15,6 @@
+ 
+ #include <linux/types.h>
+ #include <linux/if_ether.h>
+-#include <linux/in6.h>
+ 
+ #define SYSFS_BRIDGE_ATTR	"bridge"
+ #define SYSFS_BRIDGE_FDB	"brforward"
+diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
+index b71b4c9..3e4e6ae 100644
+--- a/include/linux/netfilter.h
++++ b/include/linux/netfilter.h
+@@ -4,8 +4,6 @@
+ #include <linux/types.h>
+ 
+ #include <linux/sysctl.h>
+-#include <linux/in.h>
+-#include <linux/in6.h>
+ 
+ /* Responses from hook functions. */
+ #define NF_DROP 0
+diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
+index b8f5451..a9761a5 100644
+--- a/include/linux/xfrm.h
++++ b/include/linux/xfrm.h
+@@ -1,7 +1,6 @@
+ #ifndef _LINUX_XFRM_H
+ #define _LINUX_XFRM_H
+ 
+-#include <linux/in6.h>
+ #include <linux/types.h>
+ 
+ /* All of the structures in this file may not change size as they are
+-- 
+2.6.3
+
diff --git a/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb b/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
index 0b3d896..60f0a8d 100644
--- a/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
+++ b/meta/recipes-connectivity/iproute2/iproute2_4.3.0.bb
@@ -3,6 +3,7 @@ require iproute2.inc
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \
            file://configure-cross.patch \
            file://0001-iproute2-de-bash-scripts.patch \
+           file://iproute2-4.3.0-musl.patch \
           "
 SRC_URI[md5sum] = "1a2bbb80cfc7ab3f3e987e18b3207c2f"
 SRC_URI[sha256sum] = "f03b1188dd6c039512424de82ff7a8f3b446680bd4e908ff42a7b9b137422995"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 46/53] irda-utils: Fix header inclusions
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (44 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 45/53] iproute2: Fix build with musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 47/53] nspr: Drop older glibc code Khem Raj
                   ` (9 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Helps compile with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../irda-utils/irda-utils-0.9.18/musl.patch        | 29 ++++++++++++++++++++++
 .../irda-utils/irda-utils_0.9.18.bb                |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch

diff --git a/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
new file mode 100644
index 0000000..97eb975
--- /dev/null
+++ b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/musl.patch
@@ -0,0 +1,29 @@
+Replace use of <net/if_packet.h> with <linux/if_packet.h>.
+
+kernel headers <linux/if_packet.h> already provides the
+needed definitions, moreover not all libc implementations
+provide if_packet.h e.g. musl
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+Index: irda-utils-0.9.18/irdaping/irdaping.c
+===================================================================
+--- irda-utils-0.9.18.orig/irdaping/irdaping.c
++++ irda-utils-0.9.18/irdaping/irdaping.c
+@@ -33,7 +33,6 @@
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>		/* For struct ifreq */
+-#include <net/if_packet.h>	/* For struct sockaddr_pkt */
+ #include <net/if_arp.h>		/* For ARPHRD_IRDA */
+ #include <netinet/if_ether.h>	/* For ETH_P_ALL */
+ #include <netinet/in.h>		/* For htons */
+@@ -46,6 +45,7 @@
+ #include <asm/byteorder.h>	/* __cpu_to_le32 and co. */
+ 
+ #include <linux/types.h>	/* For __u8 and co. */
++#include <linux/if_packet.h>	/* For struct sockaddr_pkt */
+ #include <irda.h>
+ 
+ #ifndef AF_IRDA
diff --git a/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb b/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
index bd2f815..11b2ee9 100644
--- a/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
+++ b/meta/recipes-connectivity/irda-utils/irda-utils_0.9.18.bb
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://irdadump/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/irda/irda-utils-${PV}.tar.gz \
            file://ldflags.patch \
+           file://musl.patch \
            file://init"
 
 SRC_URI[md5sum] = "84dc12aa4c3f61fccb8d8919bf4079bb"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 47/53] nspr: Drop older glibc code
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (45 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 46/53] irda-utils: Fix header inclusions Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 48/53] chkconfig: Avoid using caddr_t Khem Raj
                   ` (8 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

This was not only getting included for libc5 but also for not-glibc libc
implementations e.g. musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...001-Remove-the-check-for-LINUX-glibc-case.patch | 35 ++++++++++++++++++++++
 meta/recipes-support/nspr/nspr_4.11.bb             |  9 ++++++
 2 files changed, 44 insertions(+)
 create mode 100644 meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch

diff --git a/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch b/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch
new file mode 100644
index 0000000..5b17355
--- /dev/null
+++ b/meta/recipes-support/nspr/nspr/0001-Remove-the-check-for-LINUX-glibc-case.patch
@@ -0,0 +1,35 @@
+From 9b9c95e0390395c7e9ad24a882deb87a50846059 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 8 Aug 2015 17:10:34 -0700
+Subject: [PATCH] Remove the check for LINUX == glibc case
+
+Here it does not consider the case where musl can be an options it does
+consider the bionic case with !defined(ANDROID) but musl does not define
+and musl'ism defines like that
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ pr/src/misc/prnetdb.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
+index b86248f..dc83a56 100644
+--- a/pr/src/misc/prnetdb.c
++++ b/pr/src/misc/prnetdb.c
+@@ -61,10 +61,7 @@ PRLock *_pr_dnsLock = NULL;
+ #define _PR_HAVE_GETPROTO_R_POINTER
+ #endif
+ 
+-#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
+-	|| (defined(LINUX) && defined(_REENTRANT) \
+-        && !(defined(__GLIBC__) && __GLIBC__ >= 2) \
+-        && !defined(ANDROID))
++#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT))
+ #define _PR_HAVE_GETPROTO_R
+ #define _PR_HAVE_GETPROTO_R_POINTER
+ #endif
+-- 
+2.1.4
+
diff --git a/meta/recipes-support/nspr/nspr_4.11.bb b/meta/recipes-support/nspr/nspr_4.11.bb
index 3048641..3dabcb6 100644
--- a/meta/recipes-support/nspr/nspr_4.11.bb
+++ b/meta/recipes-support/nspr/nspr_4.11.bb
@@ -13,6 +13,15 @@ SRC_URI = "http://ftp.mozilla.org/pub/nspr/releases/v${PV}/src/nspr-${PV}.tar.gz
 
 SRC_URI += "file://nspr.pc.in"
 
+CACHED_CONFIGUREVARS_append_libc-musl = " CFLAGS='${CFLAGS} -D_PR_POLL_AVAILABLE \
+                                          -D_PR_HAVE_OFF64_T -D_PR_INET6 -D_PR_HAVE_INET_NTOP \
+                                          -D_PR_HAVE_GETHOSTBYNAME2 -D_PR_HAVE_GETADDRINFO \
+                                          -D_PR_INET6_PROBE'"
+
+SRC_URI_append_libc-musl = "\
+        file://0001-Remove-the-check-for-LINUX-glibc-case.patch \
+        "
+
 UPSTREAM_CHECK_URI = "http://ftp.mozilla.org/pub/nspr/releases/"
 UPSTREAM_CHECK_REGEX = "v(?P<pver>\d+(\.\d+)+)/"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 48/53] chkconfig: Avoid using caddr_t
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (46 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 47/53] nspr: Drop older glibc code Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 49/53] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
                   ` (7 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../chkconfig/chkconfig/replace_caddr_t.patch      | 33 ++++++++++++++++++++++
 .../recipes-extended/chkconfig/chkconfig_1.3.58.bb |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch

diff --git a/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch b/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
new file mode 100644
index 0000000..96d1938
--- /dev/null
+++ b/meta/recipes-extended/chkconfig/chkconfig/replace_caddr_t.patch
@@ -0,0 +1,33 @@
+caddr_t is a legacy BSD type which was rejected by the POSIX standard.
+Use void * instead.
+
+sys/unitstd.h is not needed and moreover its not available on all C library
+implementations e.g. musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: chkconfig-1.3.58/alternatives.c
+===================================================================
+--- chkconfig-1.3.58.orig/alternatives.c
++++ chkconfig-1.3.58/alternatives.c
+@@ -22,7 +22,6 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/stat.h>
+-#include <sys/unistd.h>
+ #include <unistd.h>
+ 
+ #define	FLAGS_TEST	(1 << 0)
+Index: chkconfig-1.3.58/leveldb.c
+===================================================================
+--- chkconfig-1.3.58.orig/leveldb.c
++++ chkconfig-1.3.58/leveldb.c
+@@ -442,7 +442,7 @@ int parseServiceInfo(int fd, char * name
+     fstat(fd, &sb);
+ 
+     bufstart = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
+-    if (bufstart == ((caddr_t) -1)) {
++    if (bufstart == ((void*) -1)) {
+ 	close(fd);
+ 	return -1;
+     }
diff --git a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
index 488847a..e839026 100644
--- a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
+++ b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb
@@ -16,7 +16,9 @@ PROVIDES += "virtual/update-alternatives"
 
 PR = "r7"
 
-SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2"
+SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2 \
+           file://replace_caddr_t.patch \
+          "
 
 SRC_URI[md5sum] = "c2039ca67f2749fe0c06ef7c6f8ee246"
 SRC_URI[sha256sum] = "18b497d25b2cada955c72810e45fcad8280d105f17cf45e2970f18271211de68"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 49/53] tcf-agent: Implement canonicalize_file_name() for musl as well
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (47 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 48/53] chkconfig: Avoid using caddr_t Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 50/53] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
                   ` (6 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...nonicalize_file_name-is-specific-to-glibc.patch | 46 ++++++++++++++++++++++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch

diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch b/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
new file mode 100644
index 0000000..5f93c46
--- /dev/null
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent/0001-canonicalize_file_name-is-specific-to-glibc.patch
@@ -0,0 +1,46 @@
+From 23a3759b74d081b3b2849b0d37a0e5219f37813e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 7 Jan 2016 22:37:48 +0000
+Subject: [PATCH] canonicalize_file_name is specific to glibc
+
+When on Linux and not using glibc then we need to define
+canonicalize_file_name() API, therefore add a check for finding out if
+its not glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ agent/tcf/framework/mdep.c | 2 +-
+ agent/tcf/framework/mdep.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c
+index 2b52ca8..7d09655 100644
+--- a/agent/tcf/framework/mdep.c
++++ b/agent/tcf/framework/mdep.c
+@@ -1042,7 +1042,7 @@ char * canonicalize_file_name(const char * path) {
+     return strdup(res);
+ }
+ 
+-#elif defined(__UCLIBC__)
++#elif defined(__UCLIBC__) || !defined(__GLIBC__)
+ 
+ char * canonicalize_file_name(const char * path) {
+     return realpath(path, NULL);
+diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
+index 1e718a2..187c399 100644
+--- a/agent/tcf/framework/mdep.h
++++ b/agent/tcf/framework/mdep.h
+@@ -276,7 +276,7 @@ extern int loc_clock_gettime(int, struct timespec *);
+ 
+ #define O_BINARY 0
+ 
+-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || !defined(__GLIBC__)
+ #  define O_LARGEFILE 0
+ extern char ** environ;
+ extern char * canonicalize_file_name(const char * path);
+-- 
+2.7.0
+
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index fff81a5..ab2fcd7 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -12,6 +12,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
 SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git;branch=1.3_mars_bugfix \
            file://fix_ranlib.patch \
            file://ldflags.patch \
+           file://0001-canonicalize_file_name-is-specific-to-glibc.patch;striplevel=2 \
            file://tcf-agent.init \
            file://tcf-agent.service \
           "
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 50/53] bsd-headers, musl: Add recipe for bsd missing features
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (48 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 49/53] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 51/53] nfs-utils: Disable tcp-wrappers for musl Khem Raj
                   ` (5 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

let musl depend on these headers so they are staged along with libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/bsd-headers/bsd-headers.bb       |  25 +
 .../bsd-headers/bsd-headers/sys-queue.h            | 846 +++++++++++++++++++++
 .../bsd-headers/bsd-headers/sys-tree.h             | 761 ++++++++++++++++++
 meta/recipes-core/musl/musl_git.bb                 |   1 +
 4 files changed, 1633 insertions(+)
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers.bb
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
 create mode 100644 meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h

diff --git a/meta/recipes-core/bsd-headers/bsd-headers.bb b/meta/recipes-core/bsd-headers/bsd-headers.bb
new file mode 100644
index 0000000..ae659ab
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers.bb
@@ -0,0 +1,25 @@
+# Copyright (C) 2016 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "bsd compatible headers"
+LICENSE = "BSD-3-Clause && BSD-2-Clause"
+SECTION = "devel"
+
+SRC_URI = "file://sys-queue.h \
+           file://sys-tree.h \
+          "
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+S = "${WORKDIR}"
+
+do_install() {
+	install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h
+	install -Dm 0644 ${S}/sys-tree.h ${D}${includedir}/sys/tree.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
diff --git a/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h b/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
new file mode 100644
index 0000000..99d01a5
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers/sys-queue.h
@@ -0,0 +1,846 @@
+/*	$NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $	*/
+
+/*
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list.  Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction.  Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * Include the definition of NULL only on NetBSD because sys/null.h
+ * is not available elsewhere.  This conditional makes the header
+ * portable and it can simply be dropped verbatim into any system.
+ * The caveat is that on other systems some other header
+ * must provide NULL before the macros can be used.
+ */
+#ifdef __NetBSD__
+#include <sys/null.h>
+#endif
+
+#if defined(QUEUEDEBUG)
+# if defined(_KERNEL)
+#  define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
+# else
+#  include <err.h>
+#  define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
+# endif
+#endif
+
+/*
+ * Singly-linked List definitions.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_END(head)		NULL
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = (head)->slh_first;					\
+	    (var) != SLIST_END(head);					\
+	    (var) = (var)->field.sle_next)
+
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) != SLIST_END(head) &&					\
+	    ((tvar) = SLIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) do {						\
+	(head)->slh_first = SLIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_AFTER(slistelm, field) do {			\
+	(slistelm)->field.sle_next =					\
+	    SLIST_NEXT(SLIST_NEXT((slistelm), field), field);		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = (head)->slh_first;		\
+		while(curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+	}								\
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * List definitions.
+ */
+#define	LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List access methods.
+ */
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_END(head)			NULL
+#define	LIST_EMPTY(head)		((head)->lh_first == LIST_END(head))
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = ((head)->lh_first);				\
+	    (var) != LIST_END(head);					\
+	    (var) = ((var)->field.le_next))
+
+#define	LIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = LIST_FIRST((head));				\
+	    (var) != LIST_END(head) &&					\
+	    ((tvar) = LIST_NEXT((var), field), 1);			\
+	    (var) = (tvar))
+
+#define	LIST_MOVE(head1, head2) do {					\
+	LIST_INIT((head2));						\
+	if (!LIST_EMPTY((head1))) {					\
+		(head2)->lh_first = (head1)->lh_first;			\
+		LIST_INIT((head1));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * List functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)			\
+	if ((head)->lh_first &&						\
+	    (head)->lh_first->field.le_prev != &(head)->lh_first)	\
+		QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_OP(elm, field)					\
+	if ((elm)->field.le_next &&					\
+	    (elm)->field.le_next->field.le_prev !=			\
+	    &(elm)->field.le_next)					\
+		QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.le_prev != (elm))				\
+		QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm),		\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)				\
+	(elm)->field.le_next = (void *)1L;				\
+	(elm)->field.le_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_LIST_OP(elm, field)
+#define	QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
+#endif
+
+#define	LIST_INIT(head) do {						\
+	(head)->lh_first = LIST_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != 	\
+	    LIST_END(head))						\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_LIST_OP((listelm), field)				\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_REMOVE(elm, field) do {					\
+	QUEUEDEBUG_LIST_OP((elm), field)				\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev = 			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define LIST_REPLACE(elm, elm2, field) do {				\
+	if (((elm2)->field.le_next = (elm)->field.le_next) != NULL)	\
+		(elm2)->field.le_next->field.le_prev =			\
+		    &(elm2)->field.le_next;				\
+	(elm2)->field.le_prev = (elm)->field.le_prev;			\
+	*(elm2)->field.le_prev = (elm2);				\
+	QUEUEDEBUG_LIST_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Simple queue definitions.
+ */
+#define	SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define	SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define	SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_FIRST(head)		((head)->sqh_first)
+#define	SIMPLEQ_END(head)		NULL
+#define	SIMPLEQ_EMPTY(head)		((head)->sqh_first == SIMPLEQ_END(head))
+#define	SIMPLEQ_NEXT(elm, field)	((elm)->field.sqe_next)
+
+#define	SIMPLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head);					\
+	    (var) = ((var)->field.sqe_next))
+
+#define	SIMPLEQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->sqh_first);				\
+	    (var) != SIMPLEQ_END(head) &&				\
+	    ((next = ((var)->field.sqe_next)), 1);			\
+	    (var) = (next))
+
+/*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
+	    == NULL)							\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->sqh_first == (elm)) {				\
+		SIMPLEQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->sqh_first;		\
+		while (curelm->field.sqe_next != (elm))			\
+			curelm = curelm->field.sqe_next;		\
+		if ((curelm->field.sqe_next =				\
+			curelm->field.sqe_next->field.sqe_next) == NULL) \
+			    (head)->sqh_last = &(curelm)->field.sqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_CONCAT(head1, head2) do {				\
+	if (!SIMPLEQ_EMPTY((head2))) {					\
+		*(head1)->sqh_last = (head2)->sqh_first;		\
+		(head1)->sqh_last = (head2)->sqh_last;		\
+		SIMPLEQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_LAST(head, type, field)					\
+	(SIMPLEQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->sqh_last) - offsetof(struct type, field))))
+
+/*
+ * Tail queue definitions.
+ */
+#define	_TAILQ_HEAD(name, type, qual)					\
+struct name {								\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
+}
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ TAILQ_END(head), &(head).tqh_first }
+
+#define	_TAILQ_ENTRY(type, qual)					\
+struct {								\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
+}
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue access methods.
+ */
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_END(head)			(NULL)
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+#define	TAILQ_LAST(head, headname) \
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define	TAILQ_PREV(elm, headname, field) \
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define	TAILQ_EMPTY(head)		(TAILQ_FIRST(head) == TAILQ_END(head))
+
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head);					\
+	    (var) = ((var)->field.tqe_next))
+
+#define	TAILQ_FOREACH_SAFE(var, head, field, next)			\
+	for ((var) = ((head)->tqh_first);				\
+	    (var) != TAILQ_END(head) &&					\
+	    ((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
+	    (var) != TAILQ_END(head);					\
+	    (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev)	\
+	for ((var) = TAILQ_LAST((head), headname);			\
+	    (var) != TAILQ_END(head) && 				\
+	    ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
+
+/*
+ * Tail queue functions.
+ */
+#if defined(QUEUEDEBUG)
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)			\
+	if ((head)->tqh_first &&					\
+	    (head)->tqh_first->field.tqe_prev != &(head)->tqh_first)	\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)			\
+	if (*(head)->tqh_last != NULL)					\
+		QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)					\
+	if ((elm)->field.tqe_next &&					\
+	    (elm)->field.tqe_next->field.tqe_prev !=			\
+	    &(elm)->field.tqe_next)					\
+		QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm),	\
+		    __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)			\
+	if ((elm)->field.tqe_next == NULL &&				\
+	    (head)->tqh_last != &(elm)->field.tqe_next)			\
+		QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
+		    (head), (elm), __FILE__, __LINE__);
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)				\
+	(elm)->field.tqe_next = (void *)1L;				\
+	(elm)->field.tqe_prev = (void *)1L;
+#else
+#define	QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_OP(elm, field)
+#define	QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
+#define	QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
+#endif
+
+#define	TAILQ_INIT(head) do {						\
+	(head)->tqh_first = TAILQ_END(head);				\
+	(head)->tqh_last = &(head)->tqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field)		\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
+		(head)->tqh_first->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field)		\
+	(elm)->field.tqe_next = TAILQ_END(head);			\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != 	\
+	    TAILQ_END(head))						\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QUEUEDEBUG_TAILQ_OP((listelm), field)				\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field)		\
+	QUEUEDEBUG_TAILQ_OP((elm), field)				\
+	if (((elm)->field.tqe_next) != TAILQ_END(head))			\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do {			\
+        if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != 	\
+	    TAILQ_END(head))   						\
+                (elm2)->field.tqe_next->field.tqe_prev =		\
+                    &(elm2)->field.tqe_next;				\
+        else								\
+                (head)->tqh_last = &(elm2)->field.tqe_next;		\
+        (elm2)->field.tqe_prev = (elm)->field.tqe_prev;			\
+        *(elm2)->field.tqe_prev = (elm2);				\
+	QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);			\
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_CONCAT(head1, head2, field) do {				\
+	if (!TAILQ_EMPTY(head2)) {					\
+		*(head1)->tqh_last = (head2)->tqh_first;		\
+		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\
+		(head1)->tqh_last = (head2)->tqh_last;			\
+		TAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *stqh_first;	/* first element */		\
+	struct type **stqh_last;	/* addr of last next element */	\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+#define	STAILQ_END(head)	NULL
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+#define	STAILQ_EMPTY(head)	(STAILQ_FIRST(head) == STAILQ_END(head))
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_INIT(head) do {						\
+	(head)->stqh_first = NULL;					\
+	(head)->stqh_last = &(head)->stqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)	\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(head)->stqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.stqe_next = NULL;					\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &(elm)->field.stqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(listelm)->field.stqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+		(head)->stqh_last = &(head)->stqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->stqh_first == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->stqh_first;		\
+		while (curelm->field.stqe_next != (elm))			\
+			curelm = curelm->field.stqe_next;		\
+		if ((curelm->field.stqe_next =				\
+			curelm->field.stqe_next->field.stqe_next) == NULL) \
+			    (head)->stqh_last = &(curelm)->field.stqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->stqh_first);				\
+		(var);							\
+		(var) = ((var)->field.stqe_next))
+
+#define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = STAILQ_FIRST((head));				\
+	    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+
+#define	STAILQ_CONCAT(head1, head2) do {				\
+	if (!STAILQ_EMPTY((head2))) {					\
+		*(head1)->stqh_last = (head2)->stqh_first;		\
+		(head1)->stqh_last = (head2)->stqh_last;		\
+		STAILQ_INIT((head2));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - offsetof(struct type, field))))
+
+
+#ifndef _KERNEL
+/*
+ * Circular queue definitions. Do not use. We still keep the macros
+ * for compatibility but because of pointer aliasing issues their use
+ * is discouraged!
+ */
+
+/*
+ * __launder_type():  We use this ugly hack to work around the the compiler
+ * noticing that two types may not alias each other and elide tests in code.
+ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and
+ * 'struct type *' (see CIRCLEQ_HEAD()).  Modern compilers (such as GCC
+ * 4.8) declare these comparisons as always false, causing the code to
+ * not run as designed.
+ *
+ * This hack is only to be used for comparisons and thus can be fully const.
+ * Do not use for assignment.
+ *
+ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
+ * this by changing the head/tail sentinal values, but see the note above
+ * this one.
+ */
+static __inline const void * __launder_type(const void *);
+static __inline const void *
+__launder_type(const void *__x)
+{
+	__asm __volatile("" : "+r" (__x));
+	return __x;
+}
+
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)				\
+	if ((head)->cqh_first != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head),	\
+		      __FILE__, __LINE__);				\
+	if ((head)->cqh_last != CIRCLEQ_ENDC(head) &&			\
+	    (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head))	\
+		QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head),	\
+		      __FILE__, __LINE__);
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_last != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_next->field.cqe_prev != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}								\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) {		\
+		if ((head)->cqh_first != (elm))				\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	} else {							\
+		if ((elm)->field.cqe_prev->field.cqe_next != (elm))	\
+			QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d",	\
+			    (elm), __FILE__, __LINE__);			\
+	}
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)			\
+	(elm)->field.cqe_next = (void *)1L;				\
+	(elm)->field.cqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
+#endif
+
+#define	CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define	CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) do {						\
+	(head)->cqh_first = CIRCLEQ_END(head);				\
+	(head)->cqh_last = CIRCLEQ_END(head);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = CIRCLEQ_END(head);			\
+	if ((head)->cqh_last == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	(elm)->field.cqe_next = CIRCLEQ_END(head);			\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == CIRCLEQ_ENDC(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
+	QUEUEDEBUG_CIRCLEQ_HEAD((head), field)				\
+	QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)			\
+	if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))		\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+	QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field)			\
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->cqh_first);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_next))
+
+#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for ((var) = ((head)->cqh_last);				\
+		(var) != CIRCLEQ_ENDC(head);				\
+		(var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+/* For comparisons */
+#define	CIRCLEQ_ENDC(head)		(__launder_type(head))
+/* For assignments */
+#define	CIRCLEQ_END(head)		((void *)(head))
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+#define	CIRCLEQ_EMPTY(head)						\
+    (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field)				\
+	(((elm)->field.cqe_next == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_first)					\
+	    : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field)				\
+	(((elm)->field.cqe_prev == CIRCLEQ_ENDC(head))			\
+	    ? ((head)->cqh_last)					\
+	    : (elm->field.cqe_prev))
+#endif /* !_KERNEL */
+
+#endif	/* !_SYS_QUEUE_H_ */
diff --git a/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h b/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
new file mode 100644
index 0000000..eaea56a
--- /dev/null
+++ b/meta/recipes-core/bsd-headers/bsd-headers/sys-tree.h
@@ -0,0 +1,761 @@
+/*	$NetBSD: tree.h,v 1.20 2013/09/14 13:20:45 joerg Exp $	*/
+/*	$OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $	*/
+/*
+ * Copyright 2002 Niels Provos <provos@citi.umich.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SYS_TREE_H_
+#define	_SYS_TREE_H_
+
+/*
+ * This file defines data structures for different types of trees:
+ * splay trees and red-black trees.
+ *
+ * A splay tree is a self-organizing data structure.  Every operation
+ * on the tree causes a splay to happen.  The splay moves the requested
+ * node to the root of the tree and partly rebalances it.
+ *
+ * This has the benefit that request locality causes faster lookups as
+ * the requested nodes move to the top of the tree.  On the other hand,
+ * every lookup causes memory writes.
+ *
+ * The Balance Theorem bounds the total access time for m operations
+ * and n inserts on an initially empty tree as O((m + n)lg n).  The
+ * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
+ *
+ * A red-black tree is a binary search tree with the node color as an
+ * extra attribute.  It fulfills a set of conditions:
+ *	- every search path from the root to a leaf consists of the
+ *	  same number of black nodes,
+ *	- each red node (except for the root) has a black parent,
+ *	- each leaf node is black.
+ *
+ * Every operation on a red-black tree is bounded as O(lg n).
+ * The maximum height of a red-black tree is 2lg (n+1).
+ */
+
+#define SPLAY_HEAD(name, type)						\
+struct name {								\
+	struct type *sph_root; /* root of the tree */			\
+}
+
+#define SPLAY_INITIALIZER(root)						\
+	{ NULL }
+
+#define SPLAY_INIT(root) do {						\
+	(root)->sph_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ENTRY(type)						\
+struct {								\
+	struct type *spe_left; /* left element */			\
+	struct type *spe_right; /* right element */			\
+}
+
+#define SPLAY_LEFT(elm, field)		(elm)->field.spe_left
+#define SPLAY_RIGHT(elm, field)		(elm)->field.spe_right
+#define SPLAY_ROOT(head)		(head)->sph_root
+#define SPLAY_EMPTY(head)		(SPLAY_ROOT(head) == NULL)
+
+/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
+#define SPLAY_ROTATE_RIGHT(head, tmp, field) do {			\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field);	\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ROTATE_LEFT(head, tmp, field) do {			\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field);	\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	(head)->sph_root = tmp;						\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKLEFT(head, tmp, field) do {				\
+	SPLAY_LEFT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);		\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKRIGHT(head, tmp, field) do {				\
+	SPLAY_RIGHT(tmp, field) = (head)->sph_root;			\
+	tmp = (head)->sph_root;						\
+	(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);	\
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ASSEMBLE(head, node, left, right, field) do {		\
+	SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field);	\
+	SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
+	SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field);	\
+	SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field);	\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+
+#define SPLAY_PROTOTYPE(name, type, field, cmp)				\
+void name##_SPLAY(struct name *, struct type *);			\
+void name##_SPLAY_MINMAX(struct name *, int);				\
+struct type *name##_SPLAY_INSERT(struct name *, struct type *);		\
+struct type *name##_SPLAY_REMOVE(struct name *, struct type *);		\
+									\
+/* Finds the node with the same key as elm */				\
+static __inline struct type *						\
+name##_SPLAY_FIND(struct name *head, struct type *elm)			\
+{									\
+	if (SPLAY_EMPTY(head))						\
+		return(NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0)				\
+		return (head->sph_root);				\
+	return (NULL);							\
+}									\
+									\
+static __inline __unused struct type *					\
+name##_SPLAY_NEXT(struct name *head, struct type *elm)			\
+{									\
+	name##_SPLAY(head, elm);					\
+	if (SPLAY_RIGHT(elm, field) != NULL) {				\
+		elm = SPLAY_RIGHT(elm, field);				\
+		while (SPLAY_LEFT(elm, field) != NULL) {		\
+			elm = SPLAY_LEFT(elm, field);			\
+		}							\
+	} else								\
+		elm = NULL;						\
+	return (elm);							\
+}									\
+									\
+static __unused __inline struct type *					\
+name##_SPLAY_MIN_MAX(struct name *head, int val)			\
+{									\
+	name##_SPLAY_MINMAX(head, val);					\
+        return (SPLAY_ROOT(head));					\
+}
+
+/* Main splay operation.
+ * Moves node close to the key of elm to top
+ */
+#define SPLAY_GENERATE(name, type, field, cmp)				\
+struct type *								\
+name##_SPLAY_INSERT(struct name *head, struct type *elm)		\
+{									\
+    if (SPLAY_EMPTY(head)) {						\
+	    SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL;	\
+    } else {								\
+	    int __comp;							\
+	    name##_SPLAY(head, elm);					\
+	    __comp = (cmp)(elm, (head)->sph_root);			\
+	    if(__comp < 0) {						\
+		    SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
+		    SPLAY_RIGHT(elm, field) = (head)->sph_root;		\
+		    SPLAY_LEFT((head)->sph_root, field) = NULL;		\
+	    } else if (__comp > 0) {					\
+		    SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
+		    SPLAY_LEFT(elm, field) = (head)->sph_root;		\
+		    SPLAY_RIGHT((head)->sph_root, field) = NULL;	\
+	    } else							\
+		    return ((head)->sph_root);				\
+    }									\
+    (head)->sph_root = (elm);						\
+    return (NULL);							\
+}									\
+									\
+struct type *								\
+name##_SPLAY_REMOVE(struct name *head, struct type *elm)		\
+{									\
+	struct type *__tmp;						\
+	if (SPLAY_EMPTY(head))						\
+		return (NULL);						\
+	name##_SPLAY(head, elm);					\
+	if ((cmp)(elm, (head)->sph_root) == 0) {			\
+		if (SPLAY_LEFT((head)->sph_root, field) == NULL) {	\
+			(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
+		} else {						\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
+			name##_SPLAY(head, elm);			\
+			SPLAY_RIGHT((head)->sph_root, field) = __tmp;	\
+		}							\
+		return (elm);						\
+	}								\
+	return (NULL);							\
+}									\
+									\
+void									\
+name##_SPLAY(struct name *head, struct type *elm)			\
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+	int __comp;							\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {		\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) < 0){			\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if ((cmp)(elm, __tmp) > 0){			\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}									\
+									\
+/* Splay with either the minimum or the maximum element			\
+ * Used to find minimum or maximum element in tree.			\
+ */									\
+void name##_SPLAY_MINMAX(struct name *head, int __comp) \
+{									\
+	struct type __node, *__left, *__right, *__tmp;			\
+\
+	SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+	__left = __right = &__node;					\
+\
+	while (1) {							\
+		if (__comp < 0) {					\
+			__tmp = SPLAY_LEFT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp < 0){				\
+				SPLAY_ROTATE_RIGHT(head, __tmp, field);	\
+				if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKLEFT(head, __right, field);		\
+		} else if (__comp > 0) {				\
+			__tmp = SPLAY_RIGHT((head)->sph_root, field);	\
+			if (__tmp == NULL)				\
+				break;					\
+			if (__comp > 0) {				\
+				SPLAY_ROTATE_LEFT(head, __tmp, field);	\
+				if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+					break;				\
+			}						\
+			SPLAY_LINKRIGHT(head, __left, field);		\
+		}							\
+	}								\
+	SPLAY_ASSEMBLE(head, &__node, __left, __right, field);		\
+}
+
+#define SPLAY_NEGINF	-1
+#define SPLAY_INF	1
+
+#define SPLAY_INSERT(name, x, y)	name##_SPLAY_INSERT(x, y)
+#define SPLAY_REMOVE(name, x, y)	name##_SPLAY_REMOVE(x, y)
+#define SPLAY_FIND(name, x, y)		name##_SPLAY_FIND(x, y)
+#define SPLAY_NEXT(name, x, y)		name##_SPLAY_NEXT(x, y)
+#define SPLAY_MIN(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
+#define SPLAY_MAX(name, x)		(SPLAY_EMPTY(x) ? NULL	\
+					: name##_SPLAY_MIN_MAX(x, SPLAY_INF))
+
+#define SPLAY_FOREACH(x, name, head)					\
+	for ((x) = SPLAY_MIN(name, head);				\
+	     (x) != NULL;						\
+	     (x) = SPLAY_NEXT(name, head, x))
+
+/* Macros that define a red-black tree */
+#define RB_HEAD(name, type)						\
+struct name {								\
+	struct type *rbh_root; /* root of the tree */			\
+}
+
+#define RB_INITIALIZER(root)						\
+	{ NULL }
+
+#define RB_INIT(root) do {						\
+	(root)->rbh_root = NULL;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_BLACK	0
+#define RB_RED		1
+#define RB_ENTRY(type)							\
+struct {								\
+	struct type *rbe_left;		/* left element */		\
+	struct type *rbe_right;		/* right element */		\
+	struct type *rbe_parent;	/* parent element */		\
+	int rbe_color;			/* node color */		\
+}
+
+#define RB_LEFT(elm, field)		(elm)->field.rbe_left
+#define RB_RIGHT(elm, field)		(elm)->field.rbe_right
+#define RB_PARENT(elm, field)		(elm)->field.rbe_parent
+#define RB_COLOR(elm, field)		(elm)->field.rbe_color
+#define RB_ROOT(head)			(head)->rbh_root
+#define RB_EMPTY(head)			(RB_ROOT(head) == NULL)
+
+#define RB_SET(elm, parent, field) do {					\
+	RB_PARENT(elm, field) = parent;					\
+	RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;		\
+	RB_COLOR(elm, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_SET_BLACKRED(black, red, field) do {				\
+	RB_COLOR(black, field) = RB_BLACK;				\
+	RB_COLOR(red, field) = RB_RED;					\
+} while (/*CONSTCOND*/ 0)
+
+#ifndef RB_AUGMENT
+#define RB_AUGMENT(x)	do {} while (/*CONSTCOND*/ 0)
+#endif
+
+#define RB_ROTATE_LEFT(head, elm, tmp, field) do {			\
+	(tmp) = RB_RIGHT(elm, field);					\
+	if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_LEFT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_LEFT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_ROTATE_RIGHT(head, elm, tmp, field) do {			\
+	(tmp) = RB_LEFT(elm, field);					\
+	if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) {	\
+		RB_PARENT(RB_RIGHT(tmp, field), field) = (elm);		\
+	}								\
+	RB_AUGMENT(elm);						\
+	if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {	\
+		if ((elm) == RB_LEFT(RB_PARENT(elm, field), field))	\
+			RB_LEFT(RB_PARENT(elm, field), field) = (tmp);	\
+		else							\
+			RB_RIGHT(RB_PARENT(elm, field), field) = (tmp);	\
+	} else								\
+		(head)->rbh_root = (tmp);				\
+	RB_RIGHT(tmp, field) = (elm);					\
+	RB_PARENT(elm, field) = (tmp);					\
+	RB_AUGMENT(tmp);						\
+	if ((RB_PARENT(tmp, field)))					\
+		RB_AUGMENT(RB_PARENT(tmp, field));			\
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+#define RB_PROTOTYPE(name, type, field, cmp)				\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define	RB_PROTOTYPE_STATIC(name, type, field, cmp)			\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)		\
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *);		\
+attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
+attr struct type *name##_RB_REMOVE(struct name *, struct type *);	\
+attr struct type *name##_RB_INSERT(struct name *, struct type *);	\
+attr struct type *name##_RB_FIND(struct name *, struct type *);		\
+attr struct type *name##_RB_NFIND(struct name *, struct type *);	\
+attr struct type *name##_RB_NEXT(struct type *);			\
+attr struct type *name##_RB_PREV(struct type *);			\
+attr struct type *name##_RB_MINMAX(struct name *, int);			\
+									\
+
+/* Main rb operation.
+ * Moves node close to the key of elm to top
+ */
+#define	RB_GENERATE(name, type, field, cmp)				\
+	RB_GENERATE_INTERNAL(name, type, field, cmp,)
+#define	RB_GENERATE_STATIC(name, type, field, cmp)			\
+	RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)		\
+attr void								\
+name##_RB_INSERT_COLOR(struct name *head, struct type *elm)		\
+{									\
+	struct type *parent, *gparent, *tmp;				\
+	while ((parent = RB_PARENT(elm, field)) != NULL &&		\
+	    RB_COLOR(parent, field) == RB_RED) {			\
+		gparent = RB_PARENT(parent, field);			\
+		if (parent == RB_LEFT(gparent, field)) {		\
+			tmp = RB_RIGHT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_RIGHT(parent, field) == elm) {		\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_RIGHT(head, gparent, tmp, field);	\
+		} else {						\
+			tmp = RB_LEFT(gparent, field);			\
+			if (tmp && RB_COLOR(tmp, field) == RB_RED) {	\
+				RB_COLOR(tmp, field) = RB_BLACK;	\
+				RB_SET_BLACKRED(parent, gparent, field);\
+				elm = gparent;				\
+				continue;				\
+			}						\
+			if (RB_LEFT(parent, field) == elm) {		\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = parent;				\
+				parent = elm;				\
+				elm = tmp;				\
+			}						\
+			RB_SET_BLACKRED(parent, gparent, field);	\
+			RB_ROTATE_LEFT(head, gparent, tmp, field);	\
+		}							\
+	}								\
+	RB_COLOR(head->rbh_root, field) = RB_BLACK;			\
+}									\
+									\
+attr void								\
+name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
+{									\
+	struct type *tmp;						\
+	while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) &&	\
+	    elm != RB_ROOT(head)) {					\
+		if (RB_LEFT(parent, field) == elm) {			\
+			tmp = RB_RIGHT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				tmp = RB_RIGHT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_RIGHT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
+					struct type *oleft;		\
+					if ((oleft = RB_LEFT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oleft, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_RIGHT(head, tmp, oleft, field);\
+					tmp = RB_RIGHT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_RIGHT(tmp, field))		\
+					RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_LEFT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		} else {						\
+			tmp = RB_LEFT(parent, field);			\
+			if (RB_COLOR(tmp, field) == RB_RED) {		\
+				RB_SET_BLACKRED(tmp, parent, field);	\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				tmp = RB_LEFT(parent, field);		\
+			}						\
+			if ((RB_LEFT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+			    (RB_RIGHT(tmp, field) == NULL ||		\
+			    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+				RB_COLOR(tmp, field) = RB_RED;		\
+				elm = parent;				\
+				parent = RB_PARENT(elm, field);		\
+			} else {					\
+				if (RB_LEFT(tmp, field) == NULL ||	\
+				    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
+					struct type *oright;		\
+					if ((oright = RB_RIGHT(tmp, field)) \
+					    != NULL)			\
+						RB_COLOR(oright, field) = RB_BLACK;\
+					RB_COLOR(tmp, field) = RB_RED;	\
+					RB_ROTATE_LEFT(head, tmp, oright, field);\
+					tmp = RB_LEFT(parent, field);	\
+				}					\
+				RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+				RB_COLOR(parent, field) = RB_BLACK;	\
+				if (RB_LEFT(tmp, field))		\
+					RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
+				RB_ROTATE_RIGHT(head, parent, tmp, field);\
+				elm = RB_ROOT(head);			\
+				break;					\
+			}						\
+		}							\
+	}								\
+	if (elm)							\
+		RB_COLOR(elm, field) = RB_BLACK;			\
+}									\
+									\
+attr struct type *							\
+name##_RB_REMOVE(struct name *head, struct type *elm)			\
+{									\
+	struct type *child, *parent, *old = elm;			\
+	int color;							\
+	if (RB_LEFT(elm, field) == NULL)				\
+		child = RB_RIGHT(elm, field);				\
+	else if (RB_RIGHT(elm, field) == NULL)				\
+		child = RB_LEFT(elm, field);				\
+	else {								\
+		struct type *left;					\
+		elm = RB_RIGHT(elm, field);				\
+		while ((left = RB_LEFT(elm, field)) != NULL)		\
+			elm = left;					\
+		child = RB_RIGHT(elm, field);				\
+		parent = RB_PARENT(elm, field);				\
+		color = RB_COLOR(elm, field);				\
+		if (child)						\
+			RB_PARENT(child, field) = parent;		\
+		if (parent) {						\
+			if (RB_LEFT(parent, field) == elm)		\
+				RB_LEFT(parent, field) = child;		\
+			else						\
+				RB_RIGHT(parent, field) = child;	\
+			RB_AUGMENT(parent);				\
+		} else							\
+			RB_ROOT(head) = child;				\
+		if (RB_PARENT(elm, field) == old)			\
+			parent = elm;					\
+		(elm)->field = (old)->field;				\
+		if (RB_PARENT(old, field)) {				\
+			if (RB_LEFT(RB_PARENT(old, field), field) == old)\
+				RB_LEFT(RB_PARENT(old, field), field) = elm;\
+			else						\
+				RB_RIGHT(RB_PARENT(old, field), field) = elm;\
+			RB_AUGMENT(RB_PARENT(old, field));		\
+		} else							\
+			RB_ROOT(head) = elm;				\
+		RB_PARENT(RB_LEFT(old, field), field) = elm;		\
+		if (RB_RIGHT(old, field))				\
+			RB_PARENT(RB_RIGHT(old, field), field) = elm;	\
+		if (parent) {						\
+			left = parent;					\
+			do {						\
+				RB_AUGMENT(left);			\
+			} while ((left = RB_PARENT(left, field)) != NULL); \
+		}							\
+		goto color;						\
+	}								\
+	parent = RB_PARENT(elm, field);					\
+	color = RB_COLOR(elm, field);					\
+	if (child)							\
+		RB_PARENT(child, field) = parent;			\
+	if (parent) {							\
+		if (RB_LEFT(parent, field) == elm)			\
+			RB_LEFT(parent, field) = child;			\
+		else							\
+			RB_RIGHT(parent, field) = child;		\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = child;					\
+color:									\
+	if (color == RB_BLACK)						\
+		name##_RB_REMOVE_COLOR(head, parent, child);		\
+	return (old);							\
+}									\
+									\
+/* Inserts a node into the RB tree */					\
+attr struct type *							\
+name##_RB_INSERT(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp;						\
+	struct type *parent = NULL;					\
+	int comp = 0;							\
+	tmp = RB_ROOT(head);						\
+	while (tmp) {							\
+		parent = tmp;						\
+		comp = (cmp)(elm, parent);				\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	RB_SET(elm, parent, field);					\
+	if (parent != NULL) {						\
+		if (comp < 0)						\
+			RB_LEFT(parent, field) = elm;			\
+		else							\
+			RB_RIGHT(parent, field) = elm;			\
+		RB_AUGMENT(parent);					\
+	} else								\
+		RB_ROOT(head) = elm;					\
+	name##_RB_INSERT_COLOR(head, elm);				\
+	return (NULL);							\
+}									\
+									\
+/* Finds the node with the same key as elm */				\
+attr struct type *							\
+name##_RB_FIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (NULL);							\
+}									\
+									\
+/* Finds the first node greater than or equal to the search key */	\
+attr struct type *							\
+name##_RB_NFIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *res = NULL;					\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0) {						\
+			res = tmp;					\
+			tmp = RB_LEFT(tmp, field);			\
+		}							\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (res);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_NEXT(struct type *elm)					\
+{									\
+	if (RB_RIGHT(elm, field)) {					\
+		elm = RB_RIGHT(elm, field);				\
+		while (RB_LEFT(elm, field))				\
+			elm = RB_LEFT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_LEFT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+/* ARGSUSED */								\
+attr struct type *							\
+name##_RB_PREV(struct type *elm)					\
+{									\
+	if (RB_LEFT(elm, field)) {					\
+		elm = RB_LEFT(elm, field);				\
+		while (RB_RIGHT(elm, field))				\
+			elm = RB_RIGHT(elm, field);			\
+	} else {							\
+		if (RB_PARENT(elm, field) &&				\
+		    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))	\
+			elm = RB_PARENT(elm, field);			\
+		else {							\
+			while (RB_PARENT(elm, field) &&			\
+			    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
+				elm = RB_PARENT(elm, field);		\
+			elm = RB_PARENT(elm, field);			\
+		}							\
+	}								\
+	return (elm);							\
+}									\
+									\
+attr struct type *							\
+name##_RB_MINMAX(struct name *head, int val)				\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *parent = NULL;					\
+	while (tmp) {							\
+		parent = tmp;						\
+		if (val < 0)						\
+			tmp = RB_LEFT(tmp, field);			\
+		else							\
+			tmp = RB_RIGHT(tmp, field);			\
+	}								\
+	return (parent);						\
+}
+
+#define RB_NEGINF	-1
+#define RB_INF	1
+
+#define RB_INSERT(name, x, y)	name##_RB_INSERT(x, y)
+#define RB_REMOVE(name, x, y)	name##_RB_REMOVE(x, y)
+#define RB_FIND(name, x, y)	name##_RB_FIND(x, y)
+#define RB_NFIND(name, x, y)	name##_RB_NFIND(x, y)
+#define RB_NEXT(name, x, y)	name##_RB_NEXT(y)
+#define RB_PREV(name, x, y)	name##_RB_PREV(y)
+#define RB_MIN(name, x)		name##_RB_MINMAX(x, RB_NEGINF)
+#define RB_MAX(name, x)		name##_RB_MINMAX(x, RB_INF)
+
+#define RB_FOREACH(x, name, head)					\
+	for ((x) = RB_MIN(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_NEXT(x))
+
+#define RB_FOREACH_FROM(x, name, y)					\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_SAFE(x, name, head, y)				\
+	for ((x) = RB_MIN(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE(x, name, head)				\
+	for ((x) = RB_MAX(name, head);					\
+	     (x) != NULL;						\
+	     (x) = name##_RB_PREV(x))
+
+#define RB_FOREACH_REVERSE_FROM(x, name, y)				\
+	for ((x) = (y);							\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)			\
+	for ((x) = RB_MAX(name, head);					\
+	    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);	\
+	     (x) = (y))
+
+#endif	/* _SYS_TREE_H_ */
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 051d925..5b94d1f 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -19,6 +19,7 @@ PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc virtual/libiconv
 DEPENDS = "virtual/${TARGET_PREFIX}binutils \
            virtual/${TARGET_PREFIX}gcc-initial \
            libgcc-initial \
+           bsd-headers \
           "
 
 export CROSS_COMPILE="${TARGET_PREFIX}"
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 51/53] nfs-utils: Disable tcp-wrappers for musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (49 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 50/53] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 52/53] portmap: Point to tirpc headers and libraries on musl Khem Raj
                   ` (4 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Doesnt build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
index 2e0c8b1..ea00656 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_1.3.3.bb
@@ -64,6 +64,7 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                "
 
 PACKAGECONFIG ??= "tcp-wrappers"
+PACKAGECONFIG_remove_libc-musl = "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
 PACKAGECONFIG[nfsidmap] = "--enable-nfsidmap,--disable-nfsidmap,keyutils"
 
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 52/53] portmap: Point to tirpc headers and libraries on musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (50 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 51/53] nfs-utils: Disable tcp-wrappers for musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:19 ` [PATCH 53/53] elfutils: Add ALLOW_EMPTY for musl Khem Raj
                   ` (3 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-connectivity/portmap/portmap_6.0.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-connectivity/portmap/portmap_6.0.bb b/meta/recipes-connectivity/portmap/portmap_6.0.bb
index e727fe3..999b4a9 100644
--- a/meta/recipes-connectivity/portmap/portmap_6.0.bb
+++ b/meta/recipes-connectivity/portmap/portmap_6.0.bb
@@ -1,5 +1,7 @@
 require portmap.inc
 
+DEPENDS_append_libc-musl = " libtirpc "
+
 PR = "r9"
 
 SRC_URI = "http://www.sourcefiles.org/Networking/Tools/Miscellanenous/portmap-6.0.tgz \
@@ -19,6 +21,8 @@ PACKAGECONFIG[tcp-wrappers] = ",,tcp-wrappers"
 CPPFLAGS += "-DFACILITY=LOG_DAEMON -DENABLE_DNS -DHOSTS_ACCESS"
 CFLAGS += "-Wall -Wstrict-prototypes -fPIC"
 EXTRA_OEMAKE += "'NO_TCP_WRAPPER=${@bb.utils.contains('PACKAGECONFIG', 'tcp-wrappers', '', '1', d)}'"
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
+LDFLAGS_append_libc-musl = " -ltirpc "
 
 do_install() {
     install -d ${D}${mandir}/man8/ ${D}${base_sbindir} ${D}${sysconfdir}/init.d
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* [PATCH 53/53] elfutils: Add ALLOW_EMPTY for musl
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (51 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 52/53] portmap: Point to tirpc headers and libraries on musl Khem Raj
@ 2016-01-08 10:19 ` Khem Raj
  2016-01-08 10:58 ` [PATCH 00/53] musl fixes 3 Burton, Ross
                   ` (2 subsequent siblings)
  55 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 10:19 UTC (permalink / raw)
  To: openembedded-core

core-image-cmdline-full asks for elfutils package to be added to package
it has all eu-* tools but we dont build them on musl. nevertheless lets
satisfy the dependency so image can build for musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/elfutils/elfutils_0.163.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/elfutils/elfutils_0.163.bb b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
index 0a7dd88..23e2d7a 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.163.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.163.bb
@@ -65,6 +65,8 @@ EXTRA_OEMAKE_libc-musl = "-C libelf"
 EXTRA_OEMAKE_class-native = ""
 EXTRA_OEMAKE_class-nativesdk = ""
 
+ALLOW_EMPTY_${PN}_libc-musl = "1"
+
 BBCLASSEXTEND = "native nativesdk"
 
 # Package utilities separately
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 84+ messages in thread

* Re: [PATCH 30/53] Revert "glib-2.0: build dependency cleanup"
  2016-01-08 10:18 ` [PATCH 30/53] Revert "glib-2.0: build dependency cleanup" Khem Raj
@ 2016-01-08 10:39   ` Burton, Ross
  2016-01-08 17:36     ` Khem Raj
  0 siblings, 1 reply; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 10:39 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On 8 January 2016 at 10:18, Khem Raj <raj.khem@gmail.com> wrote:

> -DEPENDS = "virtual/libiconv libffi zlib"
> -DEPENDS_append = " ${@bb.utils.contains('PTEST_ENABLED', '1', '
> glib-2.0-native dbus', '', d)}"
> +DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
> +DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES',
> 'ptest', ' dbus', '', d)}"
>  DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native
> zlib-native"
> -DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext
> nativesdk-libffi nativesdk-zlib"
> +DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext
> nativesdk-libffi nativesdk-zlib ${BPN}-native"
>

Don't actually revert the original commit, just add the missing
dependencies back.  The ptest changes were good and you're reverting those
too.

Ross

[-- Attachment #2: Type: text/html, Size: 1392 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (52 preceding siblings ...)
  2016-01-08 10:19 ` [PATCH 53/53] elfutils: Add ALLOW_EMPTY for musl Khem Raj
@ 2016-01-08 10:58 ` Burton, Ross
  2016-01-08 14:00 ` Burton, Ross
  2016-01-08 14:56 ` Burton, Ross
  55 siblings, 0 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 10:58 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:

> This set of fixes let core-image-full-cmdline build with musl along with
> core-image-sato
> and core-image-weston
>

I can't build an image for real x86 hardware though:

ERROR: Nothing PROVIDES 'virtual/libiconv-native' (but
virtual:native:/home/ross/Yocto/poky/meta/recipes-devtools/mtools/
mtools_4.0.18.bb DEPENDS on or otherwise requires it). Close matches:
  virtual/libiconv
  virtual/libx11-native
  virtual/libsdl-native
NOTE: Runtime target 'core-image-sato' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['core-image-sato',
'mtools-native', 'virtual/libiconv-native']

Ross

[-- Attachment #2: Type: text/html, Size: 1482 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (53 preceding siblings ...)
  2016-01-08 10:58 ` [PATCH 00/53] musl fixes 3 Burton, Ross
@ 2016-01-08 14:00 ` Burton, Ross
  2016-01-08 14:12   ` Burton, Ross
                     ` (3 more replies)
  2016-01-08 14:56 ` Burton, Ross
  55 siblings, 4 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:00 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 3055 bytes --]

On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:

> This set of fixes let core-image-full-cmdline build with musl along with
> core-image-sato
> and core-image-weston
>

Hm, for some reason, this doesn't work for me.

Lots and lots of "files installed but not packaged", all locales.  eg
/usr/lib/locale/hu/LC_MESSAGES/glib20.mo in glib-2.0.

systemd fails with this error, over and over:

|
/data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/util.h:96:70:
error: unknown type name 'comparison_fn_t'
|  static inline void qsort_safe(void *base, size_t nmemb, size_t size,
comparison_fn_t compar) {

Also I presume you're not building with debugging tools enabled because
oprofile fails to build:

| make[2]: Entering directory
'/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/build/pe_profiling'
| i586-poky-linux-musl-g++  -m32 -march=i586
--sysroot=/data/poky-master/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I.
-I/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling
-I..  -I
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libutil
-I
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libop
-I
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libutil++
-I
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libperf_events
-I
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libpe_utils
-I/data/poky-master/tmp/sysroots/qemux86/usr/include   -W -Wall -fno-common
-ftemplate-depth-50 -O2 -pipe -g -feliminate-unused-debug-types
-fvisibility-inlines-hidden -c -o operf.o
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp
|
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:
In function 'int __delete_old_previous_sample_data(const char*, const
stat*, int, FTW*)':
|
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:862:10:
error: 'FTW_STOP' was not declared in this scope
|    return FTW_STOP;
|           ^
|
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:864:10:
error: 'FTW_CONTINUE' was not declared in this scope
|    return FTW_CONTINUE;
|           ^
|
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:
In function 'void convert_sample_data()':
|
/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:899:41:
error: 'FTW_ACTIONRETVAL' was not declared in this scope
|                  int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
|                                          ^
| Makefile:451: recipe for target 'operf.o' failed

I presume this is another "link to fts" case.

Ross

[-- Attachment #2: Type: text/html, Size: 4465 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:00 ` Burton, Ross
@ 2016-01-08 14:12   ` Burton, Ross
  2016-01-08 14:23     ` Burton, Ross
  2016-01-08 17:46     ` Khem Raj
  2016-01-08 14:32   ` Burton, Ross
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:12 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:

> |                  int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
>

ftw != fts, of course.

Looks like FTW_STOP etc are glibc-specific.
https://github.com/commodo/openwrt/blob/master/package/devel/oprofile/patches/100-musl.patch
seems reasonable, assuming it works.

Ross

[-- Attachment #2: Type: text/html, Size: 1003 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:12   ` Burton, Ross
@ 2016-01-08 14:23     ` Burton, Ross
  2016-01-08 17:46     ` Khem Raj
  1 sibling, 0 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:23 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

On 8 January 2016 at 14:12, Burton, Ross <ross.burton@intel.com> wrote:

> Looks like FTW_STOP etc are glibc-specific.
> https://github.com/commodo/openwrt/blob/master/package/devel/oprofile/patches/100-musl.patch
> seems reasonable, assuming it works.
>

It builds at least!  Patch sent to the list. :)

Ross

[-- Attachment #2: Type: text/html, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:00 ` Burton, Ross
  2016-01-08 14:12   ` Burton, Ross
@ 2016-01-08 14:32   ` Burton, Ross
  2016-01-08 17:47     ` Khem Raj
  2016-01-08 14:53   ` Burton, Ross
  2016-01-08 17:43   ` Khem Raj
  3 siblings, 1 reply; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:32 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:

> systemd fails with this error, over and over:
>
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/util.h:96:70:
> error: unknown type name 'comparison_fn_t'
> |  static inline void qsort_safe(void *base, size_t nmemb, size_t size,
> comparison_fn_t compar) {
>

I've just remembered about meta-musl so this is likely fixed there but I'm
also seeing this when building systemd:

|
/data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/missing.h:590:6:
error: #error "neither secure_getenv nor __secure_getenv are available"

Now I'll disable systemd verify it all works with sysvinit.

Ross

[-- Attachment #2: Type: text/html, Size: 1493 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:00 ` Burton, Ross
  2016-01-08 14:12   ` Burton, Ross
  2016-01-08 14:32   ` Burton, Ross
@ 2016-01-08 14:53   ` Burton, Ross
  2016-01-08 17:57     ` Khem Raj
  2016-01-09  9:23     ` Khem Raj
  2016-01-08 17:43   ` Khem Raj
  3 siblings, 2 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:53 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:

> Hm, for some reason, this doesn't work for me.
>
> Lots and lots of "files installed but not packaged", all locales.  eg
> /usr/lib/locale/hu/LC_MESSAGES/glib20.mo in glib-2.0.
>

So under musl the translations are being installed to /usr/lib/locale,
whereas under glibc its /usr/share/locale. This is showing some problems in
bitbake.conf: that sets localedir to ${libdir}/locale but then sets
FILES_PN-locale to ${datadir}/locale.

Ross

[-- Attachment #2: Type: text/html, Size: 1036 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
                   ` (54 preceding siblings ...)
  2016-01-08 14:00 ` Burton, Ross
@ 2016-01-08 14:56 ` Burton, Ross
  2016-01-08 17:59   ` Khem Raj
  2016-01-10 21:10   ` Khem Raj
  55 siblings, 2 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 14:56 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]

On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:

> This set of fixes let core-image-full-cmdline build with musl along with
> core-image-sato
> and core-image-weston
>

The postinst intercepts that are ran at rootfs time using user-mode qemu
don't work with musl:

NOTE: Running intercept scripts:
NOTE: > Executing update_font_cache intercept ...
/lib/ld-musl-i386.so.1: No such file or directory
/data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/bin/fc-cache:
Invalid ELF image for this architecture
WARNING: The postinstall intercept hook 'update_font_cache' failed (exit
code: 255)! See log for details!
WARNING: The postinstalls for the following packages will be postponed for
first boot: liberation-fonts
NOTE: > Executing update_icon_cache intercept ...
NOTE: > Executing update_pixbuf_cache intercept ...
/lib/ld-musl-i386.so.1: No such file or directory
/data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/lib/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders:
Invalid ELF image for this architecture

Ross

[-- Attachment #2: Type: text/html, Size: 1950 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 20/53] mtools: Fix build with uclibc
  2016-01-08 10:18 ` [PATCH 20/53] mtools: Fix build with uclibc Khem Raj
@ 2016-01-08 16:17   ` Burton, Ross
  2016-01-08 16:25     ` Burton, Ross
  0 siblings, 1 reply; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 16:17 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

On 8 January 2016 at 10:18, Khem Raj <raj.khem@gmail.com> wrote:

> +DEPENDS += "virtual/libiconv"
>

Update: this breaks all builds for x86 hardware:

ERROR: Nothing PROVIDES 'virtual/libiconv-native' (but
virtual:native:/home/ross/Yocto/poky/meta/recipes-devtools/mtools/
mtools_4.0.18.bb DEPENDS on or otherwise requires it). Close matches:
  virtual/libiconv
  virtual/libx11-native
  virtual/libsdl-native

It appears to be the first time that virtual/libiconv-native appears.
Should we just ASSUME_PROVIDED that?

Ross

[-- Attachment #2: Type: text/html, Size: 1305 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 20/53] mtools: Fix build with uclibc
  2016-01-08 16:17   ` Burton, Ross
@ 2016-01-08 16:25     ` Burton, Ross
  2016-01-08 17:27       ` Khem Raj
  0 siblings, 1 reply; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 16:25 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

On 8 January 2016 at 16:17, Burton, Ross <ross.burton@intel.com> wrote:

> It appears to be the first time that virtual/libiconv-native appears.
> Should we just ASSUME_PROVIDED that?
>

I think this is the right solution - patch sent.

Ross

[-- Attachment #2: Type: text/html, Size: 612 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 20/53] mtools: Fix build with uclibc
  2016-01-08 16:25     ` Burton, Ross
@ 2016-01-08 17:27       ` Khem Raj
  0 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:27 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 8:25 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 16:17, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> It appears to be the first time that virtual/libiconv-native appears.
>> Should we just ASSUME_PROVIDED that?
>
>
> I think this is the right solution - patch sent.

yes thats the right solution , I havent done builds for qemux86/64 for
sometime after RPs change in the bbclassextend area. Since I had
reverted that fix in my tree I did not see this error.

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 30/53] Revert "glib-2.0: build dependency cleanup"
  2016-01-08 10:39   ` Burton, Ross
@ 2016-01-08 17:36     ` Khem Raj
  0 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:36 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 2:39 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 10:18, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> -DEPENDS = "virtual/libiconv libffi zlib"
>> -DEPENDS_append = " ${@bb.utils.contains('PTEST_ENABLED', '1', '
>> glib-2.0-native dbus', '', d)}"
>> +DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
>> +DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES',
>> 'ptest', ' dbus', '', d)}"
>>  DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native
>> zlib-native"
>> -DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext
>> nativesdk-libffi nativesdk-zlib"
>> +DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext
>> nativesdk-libffi nativesdk-zlib ${BPN}-native"
>
>
> Don't actually revert the original commit, just add the missing dependencies
> back.  The ptest changes were good and you're reverting those too.

ignore this.
this was a band-aid  for my build. I was hoping Kai to address it

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:00 ` Burton, Ross
                     ` (2 preceding siblings ...)
  2016-01-08 14:53   ` Burton, Ross
@ 2016-01-08 17:43   ` Khem Raj
  2016-01-08 18:29     ` Burton, Ross
  3 siblings, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:43 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:00 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> This set of fixes let core-image-full-cmdline build with musl along with
>> core-image-sato
>> and core-image-weston
>
>
> Hm, for some reason, this doesn't work for me.

I think x86 includes more packages than other arches in these images.
full-cmdline image is pretty new it hasnt yet been tested on all
architectures only qemuarm is where I got it to work.

>
> Lots and lots of "files installed but not packaged", all locales.  eg
> /usr/lib/locale/hu/LC_MESSAGES/glib20.mo in glib-2.0.
>
> systemd fails with this error, over and over:

systemd does not work with musl. I have patches in my tree to fix the
build but then it does not run :(. musl and systemd has different
goals, right now I am not putting lot of efforts to bridge the gap.
Patches are here

https://github.com/kraj/systemd/commits/oe/master

>
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/util.h:96:70:
> error: unknown type name 'comparison_fn_t'
> |  static inline void qsort_safe(void *base, size_t nmemb, size_t size,
> comparison_fn_t compar) {
>
> Also I presume you're not building with debugging tools enabled because
> oprofile fails to build:
>
> | make[2]: Entering directory
> '/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/build/pe_profiling'
> | i586-poky-linux-musl-g++  -m32 -march=i586
> --sysroot=/data/poky-master/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I.
> -I/data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling
> -I..  -I
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libutil
> -I
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libop
> -I
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libutil++
> -I
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libperf_events
> -I
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/libpe_utils
> -I/data/poky-master/tmp/sysroots/qemux86/usr/include   -W -Wall -fno-common
> -ftemplate-depth-50 -O2 -pipe -g -feliminate-unused-debug-types
> -fvisibility-inlines-hidden -c -o operf.o
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:
> In function 'int __delete_old_previous_sample_data(const char*, const stat*,
> int, FTW*)':
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:862:10:
> error: 'FTW_STOP' was not declared in this scope
> |    return FTW_STOP;
> |           ^
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:864:10:
> error: 'FTW_CONTINUE' was not declared in this scope
> |    return FTW_CONTINUE;
> |           ^
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:
> In function 'void convert_sample_data()':
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/oprofile/1.1.0-r0/oprofile-1.1.0/pe_profiling/operf.cpp:899:41:
> error: 'FTW_ACTIONRETVAL' was not declared in this scope
> |                  int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
> |                                          ^
> | Makefile:451: recipe for target 'operf.o' failed
>
> I presume this is another "link to fts" case.
>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:12   ` Burton, Ross
  2016-01-08 14:23     ` Burton, Ross
@ 2016-01-08 17:46     ` Khem Raj
  1 sibling, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:46 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:12 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> |                  int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
>
>
> ftw != fts, of course.
>
> Looks like FTW_STOP etc are glibc-specific.
> https://github.com/commodo/openwrt/blob/master/package/devel/oprofile/patches/100-musl.patch
> seems reasonable, assuming it works.

Its changing the behaviour a bit. e.g. where its returning errno
instead of FTW_STOP but since its an error case, it will work most of
times.

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:32   ` Burton, Ross
@ 2016-01-08 17:47     ` Khem Raj
  0 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:47 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:32 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> systemd fails with this error, over and over:
>>
>> |
>> /data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/util.h:96:70:
>> error: unknown type name 'comparison_fn_t'
>> |  static inline void qsort_safe(void *base, size_t nmemb, size_t size,
>> comparison_fn_t compar) {
>
>
> I've just remembered about meta-musl so this is likely fixed there but I'm
> also seeing this when building systemd:
>
> |
> /data/poky-master/tmp/work/i586-poky-linux-musl/systemd/1_228+gitAUTOINC+dd050decb6-r0/git/src/basic/missing.h:590:6:
> error: #error "neither secure_getenv nor __secure_getenv are available"
>
> Now I'll disable systemd verify it all works with sysvinit.

yes systemd is not supported yet as I describe in prior email. I have
patches to build it though but I dont want us to have it unless it
works

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:53   ` Burton, Ross
@ 2016-01-08 17:57     ` Khem Raj
  2016-01-09  9:23     ` Khem Raj
  1 sibling, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:57 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:53 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> Hm, for some reason, this doesn't work for me.
>>
>> Lots and lots of "files installed but not packaged", all locales.  eg
>> /usr/lib/locale/hu/LC_MESSAGES/glib20.mo in glib-2.0.
>
>
> So under musl the translations are being installed to /usr/lib/locale,
> whereas under glibc its /usr/share/locale. This is showing some problems in
> bitbake.conf: that sets localedir to ${libdir}/locale but then sets
> FILES_PN-locale to ${datadir}/locale.

I have seen those too but have not gotten to them since they were
warnings and thus prioritized for later. but you seem to have found
the reason
I think it should be in
/usr/share/locale, I think bitbake.conf should also do the same.

we need to enhance glib's gettext macros to include musl triplets in
same lines as uclibc see

https://github.com/kraj/openembedded-core/blob/kraj/musl-fixes/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch


>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:56 ` Burton, Ross
@ 2016-01-08 17:59   ` Khem Raj
  2016-01-10 21:10   ` Khem Raj
  1 sibling, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-08 17:59 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:56 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> This set of fixes let core-image-full-cmdline build with musl along with
>> core-image-sato
>> and core-image-weston
>
>
> The postinst intercepts that are ran at rootfs time using user-mode qemu
> don't work with musl:
>
> NOTE: Running intercept scripts:
> NOTE: > Executing update_font_cache intercept ...
> /lib/ld-musl-i386.so.1: No such file or directory
> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/bin/fc-cache:
> Invalid ELF image for this architecture
> WARNING: The postinstall intercept hook 'update_font_cache' failed (exit
> code: 255)! See log for details!
> WARNING: The postinstalls for the following packages will be postponed for
> first boot: liberation-fonts
> NOTE: > Executing update_icon_cache intercept ...
> NOTE: > Executing update_pixbuf_cache intercept ...
> /lib/ld-musl-i386.so.1: No such file or directory
> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/lib/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders:
> Invalid ELF image for this architecture

this is something new, havent seen it yet. will try to reproduce it here

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 17:43   ` Khem Raj
@ 2016-01-08 18:29     ` Burton, Ross
  2016-01-08 18:34       ` Khem Raj
  0 siblings, 1 reply; 84+ messages in thread
From: Burton, Ross @ 2016-01-08 18:29 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

On 8 January 2016 at 17:43, Khem Raj <raj.khem@gmail.com> wrote:

> systemd does not work with musl. I have patches in my tree to fix the
> build but then it does not run :(. musl and systemd has different
>

I wonder if we can/should raise a SkipPackage for systemd if musl is
enabled?

Ross

[-- Attachment #2: Type: text/html, Size: 709 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 18:29     ` Burton, Ross
@ 2016-01-08 18:34       ` Khem Raj
  2016-01-09  8:59         ` Khem Raj
  0 siblings, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-08 18:34 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 10:29 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 17:43, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> systemd does not work with musl. I have patches in my tree to fix the
>> build but then it does not run :(. musl and systemd has different
>
>
> I wonder if we can/should raise a SkipPackage for systemd if musl is
> enabled?

Seems good.

>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 24/53] directfb: Fix build with musl
  2016-01-08 10:18 ` [PATCH 24/53] directfb: Fix build with musl Khem Raj
@ 2016-01-09  3:27   ` Andre McCurdy
  2016-01-09  7:43     ` Khem Raj
  2016-01-09  9:58     ` Burton, Ross
  0 siblings, 2 replies; 84+ messages in thread
From: Andre McCurdy @ 2016-01-09  3:27 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Fri, Jan 8, 2016 at 2:18 AM, Khem Raj <raj.khem@gmail.com> wrote:
> compar_fn_t, sigval_t and non-posix recursive mutexes
> are not available in musl
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-graphics/directfb/directfb.inc        |  5 ++
>  .../directfb/directfb/compar_fn_t.patch            | 62 ++++++++++++++++++++++
>  .../directfb/directfb/union-sigval.patch           | 19 +++++++
>  .../directfb/use-PTHREAD_MUTEX_RECURSIVE.patch     | 19 +++++++
>  4 files changed, 105 insertions(+)
>  create mode 100644 meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
>  create mode 100644 meta/recipes-graphics/directfb/directfb/union-sigval.patch
>  create mode 100644 meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
>
> diff --git a/meta/recipes-graphics/directfb/directfb.inc b/meta/recipes-graphics/directfb/directfb.inc
> index 603aba3..3a79a8f 100644
> --- a/meta/recipes-graphics/directfb/directfb.inc
> +++ b/meta/recipes-graphics/directfb/directfb.inc
> @@ -16,7 +16,12 @@ SRC_URI = "http://www.directfb.org/downloads/Core/DirectFB-1.7/DirectFB-${PV}.ta
>             file://fusion.patch \
>             file://bashism.patch \
>             file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \
> +           file://compar_fn_t.patch \
>            "
> +SRC_URI_append_libc-musl = "\
> +                            file://union-sigval.patch \
> +                            file://use-PTHREAD_MUTEX_RECURSIVE.patch \
> +                           "

For patches which fix 'correctness' issues uncovered by musl maybe
it's better to apply the patches unconditionally, so they get some
test cover from non-musl builds?

Especially true in this case - see below.

>  S = "${WORKDIR}/DirectFB-${PV}"
>
> diff --git a/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
> new file mode 100644
> index 0000000..ee4d900
> --- /dev/null
> +++ b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
> @@ -0,0 +1,62 @@
> +test for __compar_fn_t and if not defined by libc then define it
> +help make directfb compile with musl
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +Index: DirectFB-1.7.7/configure.in
> +===================================================================
> +--- DirectFB-1.7.7.orig/configure.in
> ++++ DirectFB-1.7.7/configure.in
> +@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long)
> + AC_CHECK_SIZEOF(long long)
> + AC_CHECK_FUNCS(fork)
> +
> ++AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
> ++    AC_TRY_COMPILE(
> ++        [#include <stdlib.h>],
> ++        [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
> ++        ccache_cv_COMPAR_FN_T=yes,
> ++        ccache_cv_COMPAR_FN_T=no)])
> ++if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
> ++   AC_DEFINE(HAVE_COMPAR_FN_T, 1,
> ++             Define to 1 if you have the `__compar_fn_t' typedef.)
> ++fi
> ++
> + AC_PATH_PROGS(PERL, perl5 perl)
> +
> + AC_PATH_PROG(MAN2HTML, man2html, no)
> +Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c
> +===================================================================
> +--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c
> ++++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c
> +@@ -59,6 +59,11 @@
> +
> + #include <core/input_driver.h>
> +
> ++#if HAVE_COMPAR_FN_T
> ++#define COMPAR_FN_T __compar_fn_t
> ++#else
> ++typedef int (*COMPAR_FN_T)(const void *, const void *);
> ++#endif
> +
> + DFB_INPUT_DRIVER( lirc )
> +
> +@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars
> +           qsort ( keynames,
> +                   D_ARRAY_SIZE( keynames ),
> +                   sizeof(keynames[0]),
> +-                  (__compar_fn_t) keynames_sort_compare );
> ++                  (COMPAR_FN_T) keynames_sort_compare );
> +           keynames_sorted = true;
> +      }
> +
> +@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars
> +                symbol_name = bsearch( name, keynames,
> +                                       D_ARRAY_SIZE( keynames ),
> +                                       sizeof(keynames[0]),
> +-                                      (__compar_fn_t) keynames_compare );
> ++                                      (COMPAR_FN_T) keynames_compare );
> +                if (symbol_name)
> +                     return symbol_name->symbol;
> +                break;
> diff --git a/meta/recipes-graphics/directfb/directfb/union-sigval.patch b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
> new file mode 100644
> index 0000000..29f45c7
> --- /dev/null
> +++ b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
> @@ -0,0 +1,19 @@
> +This patch is taken from gentoo musl overlay
> +sigval_t is glibc only construct, we use a union of sigval
> +which pretty much is same effect as sigval_t
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c
> +--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c     2014-07-15 02:54:58.000000000 -0400
> ++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c  2015-07-18 16:55:35.077989166 -0400
> +@@ -111,7 +111,7 @@
> + void
> + direct_trap( const char *domain, int sig )
> + {
> +-     sigval_t val;
> ++     union sigval val;
> +
> +      if (direct_config->delay_trap_ms) {
> +           D_LOG( Direct_Trap, VERBOSE, "NOT RAISING signal %d from %s, waiting for %dms... attach gdb --pid=%d\n", sig, domain, direct_config->delay_trap_ms, getpid() );
> diff --git a/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
> new file mode 100644
> index 0000000..e65f59e
> --- /dev/null
> +++ b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
> @@ -0,0 +1,19 @@
> +This patch is taken from gentoo musl overlay
> +uses recursive mutex directly instead of non-posix version
> +
> +Upstream-Status: Pending
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +
> +diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h
> +--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h      2013-12-18 19:16:24.000000000 -0500
> ++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h   2015-07-18 16:57:47.178982835 -0400
> +@@ -46,7 +46,7 @@
> + /**********************************************************************************************************************/
> +
> + #define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
> +-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
> ++#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_MUTEX_RECURSIVE }

This looks completely bogus.

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP initialises a pthread_mutex_t
structure and PTHREAD_MUTEX_RECURSIVE is an enum. You can't just
replace one with the other.

> +
> + #endif
> +
> --
> 2.7.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 24/53] directfb: Fix build with musl
  2016-01-09  3:27   ` Andre McCurdy
@ 2016-01-09  7:43     ` Khem Raj
  2016-01-09  8:43       ` Khem Raj
  2016-01-09  9:58     ` Burton, Ross
  1 sibling, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-09  7:43 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Fri, Jan 8, 2016 at 7:27 PM, Andre McCurdy <armccurdy@gmail.com> wrote:
>> +diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h
>> +--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h      2013-12-18 19:16:24.000000000 -0500
>> ++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h   2015-07-18 16:57:47.178982835 -0400
>> +@@ -46,7 +46,7 @@
>> + /**********************************************************************************************************************/
>> +
>> + #define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
>> +-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
>> ++#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_MUTEX_RECURSIVE }
>
> This looks completely bogus.
>
> PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP initialises a pthread_mutex_t
> structure and PTHREAD_MUTEX_RECURSIVE is an enum. You can't just
> replace one with the other.

It indeed is bogus. I took it as a stepstone to get it compiling but
in reality what we need is a portable way to initialize recursive
mutex instead of _NP
something like using pthread_once during lock initialization. Let me
see what can be done.


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 24/53] directfb: Fix build with musl
  2016-01-09  7:43     ` Khem Raj
@ 2016-01-09  8:43       ` Khem Raj
  0 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-09  8:43 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Fri, Jan 8, 2016 at 11:43 PM, Khem Raj <raj.khem@gmail.com> wrote:
> On Fri, Jan 8, 2016 at 7:27 PM, Andre McCurdy <armccurdy@gmail.com> wrote:
>>> +diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h
>>> +--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/mutex.h      2013-12-18 19:16:24.000000000 -0500
>>> ++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/mutex.h   2015-07-18 16:57:47.178982835 -0400
>>> +@@ -46,7 +46,7 @@
>>> + /**********************************************************************************************************************/
>>> +
>>> + #define DIRECT_MUTEX_INITIALIZER(name)            { PTHREAD_MUTEX_INITIALIZER }
>>> +-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
>>> ++#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name)  { PTHREAD_MUTEX_RECURSIVE }
>>
>> This looks completely bogus.
>>
>> PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP initialises a pthread_mutex_t
>> structure and PTHREAD_MUTEX_RECURSIVE is an enum. You can't just
>> replace one with the other.
>
> It indeed is bogus. I took it as a stepstone to get it compiling but
> in reality what we need is a portable way to initialize recursive
> mutex instead of _NP
> something like using pthread_once during lock initialization. Let me
> see what can be done.

Please try out https://github.com/kraj/openembedded-core/commit/4104b7cdd0b58e24a926cdcf6415f3da3f48624e
which should be the right fix and portable one.


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 18:34       ` Khem Raj
@ 2016-01-09  8:59         ` Khem Raj
  0 siblings, 0 replies; 84+ messages in thread
From: Khem Raj @ 2016-01-09  8:59 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 10:34 AM, Khem Raj <raj.khem@gmail.com> wrote:
> On Fri, Jan 8, 2016 at 10:29 AM, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> On 8 January 2016 at 17:43, Khem Raj <raj.khem@gmail.com> wrote:
>>>
>>> systemd does not work with musl. I have patches in my tree to fix the
>>> build but then it does not run :(. musl and systemd has different
>>
>>
>> I wonder if we can/should raise a SkipPackage for systemd if musl is
>> enabled?
>
> Seems good.

I have updated the pull branch with

1. Fix for recursive mutex for directfb
2. Fix to skip parsing systemd for musl


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:53   ` Burton, Ross
  2016-01-08 17:57     ` Khem Raj
@ 2016-01-09  9:23     ` Khem Raj
  2016-01-09 10:06       ` Burton, Ross
  1 sibling, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-09  9:23 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:53 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 14:00, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> Hm, for some reason, this doesn't work for me.
>>
>> Lots and lots of "files installed but not packaged", all locales.  eg
>> /usr/lib/locale/hu/LC_MESSAGES/glib20.mo in glib-2.0.
>
>
> So under musl the translations are being installed to /usr/lib/locale,
> whereas under glibc its /usr/share/locale. This is showing some problems in
> bitbake.conf: that sets localedir to ${libdir}/locale but then sets
> FILES_PN-locale to ${datadir}/locale.
>

I have pushed a fix for this to pull branch as well here
https://github.com/kraj/openembedded-core/commit/db21a7a31e9c37f7c2dd0a914599d7b3467ae2d9

> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 24/53] directfb: Fix build with musl
  2016-01-09  3:27   ` Andre McCurdy
  2016-01-09  7:43     ` Khem Raj
@ 2016-01-09  9:58     ` Burton, Ross
  1 sibling, 0 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-09  9:58 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

On 9 January 2016 at 03:27, Andre McCurdy <armccurdy@gmail.com> wrote:

> For patches which fix 'correctness' issues uncovered by musl maybe
> it's better to apply the patches unconditionally, so they get some
> test cover from non-musl builds?
>
> Especially true in this case - see below.
>

Agreed. Patches should only be applied on overrides if they negatively
impact other configurations, so a strict correctness patch should always be
applied whereas a patch that stubs out glibc-specific code would be applied
on specific configurations.

Ross

[-- Attachment #2: Type: text/html, Size: 986 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-09  9:23     ` Khem Raj
@ 2016-01-09 10:06       ` Burton, Ross
  0 siblings, 0 replies; 84+ messages in thread
From: Burton, Ross @ 2016-01-09 10:06 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

On 9 January 2016 at 09:23, Khem Raj <raj.khem@gmail.com> wrote:

> I have pushed a fix for this to pull branch as well here
>
> https://github.com/kraj/openembedded-core/commit/db21a7a31e9c37f7c2dd0a914599d7b3467ae2d9
>

Awesome, thanks Khem.

Ross

[-- Attachment #2: Type: text/html, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-08 14:56 ` Burton, Ross
  2016-01-08 17:59   ` Khem Raj
@ 2016-01-10 21:10   ` Khem Raj
  2016-01-10 21:29     ` Matthias Schiffer
  1 sibling, 1 reply; 84+ messages in thread
From: Khem Raj @ 2016-01-10 21:10 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, Jan 8, 2016 at 6:56 AM, Burton, Ross <ross.burton@intel.com> wrote:
>
> On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> This set of fixes let core-image-full-cmdline build with musl along with
>> core-image-sato
>> and core-image-weston
>
>
> The postinst intercepts that are ran at rootfs time using user-mode qemu
> don't work with musl:
>
> NOTE: Running intercept scripts:
> NOTE: > Executing update_font_cache intercept ...
> /lib/ld-musl-i386.so.1: No such file or directory
> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/bin/fc-cache:
> Invalid ELF image for this architecture
> WARNING: The postinstall intercept hook 'update_font_cache' failed (exit
> code: 255)! See log for details!
> WARNING: The postinstalls for the following packages will be postponed for
> first boot: liberation-fonts
> NOTE: > Executing update_icon_cache intercept ...
> NOTE: > Executing update_pixbuf_cache intercept ...
> /lib/ld-musl-i386.so.1: No such file or directory
> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/lib/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders:
> Invalid ELF image for this architecture

I have fixed this issue as well.

https://github.com/kraj/openembedded-core/commit/1b65d8b36606167f4f04192abf4e14ada305cd8d

Its baking on my master tree, will post it along wiith phase 4 pull request.


>
> Ross


^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-10 21:10   ` Khem Raj
@ 2016-01-10 21:29     ` Matthias Schiffer
  2016-01-10 22:22       ` Phil Blundell
  0 siblings, 1 reply; 84+ messages in thread
From: Matthias Schiffer @ 2016-01-10 21:29 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 2091 bytes --]

On 01/10/2016 10:10 PM, Khem Raj wrote:
> On Fri, Jan 8, 2016 at 6:56 AM, Burton, Ross <ross.burton@intel.com> wrote:
>>
>> On 8 January 2016 at 10:19, Khem Raj <raj.khem@gmail.com> wrote:
>>>
>>> This set of fixes let core-image-full-cmdline build with musl along with
>>> core-image-sato
>>> and core-image-weston
>>
>>
>> The postinst intercepts that are ran at rootfs time using user-mode qemu
>> don't work with musl:
>>
>> NOTE: Running intercept scripts:
>> NOTE: > Executing update_font_cache intercept ...
>> /lib/ld-musl-i386.so.1: No such file or directory
>> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/bin/fc-cache:
>> Invalid ELF image for this architecture
>> WARNING: The postinstall intercept hook 'update_font_cache' failed (exit
>> code: 255)! See log for details!
>> WARNING: The postinstalls for the following packages will be postponed for
>> first boot: liberation-fonts
>> NOTE: > Executing update_icon_cache intercept ...
>> NOTE: > Executing update_pixbuf_cache intercept ...
>> /lib/ld-musl-i386.so.1: No such file or directory
>> /data/poky-master/tmp/work/qemux86-poky-linux-musl/core-image-sato/1.0-r0/rootfs/usr/lib/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders:
>> Invalid ELF image for this architecture
> 
> I have fixed this issue as well.
> 
> https://github.com/kraj/openembedded-core/commit/1b65d8b36606167f4f04192abf4e14ada305cd8d

I think making the symlinks relative like that will break in merged-usr
setups (which I'm currently trying to add support for in OE). E.g., when
ld.so is actually in /usr/lib and /lib symlinks to /usr/lib, the symlink
to ../usr/lib/libc.so will be wrong.

systemd has been relying on ln's -r (--relative) option for some time
for similar reasons, but it's a fairly recent addition to ln, so I'm not
sure if it's acceptable for OE. If not, adding a symlink helper based on
python's os.path.relpath might be a good idea.

Matthias


> 
> Its baking on my master tree, will post it along wiith phase 4 pull request.
> 
> 
>>
>> Ross



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-10 21:29     ` Matthias Schiffer
@ 2016-01-10 22:22       ` Phil Blundell
  2016-01-10 22:24         ` Paul Eggleton
  0 siblings, 1 reply; 84+ messages in thread
From: Phil Blundell @ 2016-01-10 22:22 UTC (permalink / raw)
  To: Matthias Schiffer; +Cc: OE-core

On Sun, 2016-01-10 at 22:29 +0100, Matthias Schiffer wrote:
> systemd has been relying on ln's -r (--relative) option for some time
> for similar reasons, but it's a fairly recent addition to ln, so I'm not
> sure if it's acceptable for OE. If not, adding a symlink helper based on
> python's os.path.relpath might be a good idea.

As a general rule, if it's not in POSIX (and I don't think "ln -r" is)
then we probably don't want OE to rely on it.  As far as I know, oe-core
doesn't currently require GNU ln to build.

p.




^ permalink raw reply	[flat|nested] 84+ messages in thread

* Re: [PATCH 00/53] musl fixes 3
  2016-01-10 22:22       ` Phil Blundell
@ 2016-01-10 22:24         ` Paul Eggleton
  0 siblings, 0 replies; 84+ messages in thread
From: Paul Eggleton @ 2016-01-10 22:24 UTC (permalink / raw)
  To: Phil Blundell, Matthias Schiffer; +Cc: openembedded-core

On Sun, 10 Jan 2016 22:22:19 Phil Blundell wrote:
> On Sun, 2016-01-10 at 22:29 +0100, Matthias Schiffer wrote:
> > systemd has been relying on ln's -r (--relative) option for some time
> > for similar reasons, but it's a fairly recent addition to ln, so I'm not
> > sure if it's acceptable for OE. If not, adding a symlink helper based on
> > python's os.path.relpath might be a good idea.
> 
> As a general rule, if it's not in POSIX (and I don't think "ln -r" is)
> then we probably don't want OE to rely on it.  As far as I know, oe-core
> doesn't currently require GNU ln to build.

This is why we have scripts/lnr to provide equivalent functionality.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 84+ messages in thread

end of thread, other threads:[~2016-01-10 22:24 UTC | newest]

Thread overview: 84+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 10:19 [PATCH 00/53] musl fixes 3 Khem Raj
2016-01-08 10:18 ` [PATCH 01/53] powertop: Include right headers for timval struct Khem Raj
2016-01-08 10:18 ` [PATCH 02/53] dhcp: Include sys/types.h for u_int* defs Khem Raj
2016-01-08 10:18 ` [PATCH 03/53] blktrace: Include <sys/types.h for dev_t Khem Raj
2016-01-08 10:18 ` [PATCH 04/53] ppp: Fix build with musl Khem Raj
2016-01-08 10:18 ` [PATCH 05/53] tcp-wrappers: " Khem Raj
2016-01-08 10:18 ` [PATCH 06/53] fts: Add recipe Khem Raj
2016-01-08 10:18 ` [PATCH 07/53] connman: include config.h for HAVE_STRUCT_IN6_PKTINFO_IPI6_ADDR Khem Raj
2016-01-08 10:18 ` [PATCH 08/53] libcgroup: Add dependency on fts when building on musl Khem Raj
2016-01-08 10:18 ` [PATCH 09/53] linux-libc-headers: Port patches for linux-headers for musl Khem Raj
2016-01-08 10:18 ` [PATCH 10/53] xserver-xorg: Fix build with musl Khem Raj
2016-01-08 10:18 ` [PATCH 11/53] gdk-pixbuf: Fix latent build issue exposed by musl Khem Raj
2016-01-08 10:18 ` [PATCH 12/53] argp-standalone: Add recipe Khem Raj
2016-01-08 10:18 ` [PATCH 13/53] gnutls: Link with libargp on musl and depend on argp-standalone Khem Raj
2016-01-08 10:18 ` [PATCH 14/53] util-linux: Fix ptest builds on musl Khem Raj
2016-01-08 10:18 ` [PATCH 15/53] webkitgtk: Fix build with clang Khem Raj
2016-01-08 10:18 ` [PATCH 16/53] elfutils: Fix build with uclibc Khem Raj
2016-01-08 10:18 ` [PATCH 17/53] packagegroup-self-hosted.bb: Move glibc-gconv-ibm850 to glibc only case Khem Raj
2016-01-08 10:18 ` [PATCH 18/53] guile: Fix build with uclibc Khem Raj
2016-01-08 10:18 ` [PATCH 19/53] gnutls: Link with libuargp on uclibc Khem Raj
2016-01-08 10:18 ` [PATCH 20/53] mtools: Fix build with uclibc Khem Raj
2016-01-08 16:17   ` Burton, Ross
2016-01-08 16:25     ` Burton, Ross
2016-01-08 17:27       ` Khem Raj
2016-01-08 10:18 ` [PATCH 21/53] parted: " Khem Raj
2016-01-08 10:18 ` [PATCH 22/53] net-tools: Link with libintl on uclibc Khem Raj
2016-01-08 10:18 ` [PATCH 23/53] libdrm: Upgrade 2.4.65 -> 2.4.66 Khem Raj
2016-01-08 10:18 ` [PATCH 24/53] directfb: Fix build with musl Khem Raj
2016-01-09  3:27   ` Andre McCurdy
2016-01-09  7:43     ` Khem Raj
2016-01-09  8:43       ` Khem Raj
2016-01-09  9:58     ` Burton, Ross
2016-01-08 10:18 ` [PATCH 25/53] gzip: " Khem Raj
2016-01-08 10:18 ` [PATCH 26/53] watchdog: " Khem Raj
2016-01-08 10:18 ` [PATCH 27/53] xinetd: " Khem Raj
2016-01-08 10:18 ` [PATCH 28/53] dpkg: Add musleabi to known architectures Khem Raj
2016-01-08 10:18 ` [PATCH 29/53] puzzles: Zero'ise structs before use Khem Raj
2016-01-08 10:18 ` [PATCH 30/53] Revert "glib-2.0: build dependency cleanup" Khem Raj
2016-01-08 10:39   ` Burton, Ross
2016-01-08 17:36     ` Khem Raj
2016-01-08 10:18 ` [PATCH 31/53] apt: Add support for building for musl targets Khem Raj
2016-01-08 10:19 ` [PATCH 32/53] libunwind: backtrace APIs are glibc specific Khem Raj
2016-01-08 10:19 ` [PATCH 33/53] babeltrace: Add missing header for MAXNAMLEN define Khem Raj
2016-01-08 10:19 ` [PATCH 34/53] elfutils: Fix build with musl Khem Raj
2016-01-08 10:19 ` [PATCH 35/53] sysklogd: untangle header inclusion maze Khem Raj
2016-01-08 10:19 ` [PATCH 36/53] console-tools: Include sys/types.h for u_char and u_short defs Khem Raj
2016-01-08 10:19 ` [PATCH 37/53] webkitgtk: Fix build on non-glibc linux systems Khem Raj
2016-01-08 10:19 ` [PATCH 38/53] rt-tests: Fix build with non-gcc compilers Khem Raj
2016-01-08 10:19 ` [PATCH 39/53] webkitgtk: Update patch status Khem Raj
2016-01-08 10:19 ` [PATCH 40/53] tar: Fix build for musl based targets Khem Raj
2016-01-08 10:19 ` [PATCH 41/53] net-tools: Fix build on musl Khem Raj
2016-01-08 10:19 ` [PATCH 42/53] pax: Fix build with musl Khem Raj
2016-01-08 10:19 ` [PATCH 43/53] iputils: " Khem Raj
2016-01-08 10:19 ` [PATCH 44/53] libuser: Fix build when secure getenv is not there Khem Raj
2016-01-08 10:19 ` [PATCH 45/53] iproute2: Fix build with musl Khem Raj
2016-01-08 10:19 ` [PATCH 46/53] irda-utils: Fix header inclusions Khem Raj
2016-01-08 10:19 ` [PATCH 47/53] nspr: Drop older glibc code Khem Raj
2016-01-08 10:19 ` [PATCH 48/53] chkconfig: Avoid using caddr_t Khem Raj
2016-01-08 10:19 ` [PATCH 49/53] tcf-agent: Implement canonicalize_file_name() for musl as well Khem Raj
2016-01-08 10:19 ` [PATCH 50/53] bsd-headers, musl: Add recipe for bsd missing features Khem Raj
2016-01-08 10:19 ` [PATCH 51/53] nfs-utils: Disable tcp-wrappers for musl Khem Raj
2016-01-08 10:19 ` [PATCH 52/53] portmap: Point to tirpc headers and libraries on musl Khem Raj
2016-01-08 10:19 ` [PATCH 53/53] elfutils: Add ALLOW_EMPTY for musl Khem Raj
2016-01-08 10:58 ` [PATCH 00/53] musl fixes 3 Burton, Ross
2016-01-08 14:00 ` Burton, Ross
2016-01-08 14:12   ` Burton, Ross
2016-01-08 14:23     ` Burton, Ross
2016-01-08 17:46     ` Khem Raj
2016-01-08 14:32   ` Burton, Ross
2016-01-08 17:47     ` Khem Raj
2016-01-08 14:53   ` Burton, Ross
2016-01-08 17:57     ` Khem Raj
2016-01-09  9:23     ` Khem Raj
2016-01-09 10:06       ` Burton, Ross
2016-01-08 17:43   ` Khem Raj
2016-01-08 18:29     ` Burton, Ross
2016-01-08 18:34       ` Khem Raj
2016-01-09  8:59         ` Khem Raj
2016-01-08 14:56 ` Burton, Ross
2016-01-08 17:59   ` Khem Raj
2016-01-10 21:10   ` Khem Raj
2016-01-10 21:29     ` Matthias Schiffer
2016-01-10 22:22       ` Phil Blundell
2016-01-10 22:24         ` Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.