2019-11-10 00:46:26 +00:00
|
|
|
{ stdenv, lib
|
|
|
|
, kernel
|
|
|
|
, fetchurl
|
|
|
|
, pkgconfig, meson, ninja
|
|
|
|
, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap
|
|
|
|
, doxygen, python3
|
|
|
|
, shared ? false }:
|
2016-04-20 16:11:34 +01:00
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
let
|
|
|
|
mod = kernel != null;
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
|
2020-06-30 11:40:58 +01:00
|
|
|
version = "20.05";
|
2016-04-20 16:11:34 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
|
2020-06-30 11:40:58 +01:00
|
|
|
sha256 = "0h0xv2zwb91b9n29afg5ihn06a8q28in64hag2f112kc19f79jj8";
|
2016-04-20 16:11:34 +01:00
|
|
|
};
|
|
|
|
|
2019-11-10 00:46:26 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
doxygen
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkgconfig
|
|
|
|
python3
|
|
|
|
python3.pkgs.sphinx
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
jansson
|
|
|
|
libbpf
|
|
|
|
libbsd
|
|
|
|
libelf
|
|
|
|
libpcap
|
|
|
|
numactl
|
|
|
|
openssl.dev
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals mod kernel.moduleBuildDependencies;
|
2016-05-31 13:35:54 +01:00
|
|
|
|
2018-05-21 03:32:18 +01:00
|
|
|
postPatch = ''
|
2020-06-30 11:40:58 +01:00
|
|
|
patchShebangs config/arm buildtools
|
2018-05-20 23:43:35 +01:00
|
|
|
'';
|
|
|
|
|
2019-11-10 00:46:26 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Denable_docs=true"
|
2019-12-23 08:49:35 +00:00
|
|
|
"-Denable_kmods=${if mod then "true" else "false"}"
|
2019-11-10 00:46:26 +00:00
|
|
|
]
|
2019-12-23 08:49:35 +00:00
|
|
|
++ lib.optional (!shared) "-Ddefault_library=static"
|
2019-11-10 00:46:26 +00:00
|
|
|
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
|
2019-12-23 08:49:35 +00:00
|
|
|
++ lib.optional mod "-Dkernel_dir=${placeholder "kmod"}/lib/modules/${kernel.modDirVersion}";
|
|
|
|
|
|
|
|
# dpdk meson script does not support separate kernel source and installion
|
|
|
|
# dirs (except via destdir), so we temporarily link the former into the latter.
|
|
|
|
preConfigure = lib.optionalString mod ''
|
|
|
|
mkdir -p $kmod/lib/modules/${kernel.modDirVersion}
|
|
|
|
ln -sf ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build \
|
|
|
|
$kmod/lib/modules/${kernel.modDirVersion}
|
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = lib.optionalString mod ''
|
|
|
|
rm -f $kmod/lib/modules/${kernel.modDirVersion}/build
|
|
|
|
'';
|
2018-05-20 23:43:35 +01:00
|
|
|
|
|
|
|
outputs = [ "out" ] ++ lib.optional mod "kmod";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2016-04-20 16:11:34 +01:00
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
meta = with lib; {
|
2016-04-20 16:11:34 +01:00
|
|
|
description = "Set of libraries and drivers for fast packet processing";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://dpdk.org/";
|
2016-04-20 16:11:34 +01:00
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd2 ];
|
2019-11-10 00:46:26 +00:00
|
|
|
platforms = platforms.linux;
|
2019-08-01 10:07:50 +01:00
|
|
|
maintainers = with maintainers; [ domenkozar magenbluten orivej ];
|
2016-04-20 16:11:34 +01:00
|
|
|
};
|
|
|
|
}
|