Fixing what I broke in the last commit in setup.sh.

I made the stdenvCross adapter simpler, according to Nicolas Pierron comments,
and I commented it a bit.

There are still jobs to do. At least:
- Plan for the general renaming from buildInputs to hostInputs
  - We should not break merges from trunk.
- Make the generic stdenv understand about host/buildInputs, at least for
  native builds, because it is used in the always-native building of
  stdenvLinux. This should allow us to remove all duplications of "*NoCross" in
  nixpkgs.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18449
This commit is contained in:
Lluís Batlle i Rossell 2009-11-18 19:25:57 +00:00
parent 4c09cfc8a3
commit 8c638e5e68
2 changed files with 18 additions and 22 deletions

View File

@ -110,24 +110,19 @@ 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 ? null, hostInputs ? null, { mkDerivation = {name, buildInputs ? [], hostInputs ? [],
propagatedBuildInputs ? null, propagatedHostInputs ? null, ...}@args: let propagatedBuildInputs ? [], propagatedHostInputs ? [], ...}@args: let
buildInputsList = if (buildInputs != null) then # propagatedBuildInputs exists temporarily as another name for
buildInputs else []; # propagatedHostInputs.
hostInputsList = if (hostInputs != null) then buildInputsDrvs = map (drv: drv.buildDrv) buildInputs;
hostInputs else []; hostInputsDrvs = map (drv: drv.hostDrv) hostInputs;
propagatedBuildInputsList = if (propagatedBuildInputs != null) then propagatedHostInputsDrvs = map (drv: drv.buildDrv) (propagatedBuildInputs
propagatedBuildInputs else []; ++ propagatedHostInputs);
propagatedHostInputsList = if (propagatedHostInputs != null) then
propagatedHostInputs else [];
buildInputsDrvs = map (drv: drv.buildDrv) buildInputsList;
hostInputsDrvs = map (drv: drv.hostDrv) hostInputsList;
propagatedBuildInputsDrvs = map (drv: drv.buildDrv) propagatedBuildInputsList;
propagatedHostInputsDrvs = map (drv: drv.buildDrv) propagatedHostInputsList;
buildDrv = stdenv.mkDerivation (args // { buildDrv = stdenv.mkDerivation (args // {
# buildInputs in the base stdenv will be named hostInputs
buildInputs = buildInputsDrvs ++ hostInputsDrvs; buildInputs = buildInputsDrvs ++ hostInputsDrvs;
propagatedBuildInputs = propagatedBuildInputsDrvs ++ # Should be propagatedHostInputs one day:
propagatedHostInputsDrvs; propagatedBuildInputs = propagatedHostInputsDrvs;
}); });
hostDrv = if (cross == null) then buildDrv else hostDrv = if (cross == null) then buildDrv else
stdenv.mkDerivation (args // { stdenv.mkDerivation (args // {

View File

@ -159,7 +159,7 @@ findInputs() {
;; ;;
esac esac
$var="${!var} $pkg " eval $var="'${!var} $pkg '"
if test -f $pkg/nix-support/setup-hook; then if test -f $pkg/nix-support/setup-hook; then
source $pkg/nix-support/setup-hook source $pkg/nix-support/setup-hook
@ -177,13 +177,14 @@ for i in $buildInputs $propagatedBuildInputs; do
findInputs $i pkgs findInputs $i pkgs
done done
pkgsHost="" hostPkgs=""
for i in $hostInputs $propagatedHostInputs; do for i in $hostInputs $propagatedBuildInputs; do
findInputs $i pkgsHost findInputs $i hostPkgs
done done
# Set the relevant environment variables to point to the build inputs # Set the relevant environment variables to point to the build inputs
# found above. # found above.
envHostHooks=()
addToEnv() { addToEnv() {
local pkg=$1 local pkg=$1
@ -205,12 +206,12 @@ addToEnvHost() {
local pkg=$1 local pkg=$1
# Run the package-specific hooks set by the setup-hook scripts. # Run the package-specific hooks set by the setup-hook scripts.
for i in "${envHooksHost[@]}"; do for i in "${envHostHooks[@]}"; do
$i $pkg $i $pkg
done done
} }
for i in $pkgsHost; do for i in $hostPkgs; do
addToEnvHost $i addToEnvHost $i
done done