dpdk: fixup shared compilation

Dpdk build will default to static linking of its libraries if
`default_library` option is not specified. When shared is expected, we
should explicitely set the `default_library` option to `shared`.

This saves 586MB on the derivation output size:
```
95M	/nix/store/qydxxmcnh1w8yz58n36345kg3siimqip-dpdk-22.11.1
681M	/nix/store/pxvc5r3jvba1i96cma36akr7cnvnac3w-dpdk-22.11.1
```
This commit is contained in:
Arthur Gautier 2023-10-05 12:33:18 -07:00 committed by Jörg Thalheim
parent e4507e79b9
commit 256c518a8a

View File

@ -68,7 +68,7 @@ in stdenv.mkDerivation rec {
]
# kni kernel driver is currently not compatble with 5.11
++ lib.optional (mod && kernel.kernelOlder "5.11") "-Ddisable_drivers=kni"
++ lib.optional (!shared) "-Ddefault_library=static"
++ [(if shared then "-Ddefault_library=shared" else "-Ddefault_library=static")]
++ lib.optional (machine != null) "-Dmachine=${machine}"
++ lib.optional mod "-Dkernel_dir=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
++ lib.optional (withExamples != []) "-Dexamples=${builtins.concatStringsSep "," withExamples}";