linux-headers: Clean up with mass rebuild

This commit is contained in:
Daiderd Jordan 2018-01-26 23:40:40 +01:00 committed by John Ericson
parent ddebab3575
commit 7081b5e1ae
2 changed files with 10 additions and 24 deletions

View file

@ -133,9 +133,7 @@ stdenv.mkDerivation ({
depsBuildBuild = [ buildPackages.stdenv.cc ]; depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bison ]; nativeBuildInputs = [ bison ];
# TODO make linuxHeaders unconditional next mass rebuild buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ];
buildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) linuxHeaders
++ lib.optionals withGd [ gd libpng ];
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the stdenv-linux # prevent a retained dependency on the bootstrap tools in the stdenv-linux

View file

@ -4,7 +4,7 @@
}: }:
let let
common = { version, sha256, patches ? [] }: stdenvNoCC.mkDerivation ({ common = { version, sha256, patches ? [] }: stdenvNoCC.mkDerivation {
name = "linux-headers-${version}"; name = "linux-headers-${version}";
src = fetchurl { src = fetchurl {
@ -24,12 +24,11 @@ let
extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"]; extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"];
# "patches" array defaults to 'null' to avoid changing hash
# and causing mass rebuild
inherit patches; inherit patches;
# TODO avoid native hack next rebuild hardeningDisable = lib.optional stdenvNoCC.buildPlatform.isDarwin "format";
makeFlags = if stdenvNoCC.hostPlatform == stdenvNoCC.buildPlatform then null else [
makeFlags = [
"SHELL=bash" "SHELL=bash"
# Avoid use of runtime build->host compilers for checks. These # Avoid use of runtime build->host compilers for checks. These
# checks only cared to work around bugs in very old compilers, so # checks only cared to work around bugs in very old compilers, so
@ -41,11 +40,8 @@ let
"HOSTCXX:=$(BUILD_CXX)" "HOSTCXX:=$(BUILD_CXX)"
]; ];
# TODO avoid native hack next rebuild
# Skip clean on darwin, case-sensitivity issues. # Skip clean on darwin, case-sensitivity issues.
buildPhase = if stdenvNoCC.hostPlatform == stdenvNoCC.buildPlatform then '' buildPhase = lib.optionalString (!stdenvNoCC.buildPlatform.isDarwin) ''
make mrproper headers_check SHELL=bash
'' else lib.optionalString (!stdenvNoCC.buildPlatform.isDarwin) ''
make mrproper $makeFlags make mrproper $makeFlags
'' ''
# For some reason, doing `make install_headers` twice, first without # For some reason, doing `make install_headers` twice, first without
@ -55,17 +51,12 @@ let
make headers_install $makeFlags make headers_install $makeFlags
''; '';
# TODO avoid native hack next rebuild checkPhase = ''
checkPhase = if stdenvNoCC.hostPlatform == stdenvNoCC.buildPlatform then null else ''
make headers_check $makeFlags make headers_check $makeFlags
''; '';
# TODO avoid native hack next rebuild installPhase = ''
installPhase = (if stdenvNoCC.hostPlatform == stdenvNoCC.buildPlatform then ''
make INSTALL_HDR_PATH=$out headers_install
'' else ''
make headers_install INSTALL_HDR_PATH=$out $makeFlags make headers_install INSTALL_HDR_PATH=$out $makeFlags
'') + ''
# Some builds (e.g. KVM) want a kernel.release. # Some builds (e.g. KVM) want a kernel.release.
mkdir -p $out/include/config mkdir -p $out/include/config
@ -77,17 +68,14 @@ let
license = licenses.gpl2; license = licenses.gpl2;
platforms = platforms.linux; platforms = platforms.linux;
}; };
} // lib.optionalAttrs (stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform) { };
# TODO Make unconditional next mass rebuild
hardeningDisable = lib.optional stdenvNoCC.buildPlatform.isDarwin "format";
});
in { in {
linuxHeaders = common { linuxHeaders = common {
version = "4.18.3"; version = "4.18.3";
sha256 = "1m23hjd02bg8mqnd8dc4z4m3kxds1cyrc6j5saiwnhzbz373rvc1"; sha256 = "1m23hjd02bg8mqnd8dc4z4m3kxds1cyrc6j5saiwnhzbz373rvc1";
# TODO make unconditional next mass rebuild # TODO make unconditional next mass rebuild
patches = lib.optionals (stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform) [ patches = [
./no-relocs.patch # for building x86 kernel headers on non-ELF platforms ./no-relocs.patch # for building x86 kernel headers on non-ELF platforms
./no-dynamic-cc-version-check.patch # so we can use `stdenvNoCC`, see `makeFlags` above ./no-dynamic-cc-version-check.patch # so we can use `stdenvNoCC`, see `makeFlags` above
]; ];