Merge pull request #73186 from flokli/bump-dpdk

dpdk: build with meson, odp-dpdk: -> 1.22.0.0
This commit is contained in:
Florian Klink
2019-11-24 17:14:49 +01:00
committed by GitHub
2 changed files with 69 additions and 53 deletions
+36 -34
View File
@@ -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 let
kver = kernel.modDirVersion or null; kver = kernel.modDirVersion or null;
mod = kernel != null; mod = kernel != null;
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
@@ -15,40 +19,38 @@ in stdenv.mkDerivation rec {
sha256 = "141bqqy4w6nzs9z70x7yv94a4gmxjfal46pxry9bwdh3zi1jwnyd"; sha256 = "141bqqy4w6nzs9z70x7yv94a4gmxjfal46pxry9bwdh3zi1jwnyd";
}; };
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [
buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies; doxygen
meson
RTE_KERNELDIR = if mod then "${kernel.dev}/lib/modules/${kver}/build" else "/var/empty"; ninja
RTE_TARGET = "x86_64-native-linuxapp-gcc"; pkgconfig
python3
# we need sse3 instructions to build python3.pkgs.sphinx
NIX_CFLAGS_COMPILE = [ "-msse3" ]; ];
hardeningDisable = [ "pic" ]; buildInputs = [
jansson
libbpf
libbsd
libelf
libpcap
numactl
openssl.dev
zlib
] ++ lib.optionals mod kernel.moduleBuildDependencies;
postPatch = '' postPatch = ''
cat >>config/defconfig_$RTE_TARGET <<EOF patchShebangs config/arm
# 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
''; '';
configurePhase = '' mesonFlags = [
make T=${RTE_TARGET} config "-Denable_docs=true"
''; "-Denable_kmods=${if kernel != null then "true" else "false"}"
]
installTargets = [ "install-runtime" "install-sdk" "install-kmod" ]; # skip install-doc ++ lib.optionals (shared == false) [
"-Ddefault_library=static"
installFlags = [ ]
"prefix=$(out)" ++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
] ++ lib.optionals mod [ ++ lib.optional (kernel != null) "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}";
"kerneldir=$(kmod)/lib/modules/${kver}"
];
outputs = [ "out" ] ++ lib.optional mod "kmod"; outputs = [ "out" ] ++ lib.optional mod "kmod";
@@ -58,7 +60,7 @@ EOF
description = "Set of libraries and drivers for fast packet processing"; description = "Set of libraries and drivers for fast packet processing";
homepage = http://dpdk.org/; homepage = http://dpdk.org/;
license = with licenses; [ lgpl21 gpl2 bsd2 ]; license = with licenses; [ lgpl21 gpl2 bsd2 ];
platforms = [ "x86_64-linux" ]; platforms = platforms.linux;
maintainers = with maintainers; [ domenkozar magenbluten orivej ]; maintainers = with maintainers; [ domenkozar magenbluten orivej ];
}; };
} }
+33 -19
View File
@@ -1,42 +1,56 @@
{ stdenv, fetchurl, autoreconfHook, pkgconfig { stdenv, fetchurl, autoreconfHook, pkgconfig
, dpdk, libconfig, libpcap, numactl, openssl , dpdk, libconfig, libpcap, numactl, openssl, zlib, libbsd, libelf, jansson
}: let }: let
dpdk_18_11 = dpdk.overrideAttrs (old: rec {
dpdk_17_11 = dpdk.overrideAttrs (old: rec { version = "18.11.5";
version = "17.11.9";
src = fetchurl { src = fetchurl {
url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz"; url = "https://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
sha256 = "0vrcc9mdjs5fk69lh7bigsk9208dfmjsz3jxaddkjlvk2hds1id6"; sha256 = "0000000000000000000000000000000000000000000000000000";
}; };
}); });
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "odp-dpdk"; pname = "odp-dpdk";
version = "1.19.0.0_DPDK_17.11"; version = "1.22.0.0_DPDK_18.11";
src = fetchurl { src = fetchurl {
url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz"; url = "https://git.linaro.org/lng/odp-dpdk.git/snapshot/${pname}-${version}.tar.gz";
sha256 = "05bwjaxl9hqc6fbkp95nniq11g3kvzmlxw0bq55i7p2v35nv38px"; sha256 = "1m8xhmfjqlj2gkkigq5ka3yh0xgzrcpfpaxp1pnh8d1g99094vbx";
}; };
nativeBuildInputs = [ autoreconfHook pkgconfig ]; nativeBuildInputs = [
buildInputs = [ dpdk_17_11 libconfig libpcap numactl openssl ]; autoreconfHook
pkgconfig
RTE_SDK = "${dpdk_17_11}/share/dpdk";
RTE_TARGET = "x86_64-native-linuxapp-gcc";
dontDisableStatic = true;
configureFlags = [
"--disable-shared"
"--with-dpdk-path=${dpdk_17_11}"
]; ];
buildInputs = [
dpdk_18_11
libconfig
libpcap
numactl
openssl
zlib
libbsd
libelf
jansson
];
# 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
'';
# binaries will segfault otherwise
dontStrip = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Open Data Plane optimized for DPDK"; description = "Open Data Plane optimized for DPDK";
homepage = https://www.opendataplane.org; homepage = https://www.opendataplane.org;
license = licenses.bsd3; license = licenses.bsd3;
platforms = [ "x86_64-linux" ]; platforms = platforms.linux;
maintainers = [ maintainers.abuibrahim ]; maintainers = [ maintainers.abuibrahim ];
}; };
} }