summary refs log tree commit diff
path: root/pkgs/os-specific/linux/multipath-tools/default.nix
blob: 14996fd76be53912d8ea717c8eed662e4b90205c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ stdenv, fetchurl, lvm2, libaio, gzip, readline, systemd, liburcu }:

stdenv.mkDerivation rec {
  name = "multipath-tools-${version}";
  version = "0.6.2";

  src = fetchurl {
    name = "${name}.tar.gz";
    url = "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=${version};sf=tgz";
    sha256 = "159hxvbk9kh1qay9x04w0gsqzg0hkl5yghfc1wi9kv2n5pcwbkpm";
  };

  postPatch = ''
    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
    sed -i -e "s,GZIP = .*, GZIP = gzip -9n -c," \
      Makefile.inc
  '';

  nativeBuildInputs = [ gzip ];
  buildInputs = [ systemd lvm2 libaio readline liburcu ];

  makeFlags = [
    "LIB=lib"
    "prefix=$(out)"
    "mandir=$(out)/share/man/man8"
    "man5dir=$(out)/share/man/man5"
    "man3dir=$(out)/share/man/man3"
    "unitdir=$(out)/lib/systemd/system"
  ];

  meta = with stdenv.lib; {
    description = "Tools for the Linux multipathing driver";
    homepage = http://christophe.varoqui.free.fr/;
    license = licenses.gpl2;
    platforms = platforms.linux;
  };
}