2018-05-20 23:43:35 +01:00
|
|
|
{ stdenv, lib, kernel, fetchurl, pkgconfig, numactl }:
|
2016-04-20 16:11:34 +01:00
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
kver = kernel.modDirVersion or null;
|
|
|
|
|
|
|
|
mod = kernel != null;
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
|
2018-05-19 11:38:03 +01:00
|
|
|
version = "17.11.2";
|
2016-04-20 16:11:34 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-01-01 00:22:52 +00:00
|
|
|
url = "http://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
|
2018-05-19 11:38:03 +01:00
|
|
|
sha256 = "19m5l3jkrns8r1zbjb6ry18w50ff36kbl5b5g6pfcp9p57sfisd2";
|
2016-04-20 16:11:34 +01:00
|
|
|
};
|
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies;
|
2016-06-02 00:30:25 +01:00
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
RTE_KERNELDIR = if mod then "${kernel.dev}/lib/modules/${kver}/build" else "/var/empty";
|
2016-04-20 16:11:34 +01:00
|
|
|
RTE_TARGET = "x86_64-native-linuxapp-gcc";
|
|
|
|
|
2016-06-29 09:34:17 +01:00
|
|
|
# we need sse3 instructions to build
|
2018-05-19 11:38:03 +01:00
|
|
|
NIX_CFLAGS_COMPILE = [ "-msse3" ];
|
2016-05-31 13:35:54 +01:00
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
postPatch = lib.optionalString (!mod) ''
|
|
|
|
# Do not build kernel modules.
|
|
|
|
cat >>config/defconfig_$RTE_TARGET <<EOF
|
|
|
|
CONFIG_RTE_EAL_IGB_UIO=n
|
|
|
|
CONFIG_RTE_KNI_KMOD=n
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2016-06-29 09:34:17 +01:00
|
|
|
configurePhase = ''
|
2017-09-09 02:28:54 +01:00
|
|
|
make T=${RTE_TARGET} config
|
2016-04-20 16:11:34 +01:00
|
|
|
'';
|
|
|
|
|
2018-05-20 23:43:35 +01:00
|
|
|
installTargets = [ "install-runtime" "install-sdk" "install-kmod" ]; # skip install-doc
|
|
|
|
|
|
|
|
installFlags = [
|
2018-05-21 02:04:31 +01:00
|
|
|
"prefix=$(out)"
|
2018-05-20 23:43:35 +01:00
|
|
|
] ++ lib.optionals mod [
|
|
|
|
"kerneldir=$(kmod)/lib/modules/${kver}"
|
|
|
|
];
|
|
|
|
|
|
|
|
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";
|
|
|
|
homepage = http://dpdk.org/;
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd2 ];
|
2016-04-20 23:38:52 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2018-05-20 23:43:35 +01:00
|
|
|
maintainers = with maintainers; [ domenkozar orivej ];
|
2016-04-20 16:11:34 +01:00
|
|
|
};
|
|
|
|
}
|