- Removed all *NoCross expressions I dupilcated in nixpkgs, while maintaining

the cross compilation functionality.
- I renamed some expected stdenv.mkDerivation parameter attributes so we can
  keep this branch properly updated from trunk. We agreed with Nicolas Pierron
  doing a massive renaming, so all current buildInputs become hostInputs (input
  as build for the host machine, in autotools terminology) , and
  then buildInputs would mean "input as for the build machine".
  By now, the specific "input as for the build machine" is specified through
  buildNativeInputs. We should fix this in the merge to trunk.
- I made the generic stdenv understand the buildNativeInputs, otherwise if
  we start changing nixpkgs expressions so they distinguish the current
  buildInputs into buildInputs and buildNativeInputs, we could break even more
  nixpkgs for other platforms.
- I changed the default result of mkDerivation so it becomes the derivation for
  to be run in the build machine. This allows, without any special rewriting,
  "fetchurl" derivations to be always results for the build machine to use
  them.
- The change above implies that, for anyone wanting to cross-compile, has to
  build the hostDrv of the wanted derivation. For example, after this commit,
  the usual test of "nix-build -A bison.hostDrv arm.nix" works. I described
  the contents of this arm.nix in r18398.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18471
This commit is contained in:
Lluís Batlle i Rossell 2009-11-19 19:03:34 +00:00
parent 56ed820f84
commit 7ade207f6b
6 changed files with 38 additions and 83 deletions

View file

@ -8,7 +8,7 @@ stdenv.mkDerivation {
url = mirror://gnu/bison/bison-2.3.tar.bz2; url = mirror://gnu/bison/bison-2.3.tar.bz2;
md5 = "c18640c6ec31a169d351e3117ecce3ec"; md5 = "c18640c6ec31a169d351e3117ecce3ec";
}; };
buildInputs = [m4]; buildNativeInputs = [m4];
meta = { meta = {
description = "GNU Bison, a Yacc-compatible parser generator"; description = "GNU Bison, a Yacc-compatible parser generator";

View file

@ -1,6 +1,7 @@
{stdenv, fetchurl, unzip}: {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 # All this file is made for the Marvell Sheevaplug
@ -37,7 +38,7 @@ stdenv.mkDerivation {
if test -z "$crossTarget"; then if test -z "$crossTarget"; then
make clean all make clean all
else else
make clean all ARCH=arm CROSS_COMPILE=$crossTarget- make clean all ARCH=arm CROSS_COMPILE=$crossConfig-
fi fi
''; '';

View file

@ -110,29 +110,25 @@ rec {
# Return a modified stdenv that adds a cross compiler to the # Return a modified stdenv that adds a cross compiler to the
# builds. # builds.
makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv // makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
{ mkDerivation = {name, buildInputs ? [], hostInputs ? [], { mkDerivation = {name, buildInputs ? [], buildNativeInputs ? [],
propagatedBuildInputs ? [], propagatedHostInputs ? [], ...}@args: let propagatedBuildInputs ? [], ...}@args: let
# propagatedBuildInputs exists temporarily as another name for # propagatedBuildInputs exists temporarily as another name for
# propagatedHostInputs. # propagatedHostInputs.
buildInputsDrvs = map (drv: drv.buildDrv) buildInputs; getBuildDrv = drv : if (drv ? buildDrv) then drv.buildDrv else drv;
hostInputsDrvs = map (drv: drv.hostDrv) hostInputs; buildInputsDrvs = map (getBuildDrv) buildNativeInputs;
propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs hostInputsDrvs = map (drv: drv.hostDrv) buildInputs;
++ propagatedHostInputs); hostInputsDrvsAsBuildInputs = map (getBuildDrv) buildInputs;
buildDrv = stdenv.mkDerivation (args // { propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs);
# buildInputs in the base stdenv will be named hostInputs buildDrv = stdenv.mkDerivation args;
buildInputs = buildInputsDrvs ++ hostInputsDrvs;
# Should be propagatedHostInputs one day:
propagatedBuildInputs = propagatedHostInputsDrvs;
});
hostDrv = if (cross == null) then buildDrv else hostDrv = if (cross == null) then buildDrv else
stdenv.mkDerivation (args // { stdenv.mkDerivation (args // {
name = name + "-" + cross.config; name = name + "-" + cross.config;
buildInputs = buildInputsDrvs buildInputs = buildInputsDrvs
++ [ gccCross binutilsCross ]; ++ [ gccCross binutilsCross ];
crossConfig = cross.config; crossConfig = cross.config;
}); });
in hostDrv // { in buildDrv // {
inherit hostDrv buildDrv; inherit hostDrv buildDrv;
}; };
} // { inherit cross; }; } // { inherit cross; };

View file

@ -45,14 +45,20 @@ let
mkDerivation = attrs: mkDerivation = attrs:
(derivation ( (derivation (
(removeAttrs attrs ["meta" "passthru"]) (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; builder = if attrs ? realBuilder then attrs.realBuilder else shell;
args = if attrs ? args then attrs.args else args = if attrs ? args then attrs.args else
["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)]; ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
stdenv = result; stdenv = result;
system = result.system; system = result.system;
}) buildInputs = buildInputs ++ buildNativeInputs;
}))
) )
# The meta attribute is passed in the resulting attribute set, # The meta attribute is passed in the resulting attribute set,
# but it's not part of the actual derivation, i.e., it's not # but it's not part of the actual derivation, i.e., it's not

View file

@ -93,7 +93,6 @@ rec {
extraAttrs = extraAttrs // {inherit fetchurl;}; extraAttrs = extraAttrs // {inherit fetchurl;};
}; };
# Build a dummy stdenv with no GCC or working fetchurl. This is # Build a dummy stdenv with no GCC or working fetchurl. This is
# because we need a stdenv to build the GCC wrapper and fetchurl. # because we need a stdenv to build the GCC wrapper and fetchurl.
stdenvLinuxBoot0 = stdenvBootFun { stdenvLinuxBoot0 = stdenvBootFun {

View file

@ -216,19 +216,18 @@ let
defaultStdenv = allStdenvs.stdenv; defaultStdenv = allStdenvs.stdenv;
stdenvNoCross = stdenvCross = makeStdenvCross defaultStdenv crossSystem (binutilsCross crossSystem)
(gccCrossStageFinal crossSystem);
stdenv =
if bootStdenv != null then bootStdenv else if bootStdenv != null then bootStdenv else
let changer = getConfig ["replaceStdenv"] null; let changer = getConfig ["replaceStdenv"] null;
in if changer != null then in if changer != null then
changer { changer {
stdenv = defaultStdenv; stdenv = stdenvCross;
overrideSetup = overrideSetup; overrideSetup = overrideSetup;
} }
else defaultStdenv; else stdenvCross;
stdenv = if (bootStdenv != null || crossSystem == null) then stdenvNoCross else
makeStdenvCross stdenvNoCross crossSystem (binutilsCross crossSystem)
(gccCrossStageFinal crossSystem);
# A stdenv capable of building 32-bit binaries. On x86_64-linux, # A stdenv capable of building 32-bit binaries. On x86_64-linux,
# it uses GCC compiled with multilib support; on i686-linux, it's # it uses GCC compiled with multilib support; on i686-linux, it's
@ -306,8 +305,8 @@ let
# from being built. # from being built.
fetchurl = useFromStdenv "fetchurl" fetchurl = useFromStdenv "fetchurl"
(import ../build-support/fetchurl { (import ../build-support/fetchurl {
curl = curlNoCross; curl = curl;
stdenv = stdenvNoCross; stdenv = stdenv;
}); });
# fetchurlBoot is used for curl and its dependencies in order to # fetchurlBoot is used for curl and its dependencies in order to
@ -648,12 +647,6 @@ let
sslSupport = ! ((stdenv ? isDietLibC) || (stdenv ? isStatic)); sslSupport = ! ((stdenv ? isDietLibC) || (stdenv ? isStatic));
}; };
curlNoCross = curl.override {
stdenv = stdenvNoCross;
zlib = zlib.override { stdenv = stdenvNoCross; };
openssl = opensslNoCross;
};
curlftpfs = import ../tools/networking/curlftpfs { curlftpfs = import ../tools/networking/curlftpfs {
inherit fetchurl stdenv fuse curl pkgconfig zlib glib; inherit fetchurl stdenv fuse curl pkgconfig zlib glib;
}; };
@ -1079,10 +1072,6 @@ let
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
lzmaNoCross = lzma.override {
stdenv = stdenvNoCross;
};
xz = import ../tools/compression/xz { xz = import ../tools/compression/xz {
inherit fetchurl stdenv lib; inherit fetchurl stdenv lib;
}; };
@ -1896,17 +1885,13 @@ let
gcc43 = useFromStdenv "gcc" gcc43_real; gcc43 = useFromStdenv "gcc" gcc43_real;
gcc43_real = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.3) { gcc43_real = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.3) {
inherit fetchurl gmp mpfr noSysDirs; inherit stdenv fetchurl texinfo gmp mpfr noSysDirs;
stdenv = stdenvNoCross;
texinfo = texinfoNoCross;
profiledCompiler = true; profiledCompiler = true;
})); }));
gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) { gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) {
#stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc); #stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc);
inherit fetchurl gmp mpfr noSysDirs cross; inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
stdenv = stdenvNoCross;
texinfo = texinfoNoCross;
binutilsCross = binutilsCross cross; binutilsCross = binutilsCross cross;
glibcCross = glibcCross cross; glibcCross = glibcCross cross;
profiledCompiler = false; profiledCompiler = false;
@ -2343,8 +2328,7 @@ let
import ../build-support/gcc-cross-wrapper { import ../build-support/gcc-cross-wrapper {
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
inherit gcc binutils libc shell name cross; inherit stdenv gcc binutils libc shell name cross;
stdenv = stdenvNoCross;
}; };
# FIXME: This is a specific hack for GCC-UPC. Eventually, we may # 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; perl = if system != "i686-cygwin" then perl510 else sysPerl;
perlNoCross = perl.override
{
stdenv = stdenvNoCross;
};
# FIXME: unixODBC needs patching on Darwin (see darwinports) # FIXME: unixODBC needs patching on Darwin (see darwinports)
phpOld = import ../development/interpreters/php { phpOld = import ../development/interpreters/php {
inherit stdenv fetchurl flex bison libxml2 apacheHttpd; inherit stdenv fetchurl flex bison libxml2 apacheHttpd;
@ -2731,8 +2710,7 @@ let
}); });
binutilsCross = cross : import ../development/tools/misc/binutils { binutilsCross = cross : import ../development/tools/misc/binutils {
inherit fetchurl cross; inherit stdenv fetchurl cross;
stdenv = stdenvNoCross;
noSysDirs = true; noSysDirs = true;
}; };
@ -2873,10 +2851,6 @@ let
m4 = gnum4; m4 = gnum4;
m4NoCross = m4.override {
stdenv = stdenvNoCross;
};
global = import ../development/tools/misc/global { global = import ../development/tools/misc/global {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
@ -3077,12 +3051,6 @@ let
inherit fetchurl stdenv ncurses lzma; inherit fetchurl stdenv ncurses lzma;
}; };
texinfoNoCross = texinfo.override {
stdenv = stdenvNoCross;
ncurses = ncursesNoCross;
lzma = lzmaNoCross;
};
texi2html = import ../development/tools/misc/texi2html { texi2html = import ../development/tools/misc/texi2html {
inherit fetchurl stdenv perl; inherit fetchurl stdenv perl;
}; };
@ -3558,8 +3526,7 @@ let
}; };
glibc29Cross = cross : makeOverridable (import ../development/libraries/glibc-2.9) { glibc29Cross = cross : makeOverridable (import ../development/libraries/glibc-2.9) {
inherit fetchurl cross; inherit stdenv fetchurl cross;
stdenv = stdenvNoCross;
binutilsCross = binutilsCross cross; binutilsCross = binutilsCross cross;
gccCross = gccCrossStageStatic cross; gccCross = gccCrossStageStatic cross;
kernelHeaders = kernelHeadersCross cross; kernelHeaders = kernelHeadersCross cross;
@ -3612,9 +3579,7 @@ let
}; };
gmp = import ../development/libraries/gmp { gmp = import ../development/libraries/gmp {
inherit fetchurl; inherit stdenv fetchurl m4;
stdenv = stdenvNoCross;
m4 = m4NoCross;
}; };
# `gmpxx' used to mean "GMP with C++ bindings". Now `gmp' has C++ bindings # `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 #GMP ex-satellite, so better keep it near gmp
mpfr = import ../development/libraries/mpfr { mpfr = import ../development/libraries/mpfr {
inherit fetchurl gmp; inherit stdenv fetchurl gmp;
stdenv = stdenvNoCross;
}; };
gst_all = recurseIntoAttrs (import ../development/libraries/gstreamer { gst_all = recurseIntoAttrs (import ../development/libraries/gstreamer {
@ -4355,10 +4319,6 @@ let
unicode = (system != "i686-cygwin" && ! (stdenv ? cross)); unicode = (system != "i686-cygwin" && ! (stdenv ? cross));
}; };
ncursesNoCross = ncurses.override {
stdenv = stdenvNoCross;
};
neon = neon026; neon = neon026;
neon026 = import ../development/libraries/neon/0.26.nix { neon026 = import ../development/libraries/neon/0.26.nix {
@ -4443,11 +4403,6 @@ let
inherit stdenv perl; inherit stdenv perl;
}; };
opensslNoCross = openssl.override {
stdenv = stdenvNoCross;
perl = perlNoCross;
};
ortp = import ../development/libraries/ortp { ortp = import ../development/libraries/ortp {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
@ -5547,9 +5502,7 @@ let
kernelHeaders = kernelHeaders_2_6_28; kernelHeaders = kernelHeaders_2_6_28;
kernelHeadersCross = cross : import ../os-specific/linux/kernel-headers/2.6.28.nix { kernelHeadersCross = cross : import ../os-specific/linux/kernel-headers/2.6.28.nix {
inherit fetchurl cross; inherit stdenv fetchurl cross perl;
stdenv = stdenvNoCross;
perl = perlNoCross;
}; };
kernelHeaders_2_6_18 = import ../os-specific/linux/kernel-headers/2.6.18.5.nix { kernelHeaders_2_6_18 = import ../os-specific/linux/kernel-headers/2.6.18.5.nix {