Merge pull request #31723 from obsidiansystems/stdenv-accum-them-setup

stdenv setup: Run setup hooks and other processing after accumulating deps
This commit is contained in:
John Ericson 2017-11-16 10:42:39 -05:00 committed by GitHub
commit b26038fa54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,6 +324,18 @@ findInputs() {
exit 1
fi
if [ -f "$pkg/nix-support/$propagatedBuildInputsFile" ]; then
local pkgNext
for pkgNext in $(< "$pkg/nix-support/$propagatedBuildInputsFile"); do
findInputs "$pkgNext" "$var" "$propagatedBuildInputsFile"
done
fi
}
# Add package to the future PATH and run setup hooks
activatePackage() {
local pkg="$1"
if [ -f "$pkg" ]; then
local oldOpts="$(shopt -po nounset)"
set +u
@ -341,13 +353,6 @@ findInputs() {
source "$pkg/nix-support/setup-hook"
eval "$oldOpts"
fi
if [ -f "$pkg/nix-support/$propagatedBuildInputsFile" ]; then
local pkgNext
for pkgNext in $(< "$pkg/nix-support/$propagatedBuildInputsFile"); do
findInputs "$pkgNext" "$var" "$propagatedBuildInputsFile"
done
fi
}
declare -a nativePkgs crossPkgs
@ -359,15 +364,22 @@ if [ -z "${crossConfig:-}" ]; then
${propagatedNativeBuildInputs:-} ${propagatedBuildInputs:-}; do
findInputs "$i" nativePkgs propagated-native-build-inputs
done
for i in "${nativePkgs[@]}"; do
activatePackage "$i"
done
else
for i in ${buildInputs:-} ${defaultBuildInputs:-} ${propagatedBuildInputs:-}; do
findInputs "$i" crossPkgs propagated-build-inputs
done
declare -a nativePkgs
for i in ${nativeBuildInputs:-} ${defaultNativeBuildInputs:-} ${propagatedNativeBuildInputs:-}; do
findInputs "$i" nativePkgs propagated-native-build-inputs
done
for i in "${nativePkgs[@]}" "${crossPkgs[@]}"; do
activatePackage "$i"
done
fi