From fe9d6cb8a72f8c8687749b8944662822a9afc143 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 10 Nov 2019 01:46:26 +0100 Subject: [PATCH 1/2] dpdk: build with meson --- pkgs/os-specific/linux/dpdk/default.nix | 70 +++++++++++++------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix index 7525fc8e405b..104fccd6955b 100644 --- a/pkgs/os-specific/linux/dpdk/default.nix +++ b/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 { @@ -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 <>config/defconfig_$RTE_TARGET < Date: Sun, 10 Nov 2019 02:06:11 +0100 Subject: [PATCH 2/2] odp-dpdk: 1.19.0.0_DPDK_17.11 -> 1.22.0.0_DPDK_18.11 Build with dpdk 18.11.5 instead of 17.11.9 --- pkgs/os-specific/linux/odp-dpdk/default.nix | 52 +++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/pkgs/os-specific/linux/odp-dpdk/default.nix b/pkgs/os-specific/linux/odp-dpdk/default.nix index 789668cb89e5..0bdc22da918d 100644 --- a/pkgs/os-specific/linux/odp-dpdk/default.nix +++ b/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"; - - dontDisableStatic = true; - - configureFlags = [ - "--disable-shared" - "--with-dpdk-path=${dpdk_17_11}" + nativeBuildInputs = [ + autoreconfHook + pkgconfig ]; + 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; { 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 ]; }; }