summary refs log tree commit diff
path: root/pkgs/os-specific/linux/dpdk
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-05-20 22:43:35 +0000
committerOrivej Desh <orivej@gmx.fr>2018-05-21 01:05:43 +0000
commit2287c5f6a55c3c4edf1d244c7dbf7b331aa94783 (patch)
tree4d385bd71fc9073de3fdd581d8b683fc03bf468a /pkgs/os-specific/linux/dpdk
parenta48088769f1c5f68b11bbd3a21b4b18b3e3d2765 (diff)
downloadnixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar.gz
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar.bz2
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar.lz
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar.xz
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.tar.zst
nixpkgs-2287c5f6a55c3c4edf1d244c7dbf7b331aa94783.zip
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.
Diffstat (limited to 'pkgs/os-specific/linux/dpdk')
-rw-r--r--pkgs/os-specific/linux/dpdk/default.nix50
1 files changed, 33 insertions, 17 deletions
diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix
index fd45e83c26b..808feaff02c 100644
--- a/pkgs/os-specific/linux/dpdk/default.nix
+++ b/pkgs/os-specific/linux/dpdk/default.nix
@@ -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
+
+  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 stdenv.lib; {
+  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 ];
   };
 }