2018-05-19 14:36:22 +02:00
|
|
|
{ stdenv, lib, fetchurl, pkgconfig
|
2019-08-07 07:05:03 +02:00
|
|
|
, dpdk, libpcap, lua5_3, numactl, utillinux
|
|
|
|
, gtk2, which, withGtk ? false
|
2016-06-29 10:34:17 +02:00
|
|
|
}:
|
2016-06-02 01:41:25 +02:00
|
|
|
|
2018-05-19 14:36:22 +02:00
|
|
|
let
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "pktgen";
|
2019-08-07 07:05:03 +02:00
|
|
|
version = "3.7.2";
|
2016-06-02 01:41:25 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-07 07:05:03 +02:00
|
|
|
url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/${pname}-${version}.tar.xz";
|
|
|
|
sha256 = "03k7h4j2lsrh6b7477hgn87ljrjh2673ncffx9v261bx1ns54y7w";
|
2016-06-02 01:41:25 +02:00
|
|
|
};
|
|
|
|
|
2019-08-07 07:05:03 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2016-06-29 10:34:17 +02:00
|
|
|
|
|
|
|
buildInputs =
|
2019-08-07 07:05:03 +02:00
|
|
|
[ dpdk libpcap lua5_3 numactl which ]
|
2016-09-11 23:24:51 +02:00
|
|
|
++ stdenv.lib.optionals withGtk [gtk2];
|
2016-06-02 01:41:25 +02:00
|
|
|
|
2018-05-21 03:04:31 +02:00
|
|
|
RTE_SDK = "${dpdk}/share/dpdk";
|
2016-06-02 01:41:25 +02:00
|
|
|
RTE_TARGET = "x86_64-native-linuxapp-gcc";
|
2016-06-29 10:34:17 +02:00
|
|
|
GUI = stdenv.lib.optionalString withGtk "true";
|
2016-06-02 01:41:25 +02:00
|
|
|
|
2018-05-19 14:36:22 +02:00
|
|
|
NIX_CFLAGS_COMPILE = [ "-msse3" ];
|
2016-06-03 19:57:40 +02:00
|
|
|
|
2018-05-19 14:36:22 +02:00
|
|
|
postPatch = let dpdkMajor = lib.versions.major dpdk.version; in ''
|
2017-01-02 00:37:59 +01:00
|
|
|
substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${utillinux}/bin/lscpu
|
|
|
|
'';
|
|
|
|
|
2016-06-02 01:41:25 +02:00
|
|
|
installPhase = ''
|
|
|
|
install -d $out/bin
|
2017-09-09 03:29:26 +02:00
|
|
|
install -m 0755 app/${RTE_TARGET}/pktgen $out/bin
|
2019-08-07 07:05:03 +02:00
|
|
|
install -m 0644 Pktgen.lua $out/bin
|
2016-06-02 01:41:25 +02:00
|
|
|
'';
|
|
|
|
|
2018-05-19 14:36:22 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-06-02 01:41:25 +02:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Traffic generator powered by DPDK";
|
|
|
|
homepage = http://dpdk.org/;
|
|
|
|
license = licenses.bsdOriginal;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = [ maintainers.abuibrahim ];
|
|
|
|
};
|
|
|
|
}
|