binutils: try to move headers around only when --host/--target differ (#215989)

Without the change `pkgsMusl.pkgsStatic.buildPackages.binutils.bintools`
build fails as:

    $ ln: failed to create symbolic link './include': File exists

This happens because both host and target are `x86_64-unknown-linux-musl`.
But `hostPlatform` differs from `targetPlatform` by `isStatic` value.

By `./configure`'s standard it's not yet a cross-compilation. The change
tries to move things around only when tuples change.
This commit is contained in:
Sergei Trofimovich 2023-02-12 13:40:29 +00:00 committed by GitHub
parent b5ace1ffc0
commit d381e51fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,7 +234,7 @@ stdenv.mkDerivation (finalAttrs: {
# $out/$host/$target/include/* to $dev/include/*
# TODO(trofi): fix installation paths upstream so we could remove this
# code and have "lib" output unconditionally.
postInstall = lib.optionalString (hostPlatform != targetPlatform) ''
postInstall = lib.optionalString (hostPlatform.config != targetPlatform.config) ''
ln -s $out/${hostPlatform.config}/${targetPlatform.config}/lib/* $out/lib/
ln -s $out/${hostPlatform.config}/${targetPlatform.config}/include/* $dev/include/
'';