summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pktgen
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-05-19 12:36:22 +0000
committerOrivej Desh <orivej@gmx.fr>2018-05-19 14:07:32 +0000
commitd3071137085a3440970a1659e15cc8fc9a675f4c (patch)
tree22227da9a01dda82e90823d5a0108d2838de4c88 /pkgs/os-specific/linux/pktgen
parent52ad7f739095b18fc2da051c09fd1cb0b7d344a5 (diff)
downloadnixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar.gz
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar.bz2
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar.lz
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar.xz
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.tar.zst
nixpkgs-d3071137085a3440970a1659e15cc8fc9a675f4c.zip
linuxPackages.pktgen: 3.4.0 -> 3.5.0
Diffstat (limited to 'pkgs/os-specific/linux/pktgen')
-rw-r--r--pkgs/os-specific/linux/pktgen/Makefile.patch34
-rw-r--r--pkgs/os-specific/linux/pktgen/default.nix40
2 files changed, 28 insertions, 46 deletions
diff --git a/pkgs/os-specific/linux/pktgen/Makefile.patch b/pkgs/os-specific/linux/pktgen/Makefile.patch
deleted file mode 100644
index da948bcc5a0..00000000000
--- a/pkgs/os-specific/linux/pktgen/Makefile.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git a/app/Makefile b/app/Makefile
-index 5078b9a..99b208a 100644
---- a/app/Makefile
-+++ b/app/Makefile
-@@ -46,29 +46,10 @@ APP = pktgen
- CFLAGS += -O3 -g $(WERROR_FLAGS) -fno-stack-protector
- CFLAGS += -I$(RTE_SRCDIR) -I$(RTE_SRCDIR)/../lib/common
- 
--dpdk_ver := $(RTE_SDK)/xusertools/dpdk-version.sh
--pktgen_ver := $(RTE_SRCDIR)/../tools/dpdk-version.sh
--ver_cmd := $(if $(wildcard $(dpdk_ver)),$(dpdk_ver),$(pktgen_ver))
--# $(info ver_cmd=$(ver_cmd))
--
--yy := $(shell $(ver_cmd) -yy)
--# mm := $(shell $(ver_cmd) -mm)
--
--# $(info yy=$(yy))
--
--ifeq ($(yy),17)
- COMMON_PRE := $(RTE_SRCDIR)/../lib/common
- LUA_PRE := $(RTE_SRCDIR)/../lib/lua/src
- CLI_PRE := $(RTE_SRCDIR)/../lib/cli
- GUI_PRE := $(RTE_SRCDIR)/../gui/gui
--else
--ifeq ($(yy),16)
--COMMON_PRE := $(RTE_SRCDIR)/../lib/common/lib/common
--LUA_PRE := $(RTE_SRCDIR)/../lib/lua/src/lib/lua/src
--CLI_PRE := $(RTE_SRCDIR)/../lib/cli/lib/cli
--GUI_PRE := $(RTE_SRCDIR)/../gui
--endif
--endif
- 
- COMMON_LIB := $(COMMON_PRE)/$(RTE_TARGET)
- LUA_LIB    := $(LUA_PRE)/$(RTE_TARGET)
diff --git a/pkgs/os-specific/linux/pktgen/default.nix b/pkgs/os-specific/linux/pktgen/default.nix
index 9bc8967453b..c443da7df3b 100644
--- a/pkgs/os-specific/linux/pktgen/default.nix
+++ b/pkgs/os-specific/linux/pktgen/default.nix
@@ -1,34 +1,48 @@
-{ stdenv, fetchurl, dpdk, libpcap, utillinux
-, pkgconfig
+{ stdenv, lib, fetchurl, pkgconfig
+, dpdk, libpcap, numactl, utillinux
 , gtk2, withGtk ? false
 }:
 
-stdenv.mkDerivation rec {
+let
+
+  # pktgen needs a specific version of lua to apply its patch (see lib/lua/Makefile).
+  lua = rec {
+    name = "lua-5.3.4";
+    basename = name + ".tar.gz";
+    src = fetchurl {
+      url = "https://www.lua.org/ftp/${basename}";
+      sha256 = "0320a8dg3aci4hxla380dx1ifkw8gj4gbw5c4dz41g1kh98sm0gn";
+    };
+  };
+
+in stdenv.mkDerivation rec {
   name = "pktgen-${version}";
-  version = "3.4.0";
+  version = "3.5.0";
 
   src = fetchurl {
-    url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-${version}.tar.gz";
-    sha256 = "0fcyb56d4mkvchi5i8s3m210f5c3xa8zbjb08ranpa1a2k1kzfg5";
+    url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-${version}.tar.xz";
+    sha256 = "1gy99jr9dbwzi9pd3w5k673h3pfnbkz6rbzmrkwcyis72pnphy5z";
   };
 
   nativeBuildInputs = stdenv.lib.optionals withGtk [ pkgconfig ];
 
   buildInputs =
-    [ dpdk libpcap ]
+    [ dpdk libpcap numactl ]
     ++ stdenv.lib.optionals withGtk [gtk2];
 
   RTE_SDK = "${dpdk}";
   RTE_TARGET = "x86_64-native-linuxapp-gcc";
   GUI = stdenv.lib.optionalString withGtk "true";
 
-  NIX_CFLAGS_COMPILE = [ "-march=core2" ];
+  NIX_CFLAGS_COMPILE = [ "-msse3" ];
 
-  patches = [ ./Makefile.patch ];
-
-  postPatch = ''
-    substituteInPlace lib/lua/src/luaconf.h --replace /usr/local $out
+  postPatch = let dpdkMajor = lib.versions.major dpdk.version; in ''
+    substituteInPlace app/Makefile --replace 'yy :=' 'yy := ${dpdkMajor} #'
     substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${utillinux}/bin/lscpu
+
+    ln -s ${lua.src} lib/lua/${lua.basename}
+    make -C lib/lua get_tarball # unpack and patch
+    substituteInPlace lib/lua/${lua.name}/src/luaconf.h --replace /usr/local $out
   '';
 
   installPhase = ''
@@ -38,6 +52,8 @@ stdenv.mkDerivation rec {
     install -m 0644 Pktgen.lua $out/lib/lua/5.3
   '';
 
+  enableParallelBuilding = true;
+
   meta = with stdenv.lib; {
     description = "Traffic generator powered by DPDK";
     homepage = http://dpdk.org/;