Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2024 17:40:20 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 364c014d9ba0 - main - cross-tools: fts has different types for cmp routine
Message-ID:  <202405261740.44QHeKV8085310@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=364c014d9ba052758f32d2e3e1b0c297c64ac730

commit 364c014d9ba052758f32d2e3e1b0c297c64ac730
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-05-26 17:38:30 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-26 17:38:30 +0000

    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
---
 contrib/mandoc/config.h         | 2 +-
 lib/libpmc/pmu-events/jevents.c | 2 +-
 tools/build/mk/Makefile.boot    | 4 ++++
 usr.sbin/kldxref/kldxref.c      | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/contrib/mandoc/config.h b/contrib/mandoc/config.h
index 91957717b3fc..ea6d70042670 100644
--- a/contrib/mandoc/config.h
+++ b/contrib/mandoc/config.h
@@ -13,7 +13,7 @@
 #define HAVE_ENDIAN 0
 #define HAVE_ERR 1
 #define HAVE_FTS 1
-#if defined(__GLIBC__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
 #define HAVE_FTS_COMPARE_CONST 0
 #else
 #define HAVE_FTS_COMPARE_CONST 1
diff --git a/lib/libpmc/pmu-events/jevents.c b/lib/libpmc/pmu-events/jevents.c
index 7059b31da2ba..628ed26c6f9d 100644
--- a/lib/libpmc/pmu-events/jevents.c
+++ b/lib/libpmc/pmu-events/jevents.c
@@ -1355,7 +1355,7 @@ err_out:
 #include <fts.h>
 
 static int
-#if defined(__GLIBC__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
 fts_compare(const FTSENT **a, const FTSENT **b)
 #else
 fts_compare(const FTSENT * const *a, const FTSENT * const *b)
diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot
index 9f63a7499592..b8a5c7780948 100644
--- a/tools/build/mk/Makefile.boot
+++ b/tools/build/mk/Makefile.boot
@@ -50,6 +50,10 @@ CFLAGS+=	-I${SRCTOP}/tools/build/cross-build/include/linux
 CFLAGS+=	-D_GNU_SOURCE=1
 # Needed for sem_init, etc. on Linux (used by usr.bin/sort)
 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"
 CFLAGS+=	-D_DARWIN_C_SOURCE=1
diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c
index c88769ce1824..122551940ac7 100644
--- a/usr.sbin/kldxref/kldxref.c
+++ b/usr.sbin/kldxref/kldxref.c
@@ -745,7 +745,7 @@ usage(void)
 }
 
 static int
-#if defined(__GLIBC__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
 compare(const FTSENT **a, const FTSENT **b)
 #else
 compare(const FTSENT *const *a, const FTSENT *const *b)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405261740.44QHeKV8085310>