Find fts-standalone on musl
Commit Message
Bug: https://bugs.gentoo.org/831571
---
configure.ac | 7 +++++++
src/Makefile.am | 4 ++--
tools/Makefile.am | 3 ++-
tools/abisym.cc | 1 +
tools/kmidiff.cc | 1 -
5 files changed, 12 insertions(+), 4 deletions(-)
Comments
On Sat, 2022-01-29 at 20:31 +0100, David Seifert wrote:
> Bug: https://bugs.gentoo.org/831571
> ---
> configure.ac | 7 +++++++
> src/Makefile.am | 4 ++--
> tools/Makefile.am | 3 ++-
> tools/abisym.cc | 1 +
> tools/kmidiff.cc | 1 -
> 5 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 29130175..019bdbac 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -161,6 +161,7 @@ dnl check for dependencies
> dnl *************************************************
>
> AC_PROG_CXX
> +AC_CANONICAL_HOST
> AC_USE_SYSTEM_EXTENSIONS
> AC_PROG_INSTALL
>
> @@ -219,6 +220,12 @@ AS_IF([test "x$ac_cv_bad_fts" = "xyes"],
> [CFLAGS="$CFLAGS -DBAD_FTS=1",
> CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"])
>
> +dnl On musl, we need to find fts-standalone
> +AS_CASE(
> + [${host_os}], [*-musl*], [
> + PKG_CHECK_MODULES([FTS], [fts-standalone])
> +])
> +
> dnl Check for dependency: libelf, libdw, libebl (elfutils)
> dnl Note that we need to use at least elfutils 0.159 but
> dnl at that time elfutils didnt have pkgconfig capabilities
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 29da1ecf..1591224f 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -46,12 +46,12 @@ if CTF_READER
> libabigail_la_SOURCES += abg-ctf-reader.cc
> endif
>
> -libabigail_la_LIBADD = $(DEPS_LIBS)
> +libabigail_la_LIBADD = $(DEPS_LIBS) $(FTS_LIBS)
> libabigail_la_LDFLAGS = -lpthread -Wl,--as-needed -no-undefined
>
> CUSTOM_MACROS = -DABIGAIL_ROOT_SYSTEM_LIBDIR=\"${libdir}\"
>
> AM_CPPFLAGS=\
> -$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) \
> +$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) $(FTS_CFLAGS) \
> -Wall -I$(abs_top_srcdir) -I$(abs_top_srcdir)/include \
> -I$(abs_top_builddir)/include -I$(abs_top_builddir)
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 648a71b5..f7592b60 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -37,7 +37,8 @@ abicompat_LDADD =
> $(abs_top_builddir)/src/libabigail.la
>
> abipkgdiff_SOURCES = abipkgdiff.cc
> abipkgdiffdir = $(bindir)
> -abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la
> +abipkgdiff_CPPFLAGS = $(FTS_CFLAGS)
> +abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la $(FTS_LIBS)
> abipkgdiff_LDFLAGS = -pthread
>
> kmidiff_SOURCES = kmidiff.cc
> diff --git a/tools/abisym.cc b/tools/abisym.cc
> index a8fe19cd..a105e4ff 100644
> --- a/tools/abisym.cc
> +++ b/tools/abisym.cc
> @@ -12,6 +12,7 @@
>
> #include <libgen.h>
> #include <elf.h>
> +#include <libgen.h>
> #include <cstring>
> #include <iostream>
> #include <sstream>
Ignore this hunk; my patch derives from a local patch in Gentoo applied
to the git tree, which I hadn't double-checked (069ead6b).
> diff --git a/tools/kmidiff.cc b/tools/kmidiff.cc
> index b802348f..2e88baa7 100644
> --- a/tools/kmidiff.cc
> +++ b/tools/kmidiff.cc
> @@ -11,7 +11,6 @@
>
> #include <sys/types.h>
> #include <dirent.h>
> -#include <fts.h>
> #include <cstring>
> #include <string>
> #include <vector>
Hello David,
David Seifert via Libabigail <libabigail@sourceware.org> a écrit:
> Bug: https://bugs.gentoo.org/831571
> ---
> configure.ac | 7 +++++++
> src/Makefile.am | 4 ++--
> tools/Makefile.am | 3 ++-
> tools/abisym.cc | 1 +
> tools/kmidiff.cc | 1 -
> 5 files changed, 12 insertions(+), 4 deletions(-)
Thank you for this patch!
I have amended it a little to make its commit log part comply with the
project's standard described at in the COMMIT-LOG-GUIDELINES file in the
source tree, which can be browsed online at
https://sourceware.org/git/?p=libabigail.git;a=blob_plain;f=COMMIT-LOG-GUIDELINES.
You'll find the patch attached bellow.
Also, as described at line 284 of the CONTRIBUTING file in the source
tree, which can be browsed online at
https://sourceware.org/git/?p=libabigail.git;a=blob;f=CONTRIBUTING;hb=HEAD#l284,
I need you to write a
signed-off-by Daved Seifert <your-email-address>
In reply to the patch below so that I can add it to the git repository.
So here is the patch from you (modulo the signed-off-by that I still
need from you) that I propose to apply to the git repository.
Is that OK?
Thanks.
From f685aedb92e7b6a31ccf26791f61304f26f2dab1 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Sat, 29 Jan 2022 20:31:07 +0100
Subject: [PATCH] Find fts-standalone on musl
When using the musl C library fts is optional. So we need to detect
its presence by looking at the fts-standalone pkgconfig module.
This patch does that.
This comes from Gentoo bug https://bugs.gentoo.org/831571
* configure.ac: Invoke AC_CANONICAL_HOST to compute the host_cpu,
host_vendor, host_os parts of the 'host" variable. Then if the
host_os ends up with "musl" then, check for the fts-standalone
pkgconfig module and record the fts library into
FTS_{LIBS,CFLAGS}.
* src/Makefile.am: Link to $FTS_LIBS and use $FTS_CFLAGS for
compilation.
* tools/Makefile.am: Likewise.
* tools/abisym.cc: Include libgen.h
* tools/kmidiff.cc: Remove useless fts.h header file.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
configure.ac | 7 +++++++
src/Makefile.am | 4 ++--
tools/Makefile.am | 3 ++-
tools/kmidiff.cc | 1 -
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 29130175..019bdbac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,6 +161,7 @@ dnl check for dependencies
dnl *************************************************
AC_PROG_CXX
+AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
@@ -219,6 +220,12 @@ AS_IF([test "x$ac_cv_bad_fts" = "xyes"],
[CFLAGS="$CFLAGS -DBAD_FTS=1",
CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"])
+dnl On musl, we need to find fts-standalone
+AS_CASE(
+ [${host_os}], [*-musl*], [
+ PKG_CHECK_MODULES([FTS], [fts-standalone])
+])
+
dnl Check for dependency: libelf, libdw, libebl (elfutils)
dnl Note that we need to use at least elfutils 0.159 but
dnl at that time elfutils didnt have pkgconfig capabilities
diff --git a/src/Makefile.am b/src/Makefile.am
index 29da1ecf..1591224f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,12 +46,12 @@ if CTF_READER
libabigail_la_SOURCES += abg-ctf-reader.cc
endif
-libabigail_la_LIBADD = $(DEPS_LIBS)
+libabigail_la_LIBADD = $(DEPS_LIBS) $(FTS_LIBS)
libabigail_la_LDFLAGS = -lpthread -Wl,--as-needed -no-undefined
CUSTOM_MACROS = -DABIGAIL_ROOT_SYSTEM_LIBDIR=\"${libdir}\"
AM_CPPFLAGS=\
-$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) \
+$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) $(FTS_CFLAGS) \
-Wall -I$(abs_top_srcdir) -I$(abs_top_srcdir)/include \
-I$(abs_top_builddir)/include -I$(abs_top_builddir)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 648a71b5..f7592b60 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -37,7 +37,8 @@ abicompat_LDADD = $(abs_top_builddir)/src/libabigail.la
abipkgdiff_SOURCES = abipkgdiff.cc
abipkgdiffdir = $(bindir)
-abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la
+abipkgdiff_CPPFLAGS = $(FTS_CFLAGS)
+abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la $(FTS_LIBS)
abipkgdiff_LDFLAGS = -pthread
kmidiff_SOURCES = kmidiff.cc
diff --git a/tools/kmidiff.cc b/tools/kmidiff.cc
index b802348f..2e88baa7 100644
--- a/tools/kmidiff.cc
+++ b/tools/kmidiff.cc
@@ -11,7 +11,6 @@
#include <sys/types.h>
#include <dirent.h>
-#include <fts.h>
#include <cstring>
#include <string>
#include <vector>
@@ -161,6 +161,7 @@ dnl check for dependencies
dnl *************************************************
AC_PROG_CXX
+AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
@@ -219,6 +220,12 @@ AS_IF([test "x$ac_cv_bad_fts" = "xyes"],
[CFLAGS="$CFLAGS -DBAD_FTS=1",
CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"])
+dnl On musl, we need to find fts-standalone
+AS_CASE(
+ [${host_os}], [*-musl*], [
+ PKG_CHECK_MODULES([FTS], [fts-standalone])
+])
+
dnl Check for dependency: libelf, libdw, libebl (elfutils)
dnl Note that we need to use at least elfutils 0.159 but
dnl at that time elfutils didnt have pkgconfig capabilities
@@ -46,12 +46,12 @@ if CTF_READER
libabigail_la_SOURCES += abg-ctf-reader.cc
endif
-libabigail_la_LIBADD = $(DEPS_LIBS)
+libabigail_la_LIBADD = $(DEPS_LIBS) $(FTS_LIBS)
libabigail_la_LDFLAGS = -lpthread -Wl,--as-needed -no-undefined
CUSTOM_MACROS = -DABIGAIL_ROOT_SYSTEM_LIBDIR=\"${libdir}\"
AM_CPPFLAGS=\
-$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) \
+$(CUSTOM_MACROS) $(DEPS_CPPFLAGS) $(FTS_CFLAGS) \
-Wall -I$(abs_top_srcdir) -I$(abs_top_srcdir)/include \
-I$(abs_top_builddir)/include -I$(abs_top_builddir)
@@ -37,7 +37,8 @@ abicompat_LDADD = $(abs_top_builddir)/src/libabigail.la
abipkgdiff_SOURCES = abipkgdiff.cc
abipkgdiffdir = $(bindir)
-abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la
+abipkgdiff_CPPFLAGS = $(FTS_CFLAGS)
+abipkgdiff_LDADD = $(abs_top_builddir)/src/libabigail.la $(FTS_LIBS)
abipkgdiff_LDFLAGS = -pthread
kmidiff_SOURCES = kmidiff.cc
@@ -12,6 +12,7 @@
#include <libgen.h>
#include <elf.h>
+#include <libgen.h>
#include <cstring>
#include <iostream>
#include <sstream>
@@ -11,7 +11,6 @@
#include <sys/types.h>
#include <dirent.h>
-#include <fts.h>
#include <cstring>
#include <string>
#include <vector>