dpdk: extract from linuxPackages.dpdk
DPDK kernel modules are optional and its libraries do not reference them. This allows to move the packages that depend on DPDK out of linuxPackages, since they do not depend on kernel version.
This commit is contained in:
parent
a48088769f
commit
2287c5f6a5
2 changed files with 37 additions and 17 deletions
|
@ -1,7 +1,13 @@
|
|||
{ stdenv, kernel, fetchurl, pkgconfig, numactl }:
|
||||
{ stdenv, lib, kernel, fetchurl, pkgconfig, numactl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "dpdk-${version}-${kernel.version}";
|
||||
let
|
||||
|
||||
kver = kernel.modDirVersion or null;
|
||||
|
||||
mod = kernel != null;
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "dpdk-${version}" + lib.optionalString mod "-${kernel.version}";
|
||||
version = "17.11.2";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -9,35 +15,45 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "19m5l3jkrns8r1zbjb6ry18w50ff36kbl5b5g6pfcp9p57sfisd2";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ] ++ kernel.moduleBuildDependencies;
|
||||
buildInputs = [ numactl ];
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ numactl ] ++ lib.optional mod kernel.moduleBuildDependencies;
|
||||
|
||||
RTE_KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
||||
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" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
outputs = [ "out" "kmod" ];
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
|
||||
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
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
make T=${RTE_TARGET} config
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
make install-runtime DESTDIR=$out prefix= includedir=/include datadir=/
|
||||
make install-sdk DESTDIR=$out prefix= includedir=/include datadir=/
|
||||
make install-kmod DESTDIR=$kmod
|
||||
'';
|
||||
installTargets = [ "install-runtime" "install-sdk" "install-kmod" ]; # skip install-doc
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
installFlags = [
|
||||
"prefix=$(out)" "datadir=$(out)" "includedir=$(out)/include"
|
||||
] ++ lib.optionals mod [
|
||||
"kerneldir=$(kmod)/lib/modules/${kver}"
|
||||
];
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional mod "kmod";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Set of libraries and drivers for fast packet processing";
|
||||
homepage = http://dpdk.org/;
|
||||
license = with licenses; [ lgpl21 gpl2 bsd2 ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = [ maintainers.domenkozar ];
|
||||
maintainers = with maintainers; [ domenkozar orivej ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13814,6 +13814,10 @@ with pkgs;
|
|||
|
||||
buildLinux = attrs: callPackage ../os-specific/linux/kernel/generic.nix attrs;
|
||||
|
||||
dpdk = callPackage ../os-specific/linux/dpdk {
|
||||
kernel = null; # dpdk modules are in linuxPackages.dpdk.kmod
|
||||
};
|
||||
|
||||
keyutils = callPackage ../os-specific/linux/keyutils { };
|
||||
|
||||
libselinux = callPackage ../os-specific/linux/libselinux { };
|
||||
|
|
Loading…
Reference in a new issue