forked from mirrors/nixpkgs
893186f4fd
Extracting headers from a grsecurity patched kernel triggers additional build steps that require gcc plugins. For this to work, we'd need to add gmp, libmpfr, and libmpc to the build inputs as well as run `make prepare` before installing the headers (lest the build fail due to missing files). Out-of-tree modules use kernel.dev and user space should use the Linux API headers used to build libc, not headers extracted from random kernels, so fixing this for grsecurity is pointless.
30 lines
739 B
Nix
30 lines
739 B
Nix
{ stdenv, kernel, perl }:
|
|
|
|
assert (!(kernel.features.grsecurity or false));
|
|
|
|
let
|
|
baseBuildFlags = [ "INSTALL_HDR_PATH=$(out)" "headers_install" ];
|
|
in stdenv.mkDerivation {
|
|
name = "linux-headers-${kernel.version}";
|
|
|
|
inherit (kernel) src patches;
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
buildFlags = [ "ARCH=${stdenv.platform.kernelArch}" ] ++ baseBuildFlags;
|
|
|
|
crossAttrs = {
|
|
inherit (kernel.crossDrv) src patches;
|
|
buildFlags = [ "ARCH=${stdenv.cross.platform.kernelArch}" ] ++ baseBuildFlags;
|
|
};
|
|
|
|
installPhase = ''
|
|
find $out \( -name ..install.cmd -o -name .install \) -print0 | xargs -0 rm
|
|
'';
|
|
|
|
# Headers shouldn't reference anything else
|
|
allowedReferences = [];
|
|
|
|
meta.platforms = stdenv.lib.platforms.linux;
|
|
}
|