mdadm: fix build with gcc14 and musl, use gnu basename

This commit is contained in:
oreo639 2025-03-07 05:20:33 -08:00
parent 150dc658a9
commit 10694f08c4
3 changed files with 20 additions and 11 deletions

View file

@ -0,0 +1,19 @@
Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/a292d641ca2d765507aac4fc2925bb651e2f84b2/main/mdadm/basename.patch
--- a/mdadm.h
+++ b/mdadm.h
@@ -248,6 +248,14 @@ static inline void __put_unaligned32(__u
}
/*
+ * Ensure GNU basename behavior for musl libc
+ */
+#ifndef __GLIBC__
+#define basename(path) \
+ (strrchr((path),'/') ? strrchr((path),'/')+1 : (path))
+#endif
+
+/*
* Check at compile time that something is of a particular type.
* Always evaluates to 1 so you may use it easily in comparisons.
*/

View file

@ -18,13 +18,3 @@
#include <signal.h>
#include <sys/signalfd.h>
#include <sys/wait.h>
--- mdadm-4.3/Monitor.c
+++ mdadm-4.3/Monitor.c
@@ -29,6 +29,7 @@
#include <sys/wait.h>
#include <limits.h>
#include <syslog.h>
+#include <libgen.h>
#define TASK_COMM_LEN 16
#define EVENT_NAME_MAX 32

View file

@ -1,7 +1,7 @@
# Template file for 'mdadm'
pkgname=mdadm
version=4.3
revision=3
revision=4
hostmakedepends="pkg-config"
makedepends="eudev-libudev-devel"
short_desc="Tool for managing/monitoring Linux md device arrays"