1{ fetchurl, stdenv, lib, flex, bash, bison, db, iptables, pkgconfig }:
2
3stdenv.mkDerivation rec {
4 name = "iproute2-${version}";
5 version = "4.15.0";
6
7 src = fetchurl {
8 url = "mirror://kernel/linux/utils/net/iproute2/${name}.tar.xz";
9 sha256 = "0mc3g4kj7h3jhwz2b2gdf41gp6bhqn7axh4mnyvhkdnpk5m63m28";
10 };
11
12 preConfigure = ''
13 patchShebangs ./configure
14 sed -e '/ARPDDIR/d' -i Makefile
15 # Don't build netem tools--they're not installed and require HOSTCC
16 substituteInPlace Makefile --replace " netem " " "
17 '';
18
19 makeFlags = [
20 "DESTDIR="
21 "LIBDIR=$(out)/lib"
22 "SBINDIR=$(out)/sbin"
23 "MANDIR=$(out)/share/man"
24 "BASH_COMPDIR=$(out)/share/bash-completion/completions"
25 "DOCDIR=$(TMPDIR)/share/doc/${name}" # Don't install docs
26 "HDRDIR=$(TMPDIR)/include/iproute2" # Don't install headers
27 ];
28
29 buildFlags = [
30 "CONFDIR=/etc/iproute2"
31 ];
32
33 installFlags = [
34 "CONFDIR=$(out)/etc/iproute2"
35 ];
36
37 buildInputs = [ db iptables ];
38 nativeBuildInputs = [ bison flex pkgconfig ];
39
40 enableParallelBuilding = true;
41
42 postInstall = ''
43 PATH=${bash}/bin:$PATH patchShebangs $out/sbin
44 '';
45
46 meta = with stdenv.lib; {
47 homepage = https://wiki.linuxfoundation.org/networking/iproute2;
48 description = "A collection of utilities for controlling TCP/IP networking and traffic control in Linux";
49 platforms = platforms.linux;
50 license = licenses.gpl2;
51 maintainers = with maintainers; [ eelco wkennington fpletz ];
52 };
53}