Merge #23374: mkDerivation: simplify non-cross builds

Don't pass buildInputs to stdenv builder in nativeBuildInputs.
This commit is contained in:
Vladimír Čunát 2017-04-14 11:01:10 +02:00
commit f3ceb764e4
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
2 changed files with 41 additions and 20 deletions

View File

@ -264,18 +264,16 @@ let
__ignoreNulls = true;
# Inputs built by the cross compiler.
buildInputs = if crossConfig != null then buildInputs' else [];
propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs' else [];
buildInputs = buildInputs';
propagatedBuildInputs = propagatedBuildInputs';
# Inputs built by the usual native compiler.
nativeBuildInputs = nativeBuildInputs'
++ lib.optionals (crossConfig == null) buildInputs'
++ lib.optional
(result.isCygwin
|| (crossConfig != null && lib.hasSuffix "mingw32" crossConfig))
../../build-support/setup-hooks/win-dll-link.sh
;
propagatedNativeBuildInputs = propagatedNativeBuildInputs' ++
(if crossConfig == null then propagatedBuildInputs' else []);
propagatedNativeBuildInputs = propagatedNativeBuildInputs';
} // ifDarwin {
# TODO: remove lib.unique once nix has a list canonicalization primitive
__sandboxProfile =

View File

@ -290,15 +290,26 @@ findInputs() {
fi
}
crossPkgs=""
for i in $buildInputs $defaultBuildInputs $propagatedBuildInputs; do
findInputs $i crossPkgs propagated-build-inputs
done
if [ -z "$crossConfig" ]; then
# Not cross-compiling - both buildInputs (and variants like propagatedBuildInputs)
# are handled identically to nativeBuildInputs
nativePkgs=""
for i in $nativeBuildInputs $buildInputs \
$defaultNativeBuildInputs $defaultBuildInputs \
$propagatedNativeBuildInputs $propagatedBuildInputs; do
findInputs $i nativePkgs propagated-native-build-inputs
done
else
crossPkgs=""
for i in $buildInputs $defaultBuildInputs $propagatedBuildInputs; do
findInputs $i crossPkgs propagated-build-inputs
done
nativePkgs=""
for i in $nativeBuildInputs $defaultNativeBuildInputs $propagatedNativeBuildInputs; do
findInputs $i nativePkgs propagated-native-build-inputs
done
nativePkgs=""
for i in $nativeBuildInputs $defaultNativeBuildInputs $propagatedNativeBuildInputs; do
findInputs $i nativePkgs propagated-native-build-inputs
done
fi
# Set the relevant environment variables to point to the build inputs
@ -759,14 +770,26 @@ fixupPhase() {
# Propagate build inputs and setup hook into the development output.
if [ -n "$propagatedBuildInputs" ]; then
mkdir -p "${!outputDev}/nix-support"
echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs"
fi
if [ -z "$crossConfig" ]; then
# Not cross-compiling - propagatedBuildInputs are handled identically to propagatedNativeBuildInputs
local propagated="$propagatedNativeBuildInputs"
if [ -n "$propagatedBuildInputs" ]; then
propagated+="${propagated:+ }$propagatedBuildInputs"
fi
if [ -n "$propagated" ]; then
mkdir -p "${!outputDev}/nix-support"
echo "$propagated" > "${!outputDev}/nix-support/propagated-native-build-inputs"
fi
else
if [ -n "$propagatedBuildInputs" ]; then
mkdir -p "${!outputDev}/nix-support"
echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs"
fi
if [ -n "$propagatedNativeBuildInputs" ]; then
mkdir -p "${!outputDev}/nix-support"
echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs"
if [ -n "$propagatedNativeBuildInputs" ]; then
mkdir -p "${!outputDev}/nix-support"
echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs"
fi
fi
if [ -n "$setupHook" ]; then