Fix cross-compilation

Dependencies were specified in `depsTargetTarget` which would make them end up in the
dependencies for the target platform when they are actually dependencies needed on the
buildPlatform using the rust package. I.e. they are target dependencies of the compiler
package but will be used as build platform dependencies when propagated.
This commit is contained in:
Albert Cervin 2021-05-18 08:13:56 +02:00
parent 45b4f9e6ab
commit 70fc350a3f
No known key found for this signature in database
GPG Key ID: 8EC09E34A35E8D55

View File

@ -299,14 +299,17 @@ let
# Need to do it manually.
mkdir -p "$out/nix-support"
echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"
if [[ -n "$depsTargetTargetPropagated" ]]; then
echo "$depsTargetTargetPropagated" > "$out/nix-support/propagated-target-target-deps"
if [[ -n "$propagatedNativeBuildInputs" ]]; then
echo "$propagatedNativeBuildInputs" > "$out/nix-support/propagated-native-build-inputs"
fi
'';
# FIXME: If these propagated dependencies go components, darwin build will fail with "`-liconv` not found".
propagatedBuildInputs = [ self.stdenv.cc ];
depsTargetTargetPropagated =
# use propagatedNativebuildinputs here because we want these dependencies to end up
# as buildPlatform dependencies on the derivation using the compiler even though
# they are targetPlatform dependencies from the compiler's perspective
propagatedNativeBuildInputs = [ self.stdenv.cc self.targetPackages.stdenv.cc ] ++
self.lib.optional (self.stdenv.targetPlatform.isDarwin) self.targetPackages.libiconv;
meta.platforms = self.lib.platforms.all;