2022-04-27 09:35:20 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, pkg-config, perl, lvm2, libaio, readline, systemd, liburcu, json_c, kmod, nixosTests }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "multipath-tools";
|
|
|
|
version = "0.8.3";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
name = "${pname}-${version}.tar.gz";
|
|
|
|
url = "https://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=snapshot;h=refs/tags/${version};sf=tgz";
|
|
|
|
sha256 = "1mgjylklh1cx8px8ffgl12kyc0ln3445vbabd2sy8chq31rpiiq8";
|
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
patches = [
|
|
|
|
# fix build with json-c 0.14 https://www.redhat.com/archives/dm-devel/2020-May/msg00261.html
|
|
|
|
./json-c-0.14.patch
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
# pull upstream fix for -fno-common toolchains like clang-12
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fno-common.patch";
|
|
|
|
url = "https://github.com/opensvc/multipath-tools/commit/23a9247fa89cd0c84fe7e0f32468fd698b1caa48.patch";
|
|
|
|
sha256 = "10hq0g2jfkfbmwhm4x4q5cgsswj30lm34ib153alqzjzsxc1hqjk";
|
|
|
|
})
|
2020-08-20 17:08:02 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2021-04-08 16:26:57 +00:00
|
|
|
substituteInPlace libmultipath/Makefile \
|
|
|
|
--replace /usr/include/libdevmapper.h ${lib.getDev lvm2}/include/libdevmapper.h
|
|
|
|
|
2021-10-14 00:43:12 +00:00
|
|
|
# systemd-udev-settle.service is deprecated.
|
2021-04-08 16:26:57 +00:00
|
|
|
substituteInPlace multipathd/multipathd.service \
|
|
|
|
--replace /sbin/modprobe ${lib.getBin kmod}/sbin/modprobe \
|
2021-10-14 00:43:12 +00:00
|
|
|
--replace /sbin/multipathd "$out/bin/multipathd" \
|
|
|
|
--replace " systemd-udev-settle.service" ""
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i -re '
|
|
|
|
s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
|
|
|
|
' libmultipath/defaults.h
|
|
|
|
sed -i -e 's,\$(DESTDIR)/\(usr/\)\?,$(prefix)/,g' \
|
|
|
|
kpartx/Makefile libmpathpersist/Makefile
|
2020-06-02 18:00:15 +00:00
|
|
|
sed -i -e "s,GZIP,GZ," \
|
|
|
|
$(find * -name Makefile\*)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [ pkg-config perl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ systemd lvm2 libaio readline liburcu json_c ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"LIB=lib"
|
|
|
|
"prefix=$(out)"
|
|
|
|
"man8dir=$(out)/share/man/man8"
|
|
|
|
"man5dir=$(out)/share/man/man5"
|
|
|
|
"man3dir=$(out)/share/man/man3"
|
|
|
|
"SYSTEMDPATH=lib"
|
|
|
|
];
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) iscsi-multipath-root; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tools for the Linux multipathing driver";
|
|
|
|
homepage = "http://christophe.varoqui.free.fr/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|