diff --git a/pkgs/development/tools/parsing/bison/bison-2.3.nix b/pkgs/development/tools/parsing/bison/bison-2.3.nix index ae90f2e83d0..7ebdb863d58 100644 --- a/pkgs/development/tools/parsing/bison/bison-2.3.nix +++ b/pkgs/development/tools/parsing/bison/bison-2.3.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation { url = mirror://gnu/bison/bison-2.3.tar.bz2; md5 = "c18640c6ec31a169d351e3117ecce3ec"; }; - buildInputs = [m4]; + buildNativeInputs = [m4]; meta = { description = "GNU Bison, a Yacc-compatible parser generator"; diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix index ac3f49035a1..f1436623adc 100644 --- a/pkgs/misc/uboot/default.nix +++ b/pkgs/misc/uboot/default.nix @@ -1,6 +1,7 @@ {stdenv, fetchurl, unzip}: -# assert stdenv.system == "armv5tel-linux"; +# We should enable this check once we have the cross target system information +# assert stdenv.system == "armv5tel-linux" || crossConfig == "armv5tel-linux"; # All this file is made for the Marvell Sheevaplug @@ -37,7 +38,7 @@ stdenv.mkDerivation { if test -z "$crossTarget"; then make clean all else - make clean all ARCH=arm CROSS_COMPILE=$crossTarget- + make clean all ARCH=arm CROSS_COMPILE=$crossConfig- fi ''; diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index ecbe2dbcf71..85ff46a339d 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -110,29 +110,25 @@ rec { # Return a modified stdenv that adds a cross compiler to the # builds. makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // - { mkDerivation = {name, buildInputs ? [], hostInputs ? [], - propagatedBuildInputs ? [], propagatedHostInputs ? [], ...}@args: let + { mkDerivation = {name, buildInputs ? [], buildNativeInputs ? [], + propagatedBuildInputs ? [], ...}@args: let # propagatedBuildInputs exists temporarily as another name for # propagatedHostInputs. - buildInputsDrvs = map (drv: drv.buildDrv) buildInputs; - hostInputsDrvs = map (drv: drv.hostDrv) hostInputs; - propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs - ++ propagatedHostInputs); - buildDrv = stdenv.mkDerivation (args // { - # buildInputs in the base stdenv will be named hostInputs - buildInputs = buildInputsDrvs ++ hostInputsDrvs; - # Should be propagatedHostInputs one day: - propagatedBuildInputs = propagatedHostInputsDrvs; - }); + getBuildDrv = drv : if (drv ? buildDrv) then drv.buildDrv else drv; + buildInputsDrvs = map (getBuildDrv) buildNativeInputs; + hostInputsDrvs = map (drv: drv.hostDrv) buildInputs; + hostInputsDrvsAsBuildInputs = map (getBuildDrv) buildInputs; + propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs); + buildDrv = stdenv.mkDerivation args; hostDrv = if (cross == null) then buildDrv else - stdenv.mkDerivation (args // { + stdenv.mkDerivation (args // { name = name + "-" + cross.config; buildInputs = buildInputsDrvs ++ [ gccCross binutilsCross ]; crossConfig = cross.config; }); - in hostDrv // { + in buildDrv // { inherit hostDrv buildDrv; }; } // { inherit cross; }; diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index de525d479f9..d9ce8d6f825 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -45,14 +45,20 @@ let mkDerivation = attrs: (derivation ( (removeAttrs attrs ["meta" "passthru"]) - // + // (let + buildInputs = if attrs ? buildInputs then attrs.buildInputs + else []; + buildNativeInputs = if attrs ? buildNativeInputs then attrs.buildNativeInputs + else []; + in { builder = if attrs ? realBuilder then attrs.realBuilder else shell; args = if attrs ? args then attrs.args else ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)]; stdenv = result; system = result.system; - }) + buildInputs = buildInputs ++ buildNativeInputs; + })) ) # The meta attribute is passed in the resulting attribute set, # but it's not part of the actual derivation, i.e., it's not diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index cf67e707173..e04b81b152b 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -93,7 +93,6 @@ rec { extraAttrs = extraAttrs // {inherit fetchurl;}; }; - # Build a dummy stdenv with no GCC or working fetchurl. This is # because we need a stdenv to build the GCC wrapper and fetchurl. stdenvLinuxBoot0 = stdenvBootFun { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a2333f1a6a6..57d4061c7c4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -216,19 +216,18 @@ let defaultStdenv = allStdenvs.stdenv; - stdenvNoCross = + stdenvCross = makeStdenvCross defaultStdenv crossSystem (binutilsCross crossSystem) + (gccCrossStageFinal crossSystem); + + stdenv = if bootStdenv != null then bootStdenv else let changer = getConfig ["replaceStdenv"] null; in if changer != null then changer { - stdenv = defaultStdenv; + stdenv = stdenvCross; overrideSetup = overrideSetup; } - else defaultStdenv; - - stdenv = if (bootStdenv != null || crossSystem == null) then stdenvNoCross else - makeStdenvCross stdenvNoCross crossSystem (binutilsCross crossSystem) - (gccCrossStageFinal crossSystem); + else stdenvCross; # A stdenv capable of building 32-bit binaries. On x86_64-linux, # it uses GCC compiled with multilib support; on i686-linux, it's @@ -306,8 +305,8 @@ let # from being built. fetchurl = useFromStdenv "fetchurl" (import ../build-support/fetchurl { - curl = curlNoCross; - stdenv = stdenvNoCross; + curl = curl; + stdenv = stdenv; }); # fetchurlBoot is used for curl and its dependencies in order to @@ -648,12 +647,6 @@ let sslSupport = ! ((stdenv ? isDietLibC) || (stdenv ? isStatic)); }; - curlNoCross = curl.override { - stdenv = stdenvNoCross; - zlib = zlib.override { stdenv = stdenvNoCross; }; - openssl = opensslNoCross; - }; - curlftpfs = import ../tools/networking/curlftpfs { inherit fetchurl stdenv fuse curl pkgconfig zlib glib; }; @@ -1079,10 +1072,6 @@ let inherit fetchurl stdenv; }; - lzmaNoCross = lzma.override { - stdenv = stdenvNoCross; - }; - xz = import ../tools/compression/xz { inherit fetchurl stdenv lib; }; @@ -1896,17 +1885,13 @@ let gcc43 = useFromStdenv "gcc" gcc43_real; gcc43_real = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.3) { - inherit fetchurl gmp mpfr noSysDirs; - stdenv = stdenvNoCross; - texinfo = texinfoNoCross; + inherit stdenv fetchurl texinfo gmp mpfr noSysDirs; profiledCompiler = true; })); gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) { #stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc); - inherit fetchurl gmp mpfr noSysDirs cross; - stdenv = stdenvNoCross; - texinfo = texinfoNoCross; + inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross; binutilsCross = binutilsCross cross; glibcCross = glibcCross cross; profiledCompiler = false; @@ -2343,8 +2328,7 @@ let import ../build-support/gcc-cross-wrapper { nativeTools = false; nativeLibc = false; - inherit gcc binutils libc shell name cross; - stdenv = stdenvNoCross; + inherit stdenv gcc binutils libc shell name cross; }; # FIXME: This is a specific hack for GCC-UPC. Eventually, we may @@ -2454,11 +2438,6 @@ let perl = if system != "i686-cygwin" then perl510 else sysPerl; - perlNoCross = perl.override - { - stdenv = stdenvNoCross; - }; - # FIXME: unixODBC needs patching on Darwin (see darwinports) phpOld = import ../development/interpreters/php { inherit stdenv fetchurl flex bison libxml2 apacheHttpd; @@ -2731,8 +2710,7 @@ let }); binutilsCross = cross : import ../development/tools/misc/binutils { - inherit fetchurl cross; - stdenv = stdenvNoCross; + inherit stdenv fetchurl cross; noSysDirs = true; }; @@ -2873,10 +2851,6 @@ let m4 = gnum4; - m4NoCross = m4.override { - stdenv = stdenvNoCross; - }; - global = import ../development/tools/misc/global { inherit fetchurl stdenv; }; @@ -3077,12 +3051,6 @@ let inherit fetchurl stdenv ncurses lzma; }; - texinfoNoCross = texinfo.override { - stdenv = stdenvNoCross; - ncurses = ncursesNoCross; - lzma = lzmaNoCross; - }; - texi2html = import ../development/tools/misc/texi2html { inherit fetchurl stdenv perl; }; @@ -3558,8 +3526,7 @@ let }; glibc29Cross = cross : makeOverridable (import ../development/libraries/glibc-2.9) { - inherit fetchurl cross; - stdenv = stdenvNoCross; + inherit stdenv fetchurl cross; binutilsCross = binutilsCross cross; gccCross = gccCrossStageStatic cross; kernelHeaders = kernelHeadersCross cross; @@ -3612,9 +3579,7 @@ let }; gmp = import ../development/libraries/gmp { - inherit fetchurl; - stdenv = stdenvNoCross; - m4 = m4NoCross; + inherit stdenv fetchurl m4; }; # `gmpxx' used to mean "GMP with C++ bindings". Now `gmp' has C++ bindings @@ -3636,8 +3601,7 @@ let #GMP ex-satellite, so better keep it near gmp mpfr = import ../development/libraries/mpfr { - inherit fetchurl gmp; - stdenv = stdenvNoCross; + inherit stdenv fetchurl gmp; }; gst_all = recurseIntoAttrs (import ../development/libraries/gstreamer { @@ -4355,10 +4319,6 @@ let unicode = (system != "i686-cygwin" && ! (stdenv ? cross)); }; - ncursesNoCross = ncurses.override { - stdenv = stdenvNoCross; - }; - neon = neon026; neon026 = import ../development/libraries/neon/0.26.nix { @@ -4443,11 +4403,6 @@ let inherit stdenv perl; }; - opensslNoCross = openssl.override { - stdenv = stdenvNoCross; - perl = perlNoCross; - }; - ortp = import ../development/libraries/ortp { inherit fetchurl stdenv; }; @@ -5547,9 +5502,7 @@ let kernelHeaders = kernelHeaders_2_6_28; kernelHeadersCross = cross : import ../os-specific/linux/kernel-headers/2.6.28.nix { - inherit fetchurl cross; - stdenv = stdenvNoCross; - perl = perlNoCross; + inherit stdenv fetchurl cross perl; }; kernelHeaders_2_6_18 = import ../os-specific/linux/kernel-headers/2.6.18.5.nix {