From 4c09cfc8a3d478ef1caf4c10d708267d3dcba65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 18 Nov 2009 18:16:35 +0000 Subject: [PATCH] Adding generic builder management of cross compilation: envHooksHost, pkgsHost, ... svn path=/nixpkgs/branches/stdenv-updates/; revision=18446 --- .../gcc-cross-wrapper/setup-hook.sh | 2 +- pkgs/stdenv/generic/setup.sh | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index e4034820fb3c..506cca7fb55c 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -8,7 +8,7 @@ addCVars () { fi } -envHooks=(${envHooks[@]} addCVars) +envHooksHost=(${envHooksHost[@]} addCVars) # Note: these come *after* $out in the PATH (see setup.sh). diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 9f9d64df8e48..d215b9ef22f9 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -151,14 +151,15 @@ runHook addInputsHook # Recursively find all build inputs. findInputs() { local pkg=$1 + local var=$2 - case $pkgs in + case ${!var} in *\ $pkg\ *) return 0 ;; esac - pkgs="$pkgs $pkg " + $var="${!var} $pkg " if test -f $pkg/nix-support/setup-hook; then source $pkg/nix-support/setup-hook @@ -166,16 +167,20 @@ findInputs() { if test -f $pkg/nix-support/propagated-build-inputs; then for i in $(cat $pkg/nix-support/propagated-build-inputs); do - findInputs $i + findInputs $i $var done fi } pkgs="" for i in $buildInputs $propagatedBuildInputs; do - findInputs $i + findInputs $i pkgs done +pkgsHost="" +for i in $hostInputs $propagatedHostInputs; do + findInputs $i pkgsHost +done # Set the relevant environment variables to point to the build inputs # found above. @@ -196,6 +201,19 @@ for i in $pkgs; do addToEnv $i 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. if test "$NIX_NO_SELF_RPATH" != "1"; then