@@ -1,9 +1,13 @@
1−{ stdenv, lib, kernel, fetchurl, pkgconfig, numactl, shared ? false }:
1+{ stdenv, lib
2+, kernel
3+, fetchurl
4+, pkgconfig, meson, ninja
5+, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap
6+, doxygen, python3
7+, shared ? false }:
28
39let
4−
510 kver = kernel.modDirVersion or null;
6−
711 mod = kernel != null;
812
913in stdenv.mkDerivation rec {
@@ -15,40 +19,38 @@ in stdenv.mkDerivation rec {
1519 sha256 = "141bqqy4w6nzs9z70x7yv94a4gmxjfal46pxry9bwdh3zi1jwnyd";
1620 };
1721
18− nativeBuildInputs = [ pkgconfig ];
19− buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies;
20−
21− RTE_KERNELDIR = if mod then "${kernel.dev}/lib/modules/${kver}/build" else "/var/empty";
22− RTE_TARGET = "x86_64-native-linuxapp-gcc";
23−
24− # we need sse3 instructions to build
25− NIX_CFLAGS_COMPILE = [ "-msse3" ];
26− hardeningDisable = [ "pic" ];
22+ nativeBuildInputs = [
23+ doxygen
24+ meson
25+ ninja
26+ pkgconfig
27+ python3
28+ python3.pkgs.sphinx
29+ ];
30+ buildInputs = [
31+ jansson
32+ libbpf
33+ libbsd
34+ libelf
35+ libpcap
36+ numactl
37+ openssl.dev
38+ zlib
39+ ] ++ lib.optionals mod kernel.moduleBuildDependencies;
2740
2841 postPatch = ''
29− cat >>config/defconfig_$RTE_TARGET <<EOF
30−# Build static or shared libraries.
31−CONFIG_RTE_BUILD_SHARED_LIB=${if shared then "y" else "n"}
32−EOF
33− '' + lib.optionalString (!mod) ''
34− cat >>config/defconfig_$RTE_TARGET <<EOF
35−# Do not build kernel modules.
36−CONFIG_RTE_EAL_IGB_UIO=n
37−CONFIG_RTE_KNI_KMOD=n
38−EOF
42+ patchShebangs config/arm
3943 '';
4044
41− configurePhase = ''
42− make T=${RTE_TARGET} config
43− '';
44−
45− installTargets = [ "install-runtime" "install-sdk" "install-kmod" ]; # skip install-doc
46−
47− installFlags = [
48− "prefix=$(out)"
49− ] ++ lib.optionals mod [
50− "kerneldir=$(kmod)/lib/modules/${kver}"
51− ];
45+ mesonFlags = [
46+ "-Denable_docs=true"
47+ "-Denable_kmods=${if kernel != null then "true" else "false"}"
48+ ]
49+ ++ lib.optionals (shared == false) [
50+ "-Ddefault_library=static"
51+ ]
52+ ++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
53+ ++ lib.optional (kernel != null) "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}";
5254
5355 outputs = [ "out" ] ++ lib.optional mod "kmod";
5456
@@ -58,7 +60,7 @@ EOF
5860 description = "Set of libraries and drivers for fast packet processing";
5961 homepage = http://dpdk.org/;
6062 license = with licenses; [ lgpl21 gpl2 bsd2 ];
61− platforms = [ "x86_64-linux" ];
63+ platforms = platforms.linux;
6264 maintainers = with maintainers; [ domenkozar magenbluten orivej ];
6365 };
6466}