Files
nixpkgs/pkgs/os-specific/linux/dmraid/default.nix
T
ghpzin 3c8da751e6 dmraid: fix build with gcc15
- add rebased patch from alpine:
https://gitlab.alpinelinux.org/alpine/aports/-/raw/dc5b3135517ede55f5e3530e538ca75048d26565/main/dmraid/008-gcc15.patch
(does not apply with `fetchpatch` even with `stripLen` and `extraPrefix`)

Fixes build failure with gcc15:
```
activate/activate.c:893:34: error: passing argument 3 of 'do_device'
from incompatible pointer type [-Wincompatible-pointer-types]
  893 |         return do_device(lc, rs, dm_register_for_event);
      |                                  ^~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  int (*)(char *, char *)
activate/activate.c:869:62: note: expected 'int (*)(void)' but argument
is of type 'int (*)(char *, char *)'
  869 | do_device(struct lib_context *lc, struct raid_set *rs, int (*f) ())
      |                                                        ~~~~~~^~~~~
activate/activate.c:850:1: note: 'dm_register_for_event' declared here
  850 | dm_register_for_event(char *dev_name, char *lib_name)
      | ^~~~~~~~~~~~~~~~~~~~~
misc/file.c:66:17: error: initialization of 'ssize_t (*)(void)'
{aka 'long int (*)(void)'} from incompatible pointer type
'ssize_t (*)(int,  void *, size_t)' {aka 'long int (*)(int,  void *, long unsigned int)'} [-Wincompatible-pointer-types]
   66 |                 read, "read"}, {
      |                 ^~~~
misc/file.c:67:9: error: initialization of 'ssize_t (*)(void)' {aka 'long int (*)(void)'}
from incompatible pointer type 'ssize_t (*)(int,  const void *, size_t)'
{aka 'long int (*)(int,  const void *, long unsigned int)'} [-Wincompatible-pointer-types]
   67 |         write, "writ"},}, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0);
      |         ^~~~~
misc/file.c:67:9: note: (near initialization for 'rw_spec[1].func')
```
2025-09-28 13:31:09 +03:00

70 lines
2.1 KiB
Nix

{
lib,
stdenv,
fetchurl,
fetchpatch,
lvm2,
}:
stdenv.mkDerivation rec {
pname = "dmraid";
version = "1.0.0.rc16";
src = fetchurl {
url = "https://people.redhat.com/~heinzm/sw/dmraid/src/old/dmraid-${version}.tar.bz2";
sha256 = "0m92971gyqp61darxbiri6a48jz3wq3gkp8r2k39320z0i6w8jgq";
};
patches = [
./hardening-format.patch
./fix-dmevent_tool.patch
# Fix build with gcc15, based on
# https://gitlab.alpinelinux.org/alpine/aports/-/raw/dc5b3135517ede55f5e3530e538ca75048d26565/main/dmraid/008-gcc15.patch
./dmraid-fix-build-with-gcc15.patch
]
++ lib.optionals stdenv.hostPlatform.isMusl [
(fetchpatch {
url = "https://raw.githubusercontent.com/void-linux/void-packages/fceed4b8e96b3c1da07babf6f67b6ed1588a28b2/srcpkgs/dmraid/patches/006-musl-libc.patch";
sha256 = "1j8xda0fpz8lxjxnqdidy7qb866qrzwpbca56yjdg6vf4x21hx6w";
stripLen = 2;
extraPrefix = "1.0.0.rc16/";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/void-linux/void-packages/fceed4b8e96b3c1da07babf6f67b6ed1588a28b2/srcpkgs/dmraid/patches/007-fix-loff_t-musl.patch";
sha256 = "0msnq39qnzg3b1pdksnz1dgqwa3ak03g41pqh0lw3h7w5rjc016k";
stripLen = 2;
extraPrefix = "1.0.0.rc16/";
})
];
postPatch = ''
sed -i 's/\[\[[^]]*\]\]/[ "''$''${n##*.}" = "so" ]/' */lib/Makefile.in
''
+ lib.optionalString stdenv.hostPlatform.isMusl ''
NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE"
'';
preConfigure = "cd */";
buildInputs = [ lvm2 ];
# Hand-written Makefile does not have full dependencies to survive
# parallel build:
# tools/dmraid.c:12:10: fatal error: dmraid/dmraid.h: No such file
enableParallelBuilding = false;
meta = {
description = "Old-style RAID configuration utility";
longDescription = ''
Old RAID configuration utility (still under development, though).
It is fully compatible with modern kernels and mdadm recognizes
its volumes. May be needed for rescuing an older system or nuking
the metadata when reformatting.
'';
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl2Plus;
};
}