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
# builds.
makeStdenvCross = stdenv: cross: binutilsCross: gccCross: stdenv //
{ mkDerivation = {name, buildInputs ? null, hostInputs ? null,
propagatedBuildInputs ? null, propagatedHostInputs ? null, ...}@args: let
buildInputsList = if (buildInputs != null) then
buildInputs else [];
hostInputsList = if (hostInputs != null) then
hostInputs else [];
propagatedBuildInputsList = if (propagatedBuildInputs != null) then
propagatedBuildInputs else [];
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;
{ mkDerivation = {name, buildInputs ? [], hostInputs ? [],
propagatedBuildInputs ? [], propagatedHostInputs ? [], ...}@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;
propagatedBuildInputs = propagatedBuildInputsDrvs ++
propagatedHostInputsDrvs;
# Should be propagatedHostInputs one day:
propagatedBuildInputs = propagatedHostInputsDrvs;
});
hostDrv = if (cross == null) then buildDrv else
stdenv.mkDerivation (args // {

View File

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