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

Closes: https://bugs.gentoo.org/926289
Thanks-to: ernsteiswuerfel <erhard_f@mailbox.org>
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2025-02-13 11:58:30 +00:00
parent f3a618d336
commit 2637faef70
3 changed files with 35 additions and 0 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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"