From 592515ba2adffe2711bd314de95f8f187c1ab607 Mon Sep 17 00:00:00 2001 From: Doan Tran Cong Danh Date: Fri, 8 Nov 2019 18:49:13 +0700 Subject: [PATCH] dracut: dynamic link against libfts on musl Static link against libfts is BSD-violation if we don't ship their license. --- ...find-cflags-and-libs-for-fts-on-musl.patch | 96 +++++++++++++++++++ srcpkgs/dracut/template | 8 +- 2 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 srcpkgs/dracut/patches/0001-configure-find-cflags-and-libs-for-fts-on-musl.patch diff --git a/srcpkgs/dracut/patches/0001-configure-find-cflags-and-libs-for-fts-on-musl.patch b/srcpkgs/dracut/patches/0001-configure-find-cflags-and-libs-for-fts-on-musl.patch new file mode 100644 index 00000000000..a57a443dc1d --- /dev/null +++ b/srcpkgs/dracut/patches/0001-configure-find-cflags-and-libs-for-fts-on-musl.patch @@ -0,0 +1,96 @@ +From 5ac43335bbf7620a04146130bcf37e4f17cd5a8e Mon Sep 17 00:00:00 2001 +From: Doan Tran Cong Danh +Date: Wed, 6 Nov 2019 18:35:12 +0700 +Subject: [PATCH 1/3] configure: find cflags and libs for fts on musl + +Signed-off-by: Doan Tran Cong Danh +--- + Makefile | 2 +- + configure | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+), 1 deletion(-) + +diff --git Makefile Makefile +index 31545899..f9b42b96 100644 +--- Makefile ++++ Makefile +@@ -62,7 +62,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h + install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h + + install/dracut-install: $(DRACUT_INSTALL_OBJECTS) +- $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS) ++ $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS) + + logtee: logtee.c + $(CC) $(LDFLAGS) -o $@ $< +diff --git configure configure +index b55fb609..3f724ef2 100755 +--- configure ++++ configure +@@ -7,6 +7,7 @@ prefix=/usr + + enable_documentation=yes + ++CC="${CC:-cc}" + PKG_CONFIG="${PKG_CONFIG:-pkg-config}" + + # Little helper function for reading args from the commandline. +@@ -57,6 +58,48 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then + exit 1 + fi + ++cat <conftest.c ++#include ++int main() { ++ return 0; ++} ++EOF ++ ++${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1 ++ret=$? ++rm -f conftest.c a.out ++ ++# musl doesn't have fts.h included ++if test $ret -ne 0; then ++ echo "dracut needs fts development files." >&2 ++ exit 1 ++fi ++ ++cat <conftest.c ++#include ++int main(void) { ++ fts_open(0, 0, 0); ++ return 0; ++} ++EOF ++ ++found=no ++for lib in "-lc" "-lfts"; do ++ ${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1 ++ ret=$? ++ if test $ret -eq 0; then ++ FTS_LIBS="$lib" ++ found=yes ++ break; ++ fi ++done ++rm -f conftest.c a.out ++ ++if test $found = no; then ++ echo "dracut couldn't find usable fts library" >&2 ++ exit 1 ++fi ++ + cat > Makefile.inc.$$ <= 23 ") + KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ") ++FTS_LIBS ?= ${FTS_LIBS} + EOF + + { +-- +2.24.0.9.g35b3684e14 + diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template index f5e420eb6bd..568d219b54e 100644 --- a/srcpkgs/dracut/template +++ b/srcpkgs/dracut/template @@ -1,7 +1,7 @@ # Template file for 'dracut' pkgname=dracut version=049 -revision=3 +revision=4 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc" conf_files="/etc/dracut.conf" @@ -25,12 +25,6 @@ case "$XBPS_TARGET_MACHINE" in ;; esac -do_build() { - case "$XBPS_TARGET_MACHINE" in - *-musl) make ${makejobs} LDLIBS="${XBPS_CROSS_BASE}/usr/lib/libfts.a";; - esac -} - do_check() { # Requires the distfile to be a git repository :