commit:     2637faef70821b8cfa25cd5ca4d340fa3ddf70bd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 13 11:58:30 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 13 11:58:30 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2637faef

sys-fs/mdadm: backport musl build fixes to 4.3-r1

Closes: https://bugs.gentoo.org/926289
Thanks-to: ernsteiswuerfel <erhard_f <AT> mailbox.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/mdadm/files/mdadm-4.3-musl-basename.patch | 19 +++++++++++++++++++
 sys-fs/mdadm/files/mdadm-4.3-musl-include.patch  | 14 ++++++++++++++
 sys-fs/mdadm/mdadm-4.3-r1.ebuild                 |  2 ++
 3 files changed, 35 insertions(+)

diff --git a/sys-fs/mdadm/files/mdadm-4.3-musl-basename.patch 
b/sys-fs/mdadm/files/mdadm-4.3-musl-basename.patch
new file mode 100644
index 000000000000..b8d0c3a7ca5c
--- /dev/null
+++ b/sys-fs/mdadm/files/mdadm-4.3-musl-basename.patch
@@ -0,0 +1,19 @@
+https://bugs.gentoo.org/926289#c6
+https://github.com/md-raid-utilities/mdadm/commit/9dbd11e091f84eb0bf9d717283774816c4c4453d
+--- a/mdadm.h
++++ b/mdadm.h
+@@ -223,6 +223,14 @@ struct dlm_lksb {
+ struct __una_u16 { __u16 x; } __attribute__ ((packed));
+ struct __una_u32 { __u32 x; } __attribute__ ((packed));
+ 
++/*
++ * Ensure GNU basename behavior on GLIBC less systems.
++ */
++#ifndef __GLIBC__
++#define basename(path) \
++       (strrchr((path), '/') ? strrchr((path),'/') + 1 : (path))
++#endif
++
+ static inline __u16 __get_unaligned16(const void *p)
+ {
+       const struct __una_u16 *ptr = (const struct __una_u16 *)p;

diff --git a/sys-fs/mdadm/files/mdadm-4.3-musl-include.patch 
b/sys-fs/mdadm/files/mdadm-4.3-musl-include.patch
new file mode 100644
index 000000000000..da9efc9a0171
--- /dev/null
+++ b/sys-fs/mdadm/files/mdadm-4.3-musl-include.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/926289#c7
+https://github.com/md-raid-utilities/mdadm/commit/8bda86099089b44129ef6206764f9de47a45f0db
+--- a/util.c
++++ b/util.c
+@@ -36,7 +36,7 @@
+ #include      <ctype.h>
+ #include      <dirent.h>
+ #include      <dlfcn.h>
+-
++#include      <limits.h>
+ 
+ /*
+  * following taken from linux/blkpg.h because they aren't
+

diff --git a/sys-fs/mdadm/mdadm-4.3-r1.ebuild b/sys-fs/mdadm/mdadm-4.3-r1.ebuild
index a7b58ea2ef44..140f5323f71f 100644
--- a/sys-fs/mdadm/mdadm-4.3-r1.ebuild
+++ b/sys-fs/mdadm/mdadm-4.3-r1.ebuild
@@ -37,6 +37,8 @@ PATCHES=(
        "${FILESDIR}/${PN}"-4.3-no-udev.patch
        "${FILESDIR}/${PN}"-4.3-musl125-1.patch
        "${FILESDIR}/${PN}"-4.3-do-not-call-gcc-directly.patch # 931972
+       "${FILESDIR}/${PN}"-4.3-musl-basename.patch
+       "${FILESDIR}/${PN}"-4.3-musl-include.patch
        "${WORKDIR}/debian/patches/debian/0001-fix-manpages.patch"
        
"${WORKDIR}/debian/patches/debian/0003-host-name-in-default-mailfrom.patch"
        
"${WORKDIR}/debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch"

Reply via email to