Adding generic builder management of cross compilation: envHooksHost, pkgsHost, ...

svn path=/nixpkgs/branches/stdenv-updates/; revision=18446
This commit is contained in:
Lluís Batlle i Rossell 2009-11-18 18:16:35 +00:00
parent e7c8e8da4f
commit 4c09cfc8a3
2 changed files with 23 additions and 5 deletions

View File

@ -8,7 +8,7 @@ addCVars () {
fi fi
} }
envHooks=(${envHooks[@]} addCVars) envHooksHost=(${envHooksHost[@]} addCVars)
# Note: these come *after* $out in the PATH (see setup.sh). # Note: these come *after* $out in the PATH (see setup.sh).

View File

@ -151,14 +151,15 @@ runHook addInputsHook
# Recursively find all build inputs. # Recursively find all build inputs.
findInputs() { findInputs() {
local pkg=$1 local pkg=$1
local var=$2
case $pkgs in case ${!var} in
*\ $pkg\ *) *\ $pkg\ *)
return 0 return 0
;; ;;
esac esac
pkgs="$pkgs $pkg " $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
@ -166,16 +167,20 @@ findInputs() {
if test -f $pkg/nix-support/propagated-build-inputs; then if test -f $pkg/nix-support/propagated-build-inputs; then
for i in $(cat $pkg/nix-support/propagated-build-inputs); do for i in $(cat $pkg/nix-support/propagated-build-inputs); do
findInputs $i findInputs $i $var
done done
fi fi
} }
pkgs="" pkgs=""
for i in $buildInputs $propagatedBuildInputs; do for i in $buildInputs $propagatedBuildInputs; do
findInputs $i findInputs $i pkgs
done done
pkgsHost=""
for i in $hostInputs $propagatedHostInputs; do
findInputs $i pkgsHost
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.
@ -196,6 +201,19 @@ for i in $pkgs; do
addToEnv $i addToEnv $i
done done
addToEnvHost() {
local pkg=$1
# Run the package-specific hooks set by the setup-hook scripts.
for i in "${envHooksHost[@]}"; do
$i $pkg
done
}
for i in $pkgsHost; do
addToEnvHost $i
done
# Add the output as an rpath. # Add the output as an rpath.
if test "$NIX_NO_SELF_RPATH" != "1"; then if test "$NIX_NO_SELF_RPATH" != "1"; then