1{ stdenv, fetchurl, pkgconfig, libnl, popt, gnugrep }:
2
3stdenv.mkDerivation rec {
4 name = "ipvsadm-${version}";
5 version = "1.29";
6
7 src = fetchurl {
8 url = "mirror://kernel/linux/utils/kernel/ipvsadm/${name}.tar.xz";
9 sha256 = "c3de4a21d90a02c621f0c72ee36a7aa27374b6f29fd4178f33fbf71b4c66c149";
10 };
11
12 postPatch = ''
13 substituteInPlace Makefile --replace "-lnl" "$(pkg-config --libs libnl-genl-3.0)"
14 '';
15
16 nativeBuildInputs = [ pkgconfig ];
17 buildInputs = [ libnl popt ];
18
19 preBuild = ''
20 makeFlagsArray+=(
21 INCLUDE=$(pkg-config --cflags libnl-genl-3.0)
22 BUILD_ROOT=$out
23 MANDIR=share/man
24 )
25 '';
26
27 postInstall = ''
28 sed -i -e "s|^PATH=.*|PATH=$out/bin:${gnugrep}/bin|" $out/sbin/ipvsadm-{restore,save}
29 '';
30
31 meta = with stdenv.lib; {
32 description = "Linux Virtual Server support programs";
33 homepage = http://www.linuxvirtualserver.org/software/ipvs.html;
34 license = licenses.gpl2;
35 platforms = platforms.linux;
36 };
37}