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