fts: Add recipe
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 (From OE-Core rev: 387f84899cc93c06f3e29991c2fc6c1157bddd81) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6e3950b450
commit
cc55fc78fb
|
@ -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.*"
|
||||
|
|
@ -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 */
|
|
@ -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
|
File diff suppressed because it is too large
Load Diff
|
@ -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]))
|
||||
|
|
@ -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>
|
Loading…
Reference in New Issue