Skip to content

Commit

Permalink
Merge pull request #73186 from flokli/bump-dpdk
Browse files Browse the repository at this point in the history
dpdk: build with meson, odp-dpdk: -> 1.22.0.0
  • Loading branch information
flokli committed Nov 24, 2019
2 parents 5682fe1 + 8f97966 commit 1ced142
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 52 deletions.
70 changes: 36 additions & 34 deletions pkgs/os-specific/linux/dpdk/default.nix
@@ -1,9 +1,13 @@
{ stdenv, lib, kernel, fetchurl, pkgconfig, numactl, shared ? false }:
{ stdenv, lib
, kernel
, fetchurl
, pkgconfig, meson, ninja
, libbsd, numactl, libbpf, zlib, libelf, jansson, openssl, libpcap
, doxygen, python3
, shared ? false }:

let

kver = kernel.modDirVersion or null;

mod = kernel != null;

in stdenv.mkDerivation rec {
Expand All @@ -15,40 +19,38 @@ in stdenv.mkDerivation rec {
sha256 = "141bqqy4w6nzs9z70x7yv94a4gmxjfal46pxry9bwdh3zi1jwnyd";
};

nativeBuildInputs = [ pkgconfig ];
buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies;

RTE_KERNELDIR = if mod then "${kernel.dev}/lib/modules/${kver}/build" else "/var/empty";
RTE_TARGET = "x86_64-native-linuxapp-gcc";

# we need sse3 instructions to build
NIX_CFLAGS_COMPILE = [ "-msse3" ];
hardeningDisable = [ "pic" ];
nativeBuildInputs = [
doxygen
meson
ninja
pkgconfig
python3
python3.pkgs.sphinx
];
buildInputs = [
jansson
libbpf
libbsd
libelf
libpcap
numactl
openssl.dev
zlib
] ++ lib.optionals mod kernel.moduleBuildDependencies;

postPatch = ''
cat >>config/defconfig_$RTE_TARGET <<EOF
# Build static or shared libraries.
CONFIG_RTE_BUILD_SHARED_LIB=${if shared then "y" else "n"}
EOF
'' + lib.optionalString (!mod) ''
cat >>config/defconfig_$RTE_TARGET <<EOF
# Do not build kernel modules.
CONFIG_RTE_EAL_IGB_UIO=n
CONFIG_RTE_KNI_KMOD=n
EOF
patchShebangs config/arm
'';

configurePhase = ''
make T=${RTE_TARGET} config
'';

installTargets = [ "install-runtime" "install-sdk" "install-kmod" ]; # skip install-doc

installFlags = [
"prefix=$(out)"
] ++ lib.optionals mod [
"kerneldir=$(kmod)/lib/modules/${kver}"
];
mesonFlags = [
"-Denable_docs=true"
"-Denable_kmods=${if kernel != null then "true" else "false"}"
]
++ lib.optionals (shared == false) [
"-Ddefault_library=static"
]
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
++ lib.optional (kernel != null) "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}";

outputs = [ "out" ] ++ lib.optional mod "kmod";

Expand All @@ -58,7 +60,7 @@ EOF
description = "Set of libraries and drivers for fast packet processing";
homepage = http://dpdk.org/;
license = with licenses; [ lgpl21 gpl2 bsd2 ];
platforms = [ "x86_64-linux" ];
platforms = platforms.linux;
maintainers = with maintainers; [ domenkozar magenbluten orivej ];
};
}
50 changes: 32 additions & 18 deletions pkgs/os-specific/linux/odp-dpdk/default.nix
@@ -1,42 +1,56 @@
{ stdenv, fetchurl, autoreconfHook, pkgconfig
, dpdk, libconfig, libpcap, numactl, openssl
, dpdk, libconfig, libpcap, numactl, openssl, zlib, libbsd, libelf, jansson
}: let

dpdk_17_11 = dpdk.overrideAttrs (old: rec {
version = "17.11.9";
dpdk_18_11 = dpdk.overrideAttrs (old: rec {
version = "18.11.5";
src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
sha256 = "0vrcc9mdjs5fk69lh7bigsk9208dfmjsz3jxaddkjlvk2hds1id6";
sha256 = "0000000000000000000000000000000000000000000000000000";
};
});

in stdenv.mkDerivation rec {
pname = "odp-dpdk";
version = "1.19.0.0_DPDK_17.11";
version = "1.22.0.0_DPDK_18.11";

src = fetchurl {
url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz";
sha256 = "05bwjaxl9hqc6fbkp95nniq11g3kvzmlxw0bq55i7p2v35nv38px";
sha256 = "1m8xhmfjqlj2gkkigq5ka3yh0xgzrcpfpaxp1pnh8d1g99094vbx";
};

nativeBuildInputs = [ autoreconfHook pkgconfig ];
buildInputs = [ dpdk_17_11 libconfig libpcap numactl openssl ];

RTE_SDK = "${dpdk_17_11}/share/dpdk";
RTE_TARGET = "x86_64-native-linuxapp-gcc";
nativeBuildInputs = [
autoreconfHook
pkgconfig
];
buildInputs = [
dpdk_18_11
libconfig
libpcap
numactl
openssl
zlib
libbsd
libelf
jansson
];

dontDisableStatic = true;
# for some reason, /build/odp-dpdk-1.22.0.0_DPDK_18.11/lib/.libs ends up in all binaries,
# while it should be $out/lib instead.
# prepend rpath with the proper location, the /build will get removed during rpath shrinking
preFixup = ''
for prog in $out/bin/*; do
patchelf --set-rpath $out/lib:`patchelf --print-rpath $prog` $prog
done
'';

configureFlags = [
"--disable-shared"
"--with-dpdk-path=${dpdk_17_11}"
];
# binaries will segfault otherwise
dontStrip = true;

meta = with stdenv.lib; {
description = "Open Data Plane optimized for DPDK";
homepage = https://www.opendataplane.org;
license = licenses.bsd3;
platforms = [ "x86_64-linux" ];
platforms = platforms.linux;
maintainers = [ maintainers.abuibrahim ];
};
}

0 comments on commit 1ced142

Please sign in to comment.