diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/pktgen')
-rw-r--r-- | nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch | 17 | ||||
-rw-r--r-- | nixpkgs/pkgs/os-specific/linux/pktgen/default.nix | 55 |
2 files changed, 35 insertions, 37 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch b/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch new file mode 100644 index 000000000000..b4933313a51a --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/pktgen/configure.patch @@ -0,0 +1,17 @@ +1. librte_process_info does not exist. +2. lua5.3 library is liblua. +3. app/meson.build uses undeclared drivers_install_subdir. +--- a/lib/common/meson.build ++++ b/lib/common/meson.build +@@ -34,1 +34,1 @@ +-libs = ['eal', 'kvargs', 'cmdline', 'process_info'] ++libs = ['eal', 'kvargs', 'cmdline'] +--- a/lib/lua/meson.build ++++ b/lib/lua/meson.build +@@ -31 +31 @@ endforeach +-ext_deps += cc.find_library('lua5.3', required: true) ++ext_deps += cc.find_library('lua', required: true) +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -0,0 +1,1 @@ ++option('drivers_install_subdir', type: 'string', value: '') diff --git a/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix b/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix index 0d92c7c69098..3312f2302472 100644 --- a/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix +++ b/nixpkgs/pkgs/os-specific/linux/pktgen/default.nix @@ -1,59 +1,40 @@ -{ stdenv, lib, fetchurl, pkgconfig -, dpdk, libpcap, numactl, utillinux -, gtk2, withGtk ? false +{ stdenv, lib, fetchurl, meson, ninja, pkgconfig +, dpdk, libbsd, libpcap, lua5_3, numactl, utillinux +, gtk2, which, withGtk ? false }: -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 { +stdenv.mkDerivation rec { pname = "pktgen"; - version = "3.5.0"; + version = "19.12.0"; src = fetchurl { - url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-${version}.tar.xz"; - sha256 = "1gy99jr9dbwzi9pd3w5k673h3pfnbkz6rbzmrkwcyis72pnphy5z"; + url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/${pname}-${version}.tar.xz"; + sha256 = "1clfviz1qa4hysslcg6i29vsxwl9f6j1y7zf9wwx9br3yq08x956"; }; - nativeBuildInputs = stdenv.lib.optionals withGtk [ pkgconfig ]; + nativeBuildInputs = [ meson ninja pkgconfig ]; buildInputs = - [ dpdk libpcap numactl ] + [ dpdk libbsd libpcap lua5_3 numactl which ] ++ stdenv.lib.optionals withGtk [gtk2]; - RTE_SDK = "${dpdk}/share/dpdk"; - RTE_TARGET = "x86_64-native-linuxapp-gcc"; + RTE_SDK = dpdk; GUI = stdenv.lib.optionalString withGtk "true"; - NIX_CFLAGS_COMPILE = [ "-msse3" ]; + NIX_CFLAGS_COMPILE = "-msse3"; - 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 + patches = [ ./configure.patch ]; - 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 + postPatch = '' + substituteInPlace lib/common/lscpu.h --replace /usr/bin/lscpu ${utillinux}/bin/lscpu ''; - installPhase = '' - install -d $out/bin - install -m 0755 app/${RTE_TARGET}/pktgen $out/bin - install -d $out/lib/lua/5.3 - install -m 0644 Pktgen.lua $out/lib/lua/5.3 + postInstall = '' + # meson installs unneeded files with conflicting generic names, such as + # include/cli.h and lib/liblua.so. + rm -rf $out/include $out/lib ''; - enableParallelBuilding = true; - meta = with stdenv.lib; { description = "Traffic generator powered by DPDK"; homepage = http://dpdk.org/; |