linuxPackages.pktgen: 3.4.0 -> 3.5.0

This commit is contained in:
Orivej Desh 2018-05-19 12:36:22 +00:00
parent 52ad7f7390
commit d307113708
2 changed files with 28 additions and 46 deletions

View file

@ -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)

View file

@ -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/;