nixpkgs/pkgs/os-specific/linux/dpdk/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
2.8 KiB
Nix
Raw Normal View History

2019-11-10 00:46:26 +00:00
{ stdenv, lib
, kernel
, fetchurl
, pkg-config, meson, ninja, makeWrapper
, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap, rdma-core
, doxygen, python3, pciutils
, withExamples ? []
2019-11-10 00:46:26 +00:00
, shared ? false }:
let
mod = kernel != null;
2022-10-08 14:47:17 +00:00
dpdkVersion = "22.07";
in stdenv.mkDerivation rec {
2021-05-11 14:02:37 +00:00
pname = "dpdk";
version = "${dpdkVersion}" + lib.optionalString mod "-${kernel.version}";
src = fetchurl {
2021-05-11 14:02:37 +00:00
url = "https://fast.dpdk.org/rel/dpdk-${dpdkVersion}.tar.xz";
2022-10-08 14:47:17 +00:00
sha256 = "sha256-n2Tf3gdf21cIy2Leg4uP+4kVdf7R4dKusma6yj38m+o=";
};
2019-11-10 00:46:26 +00:00
nativeBuildInputs = [
makeWrapper
2019-11-10 00:46:26 +00:00
doxygen
meson
ninja
pkg-config
2019-11-10 00:46:26 +00:00
python3
python3.pkgs.sphinx
2021-05-11 14:02:37 +00:00
python3.pkgs.pyelftools
2019-11-10 00:46:26 +00:00
];
buildInputs = [
jansson
libbpf
libelf
libpcap
numactl
openssl.dev
zlib
2022-01-17 12:50:14 +00:00
python3
2019-11-10 00:46:26 +00:00
] ++ lib.optionals mod kernel.moduleBuildDependencies;
propagatedBuildInputs = [
# Propagated to support current DPDK users in nixpkgs which statically link
# with the framework (e.g. odp-dpdk).
rdma-core
# Requested by pkg-config.
libbsd
];
postPatch = ''
patchShebangs config/arm buildtools
'' + lib.optionalString mod ''
# kernel_install_dir is hardcoded to `/lib/modules`; patch that.
sed -i "s,kernel_install_dir *= *['\"].*,kernel_install_dir = '$kmod/lib/modules/${kernel.modDirVersion}'," kernel/linux/meson.build
'';
2019-11-10 00:46:26 +00:00
mesonFlags = [
2021-05-11 14:02:37 +00:00
"-Dtests=false"
2019-11-10 00:46:26 +00:00
"-Denable_docs=true"
"-Denable_kmods=${lib.boolToString mod}"
2019-11-10 00:46:26 +00:00
]
2021-05-11 14:02:37 +00:00
# kni kernel driver is currently not compatble with 5.11
++ lib.optional (mod && kernel.kernelOlder "5.11") "-Ddisable_drivers=kni"
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"
++ lib.optional stdenv.isAarch64 "-Dmachine=generic"
++ lib.optional mod "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
++ lib.optional (withExamples != []) "-Dexamples=${builtins.concatStringsSep "," withExamples}";
2019-12-23 08:49:35 +00:00
postInstall = ''
# Remove Sphinx cache files. Not only are they not useful, but they also
# contain store paths causing spurious dependencies.
rm -rf $out/share/doc/dpdk/html/.doctrees
wrapProgram $out/bin/dpdk-devbind.py \
--prefix PATH : "${lib.makeBinPath [ pciutils ]}"
'' + lib.optionalString (withExamples != []) ''
mkdir -p $examples/bin
find examples -type f -executable -exec install {} $examples/bin \;
'';
outputs =
[ "out" "doc" ]
++ lib.optional mod "kmod"
++ lib.optional (withExamples != []) "examples";
meta = with lib; {
description = "Set of libraries and drivers for fast packet processing";
homepage = "http://dpdk.org/";
license = with licenses; [ lgpl21 gpl2 bsd2 ];
2019-11-10 00:46:26 +00:00
platforms = platforms.linux;
maintainers = with maintainers; [ magenbluten orivej mic92 zhaofengli ];
broken = mod && kernel.isHardened;
};
}