From b2c7a5a271269175bbcb2907ca821139a7ee465f Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Wed, 5 Sep 2018 18:33:56 +0000 Subject: [PATCH 01/10] bintools-wrapper, cc-wrapper, stdenv: infer propagateDoc automatically 02c09e01712ce0b61e5c8f7159047699a434f7fc (NixOS/nixpkgs#44558) was reverted in c981787db951afb11c1328461df82d4277ebec07 but, as it turns out, it fixed an issue I didn't know about at the time: the values of `propagateDoc` options were (and now again are) inconsistent with the underlying things those wrappers wrap (see NixOS/nixpkgs#46119), which was (and now is) likely to produce more instances of NixOS/nixpkgs#43547, if not now, then eventually as stdenv changes. This patch (which is a simplified version of the original reverted patch) is the simplest solution to this whole thing: it forces wrappers to directly inspect the outputs of the things they are wrapping instead of making stdenv guess the correct values. --- pkgs/build-support/bintools-wrapper/default.nix | 7 ++++--- pkgs/build-support/cc-wrapper/default.nix | 4 +++- pkgs/stdenv/darwin/default.nix | 1 - pkgs/stdenv/linux/default.nix | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 7948f726c62..f9ca245beea 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -6,9 +6,10 @@ # compiler and the linker just "work". { name ? "" -, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" -, bintools ? null, libc ? null -, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null +, stdenvNoCC +, bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null +, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, propagateDoc ? bintools != null && bintools ? man , extraPackages ? [], extraBuildCommands ? "" , buildPackages ? {} , useMacosReexportHack ? false diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 301bc2694c4..e59758371a3 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -6,8 +6,10 @@ # compiler and the linker just "work". { name ? "" -, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, stdenvNoCC , cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell +, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" +, propagateDoc ? cc != null && cc ? man , extraPackages ? [], extraBuildCommands ? "" , isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null , buildPackages ? {} diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 6d224e4cc44..bfeac09ea65 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -88,7 +88,6 @@ in rec { extraPackages = lib.optional (libcxx != null) libcxx; nativeTools = false; - propagateDoc = false; nativeLibc = false; inherit buildPackages coreutils gnugrep bintools; libc = last.pkgs.darwin.Libsystem; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 08703b6934e..978beea692c 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -92,7 +92,6 @@ let else lib.makeOverridable (import ../../build-support/cc-wrapper) { name = "${name}-gcc-wrapper"; nativeTools = false; - propagateDoc = false; nativeLibc = false; buildPackages = lib.optionalAttrs (prevStage ? stdenv) { inherit (prevStage) stdenv; From b14db1b0baea19934313ee90b56b157315ab328b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 5 Sep 2018 14:28:04 -0400 Subject: [PATCH 02/10] gcc-*: Clean up crossStageStatic logic 54282b9610e80b1ed93136319e24cb79c5bbcc33 tread carefuly to avoid a mass rebuild. This embraces the mass rebuild to clean things up. --- pkgs/development/compilers/gcc/4.8/default.nix | 4 +--- pkgs/development/compilers/gcc/4.9/default.nix | 4 +--- pkgs/development/compilers/gcc/5/default.nix | 4 +--- pkgs/development/compilers/gcc/6/default.nix | 4 +--- pkgs/development/compilers/gcc/7/default.nix | 4 +--- pkgs/development/compilers/gcc/8/default.nix | 4 +--- pkgs/development/compilers/gcc/builder.sh | 2 +- pkgs/development/compilers/gcc/snapshot/default.nix | 4 +--- 8 files changed, 8 insertions(+), 22 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 60db368c403..d9376f597a7 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -201,9 +201,7 @@ stdenv.mkDerivation ({ '' else null; - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler langJava + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 361db92cb76..c60f54f1560 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -210,9 +210,7 @@ stdenv.mkDerivation ({ '' else null; - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler langJava + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 2e51e9c0506..efd6ec07257 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -215,9 +215,7 @@ stdenv.mkDerivation ({ ) else null; - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler langJava + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index e6825afcfa8..4760d18a7d8 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -216,9 +216,7 @@ stdenv.mkDerivation ({ ) else null; - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler langJava + inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 4dfbcf0f545..bb8a3638b2d 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -189,9 +189,7 @@ stdenv.mkDerivation ({ ) else ""); - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler + inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 04054df8bf8..59d7653c52c 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -184,9 +184,7 @@ stdenv.mkDerivation ({ ) else ""); - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler + inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index a3250f4021a..75e70006d74 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -131,7 +131,7 @@ if test "$noSysDirs" = "1"; then ) fi - if test -n "${targetConfig-}" -a "$crossStageStatic" == 1; then + if test "$crossStageStatic" == 1; then # We don't want the gcc build to assume there will be a libc providing # limits.h in this stagae makeFlagsArray+=( diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 230409e9753..0de6be36c35 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -154,9 +154,7 @@ stdenv.mkDerivation ({ '' else null; - # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, - crossStageStatic = targetPlatform == hostPlatform || crossStageStatic; - inherit noSysDirs staticCompiler + inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; depsBuildBuild = [ buildPackages.stdenv.cc ]; From 1abf1971cde752357fd9537dd963886c83fd8c03 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:28:32 +0000 Subject: [PATCH 03/10] gcc7: cleanup with a mass rebuild --- pkgs/development/compilers/gcc/7/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index bb8a3638b2d..e2c686b7e7e 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -217,9 +217,7 @@ stdenv.mkDerivation ({ ++ (optional hostPlatform.isDarwin targetPackages.stdenv.cc.bintools) ; - # TODO: Use optionalString with next rebuild. - ${if (stdenv.cc.isClang && langFortran) then "NIX_CFLAGS_COMPILE" else null} = "-Wno-unused-command-line-argument"; - + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"; NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl"; preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' From d2674c5e154881261ab17d6b0b2c2e77bb4be8ab Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:30:39 +0000 Subject: [PATCH 04/10] llvm_5: cleanup with a mass rebuild --- pkgs/development/compilers/llvm/5/libc++/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/llvm/5/libc++/default.nix b/pkgs/development/compilers/llvm/5/libc++/default.nix index c7b4615e374..b182f1250e7 100644 --- a/pkgs/development/compilers/llvm/5/libc++/default.nix +++ b/pkgs/development/compilers/llvm/5/libc++/default.nix @@ -10,11 +10,9 @@ stdenv.mkDerivation rec { export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" ''; - # on next rebuild, this can be replaced with optionals; for now set to null to avoid - # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ - patches = if stdenv.hostPlatform.isMusl then [ + patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ../../libcxx-0001-musl-hacks.patch - ] else null; + ]; prePatch = '' substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" From ed10043f75ab92b1be561b46f2c6f10fc84a7b9b Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:34:46 +0000 Subject: [PATCH 05/10] llvmPackages_6.libcxx: cleanup with a mass rebuild --- pkgs/development/compilers/llvm/6/libc++/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/llvm/6/libc++/default.nix b/pkgs/development/compilers/llvm/6/libc++/default.nix index 1f87cb83ab0..3a165e9da7b 100644 --- a/pkgs/development/compilers/llvm/6/libc++/default.nix +++ b/pkgs/development/compilers/llvm/6/libc++/default.nix @@ -10,11 +10,9 @@ stdenv.mkDerivation rec { export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" ''; - # on next rebuild, this can be replaced with optionals; for now set to null to avoid - # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ - patches = if stdenv.hostPlatform.isMusl then [ + patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ../../libcxx-0001-musl-hacks.patch - ] else null; + ]; prePatch = '' substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" From 2067b2a5246edd36d015ef30a4c957f2dfe4d48c Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Wed, 5 Sep 2018 00:28:02 +0000 Subject: [PATCH 06/10] texinfo: cleanup with a mass rebuild --- pkgs/development/tools/misc/texinfo/common.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/texinfo/common.nix b/pkgs/development/tools/misc/texinfo/common.nix index c6877ed4d1a..391179e2eb3 100644 --- a/pkgs/development/tools/misc/texinfo/common.nix +++ b/pkgs/development/tools/misc/texinfo/common.nix @@ -17,8 +17,7 @@ stdenv.mkDerivation rec { inherit sha256; }; - # TODO: fix on mass rebuild - ${if interactive then "patches" else null} = optional (version == "6.5") ./perl.patch; + patches = optional (version == "6.5") ./perl.patch; # We need a native compiler to build perl XS extensions # when cross-compiling. From c77ba8b8f680ef29fe19b2fa4babe6d615c89f9c Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:35:20 +0000 Subject: [PATCH 07/10] newt: cleanup with a mass rebuild --- pkgs/development/libraries/newt/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/newt/default.nix b/pkgs/development/libraries/newt/default.nix index a10f52462a8..1a5656b7ca1 100644 --- a/pkgs/development/libraries/newt/default.nix +++ b/pkgs/development/libraries/newt/default.nix @@ -22,10 +22,9 @@ stdenv.mkDerivation rec { unset CPP ''; - # Use `lib.optionalString` next mass rebuild. - makeFlags = if stdenv.buildPlatform == stdenv.hostPlatform - then null - else "CROSS_COMPILE=${stdenv.cc.targetPrefix}"; + makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + "CROSS_COMPILE=${stdenv.cc.targetPrefix}" + ]; meta = with stdenv.lib; { homepage = https://fedorahosted.org/newt/; From d5ddae51bd9b438aa6697ec8104ef9b8e13f30f8 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:35:32 +0000 Subject: [PATCH 08/10] pkgconfig: cleanup with a mass rebuild --- pkgs/development/tools/misc/pkgconfig/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/tools/misc/pkgconfig/default.nix b/pkgs/development/tools/misc/pkgconfig/default.nix index 7235af49c2e..1ae8a32b640 100644 --- a/pkgs/development/tools/misc/pkgconfig/default.nix +++ b/pkgs/development/tools/misc/pkgconfig/default.nix @@ -19,7 +19,6 @@ stdenv.mkDerivation rec { patches = optional (!vanilla) ./requires-private.patch ++ optional stdenv.isCygwin ./2.36.3-not-win32.patch; - preConfigure = ""; # TODO(@Ericson2314): Remove next mass rebuild buildInputs = optional (stdenv.isCygwin || stdenv.isDarwin || stdenv.isSunOS) libiconv; configureFlags = [ "--with-internal-glib" ] From d0c6bf0a738b854c57bd87c1a1b4ce63c096d542 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:54:47 +0000 Subject: [PATCH 09/10] libdaemon: cleanup with a mass rebuild --- pkgs/development/libraries/libdaemon/default.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/libdaemon/default.nix b/pkgs/development/libraries/libdaemon/default.nix index 59e576fd392..5dc153dd5cc 100644 --- a/pkgs/development/libraries/libdaemon/default.nix +++ b/pkgs/development/libraries/libdaemon/default.nix @@ -1,6 +1,6 @@ {stdenv, fetchurl}: -stdenv.mkDerivation (rec { +stdenv.mkDerivation rec { name = "libdaemon-0.14"; src = fetchurl { @@ -8,6 +8,8 @@ stdenv.mkDerivation (rec { sha256 = "0d5qlq5ab95wh1xc87rqrh1vx6i8lddka1w3f1zcqvcqdxgyn8zx"; }; + patches = [ ./fix-includes.patch ]; + configureFlags = [ "--disable-lynx" ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ # Can't run this test while cross-compiling @@ -16,16 +18,8 @@ stdenv.mkDerivation (rec { meta = { description = "Lightweight C library that eases the writing of UNIX daemons"; - homepage = http://0pointer.de/lennart/projects/libdaemon/; - license = stdenv.lib.licenses.lgpl2Plus; - platforms = stdenv.lib.platforms.unix; - maintainers = [ ]; }; -} // stdenv.lib.optionalAttrs stdenv.hostPlatform.isMusl { - # This patch should be applied unconditionally, but doing so will cause mass rebuild. - patches = ./fix-includes.patch; -}) - +} From 87c02060383a689e81749643a39dbcc3c4fc6ad1 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 4 Sep 2018 17:55:10 +0000 Subject: [PATCH 10/10] linuxHeaders: cleanup with a mass rebuild --- pkgs/os-specific/linux/kernel-headers/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index 09fa4fbfd3a..f7c3650f818 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -3,7 +3,7 @@ }: let - common = { version, sha256, patches ? null }: stdenvNoCC.mkDerivation { + common = { version, sha256, patches ? [] }: stdenvNoCC.mkDerivation { name = "linux-headers-${version}"; src = fetchurl { @@ -20,8 +20,6 @@ let extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"]; - # "patches" array defaults to 'null' to avoid changing hash - # and causing mass rebuild inherit patches; buildPhase = ''