cross-tools: fts has different types for cmp routine
fts has different types for its compare rotuine. Other systems, not 4.4BSD based, have a non-const version. Before we tested against __GLIBC__, but now we test against __linux__ because that's Linux's API and musl doesn't define __GLIBC__. In addition, link against libftl on this platform since musl doesn't include ftl routines in libc, but rather in libftl. Co-authored-by: Val Packett <val@packett.cool> Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/1066 Reviewed by: val_packett.cool Differential Revision: https://reviews.freebsd.org/D45349
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
#define HAVE_ENDIAN 0
|
#define HAVE_ENDIAN 0
|
||||||
#define HAVE_ERR 1
|
#define HAVE_ERR 1
|
||||||
#define HAVE_FTS 1
|
#define HAVE_FTS 1
|
||||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#define HAVE_FTS_COMPARE_CONST 0
|
#define HAVE_FTS_COMPARE_CONST 0
|
||||||
#else
|
#else
|
||||||
#define HAVE_FTS_COMPARE_CONST 1
|
#define HAVE_FTS_COMPARE_CONST 1
|
||||||
|
|||||||
@@ -1355,7 +1355,7 @@ int main(int argc, char *argv[])
|
|||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
fts_compare(const FTSENT **a, const FTSENT **b)
|
fts_compare(const FTSENT **a, const FTSENT **b)
|
||||||
#else
|
#else
|
||||||
fts_compare(const FTSENT * const *a, const FTSENT * const *b)
|
fts_compare(const FTSENT * const *a, const FTSENT * const *b)
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
|
|||||||
CFLAGS+= -D_GNU_SOURCE=1
|
CFLAGS+= -D_GNU_SOURCE=1
|
||||||
# Needed for sem_init, etc. on Linux (used by usr.bin/sort)
|
# Needed for sem_init, etc. on Linux (used by usr.bin/sort)
|
||||||
LDADD+= -pthread
|
LDADD+= -pthread
|
||||||
|
.if exists(/usr/lib/libfts.so) || exists(/usr/lib/libfts.a) || exists(/lib/libfts.so) || exists(/lib/libfts.a)
|
||||||
|
# Needed for fts_open, etc. on musl (used by usr.bin/grep)
|
||||||
|
LDADD+= -lfts
|
||||||
|
.endif
|
||||||
|
|
||||||
.elif ${.MAKE.OS} == "Darwin"
|
.elif ${.MAKE.OS} == "Darwin"
|
||||||
CFLAGS+= -D_DARWIN_C_SOURCE=1
|
CFLAGS+= -D_DARWIN_C_SOURCE=1
|
||||||
|
|||||||
@@ -745,7 +745,7 @@ usage(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
compare(const FTSENT **a, const FTSENT **b)
|
compare(const FTSENT **a, const FTSENT **b)
|
||||||
#else
|
#else
|
||||||
compare(const FTSENT *const *a, const FTSENT *const *b)
|
compare(const FTSENT *const *a, const FTSENT *const *b)
|
||||||
|
|||||||
Reference in New Issue
Block a user