2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib
|
|
|
|
, kernel
|
|
|
|
, fetchurl
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config, meson, ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap
|
|
|
|
, doxygen, python3
|
|
|
|
, shared ? false }:
|
|
|
|
|
|
|
|
let
|
|
|
|
mod = kernel != null;
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
|
2020-07-18 16:06:22 +00:00
|
|
|
version = "20.05";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
|
2020-07-18 16:06:22 +00:00
|
|
|
sha256 = "0h0xv2zwb91b9n29afg5ihn06a8q28in64hag2f112kc19f79jj8";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
doxygen
|
|
|
|
meson
|
|
|
|
ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
python3
|
|
|
|
python3.pkgs.sphinx
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
jansson
|
|
|
|
libbpf
|
|
|
|
libbsd
|
|
|
|
libelf
|
|
|
|
libpcap
|
|
|
|
numactl
|
|
|
|
openssl.dev
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals mod kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
postPatch = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
patchShebangs config/arm buildtools
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Denable_docs=true"
|
2020-10-27 00:29:36 +00:00
|
|
|
"-Denable_kmods=${lib.boolToString mod}"
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ lib.optional (!shared) "-Ddefault_library=static"
|
|
|
|
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
|
|
|
|
++ 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
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" ] ++ lib.optional mod "kmod";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Set of libraries and drivers for fast packet processing";
|
|
|
|
homepage = "http://dpdk.org/";
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd2 ];
|
|
|
|
platforms = platforms.linux;
|
2021-03-09 03:18:52 +00:00
|
|
|
maintainers = with maintainers; [ magenbluten orivej ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|