From 8c638e5e6880156986f2af9ee5c473be5d1b3fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 18 Nov 2009 19:25:57 +0000 Subject: [PATCH] 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 --- pkgs/stdenv/adapters.nix | 27 +++++++++++---------------- pkgs/stdenv/generic/setup.sh | 13 +++++++------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index edf3980cd788..ecbe2dbcf71d 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -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 // { diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index d215b9ef22f9..1dd772ff3174 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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