Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host vs. target unconfuse #25194

Merged
merged 3 commits into from Apr 24, 2017

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Apr 24, 2017

Motivation for this change

stdenv.cross is a silly attribute that needs to go leaving the well-defined hostPlatform and targetPlatform. This PR doesn't remove it, but changes its definition: before it tracked the target platform which is sometimes more useful for compilers, and now it tracks the host platform which is more useful for everything else. Most usages are libraries, falling in the "everything else" category, so changing the definition makes sense to appease the majority. The few compiler (gcc in particular) uses that exist I remove to use targetPlatform --- preserving correctness and becoming more explicit in the process.

I would also update the documentation aside mentioning stdenv.cross as deprecated, but the definition given actually erroneously assumes this PR is already merged!

This is split off from #25047

Things done

I commandeered and old jobset of mine to create http://hydra.nixos.org/jobset/nixpkgs/pr-25194 to test, because I couldn't figure out how to run a hydra job locally. http://hydra.nixos.org/eval/1353037?compare=cross-trunk shows no regressions. Yay!

In practice, this is a strictly stronger condition than target != build
as we never have build = target != host. Really, the attribute should
be removed altogether, but for now we make it work for plain libraries,
which do not care about the target platform. In the few cases where the
compilers use this and actually care about the target platform, I'll
manually change them to use `targetPlatform` instead.
The previous commit redefines `stdenv.cross` for the sake of normal
libaries, the most common use-case of that attribute. Some compilers
however relied on the old definition so we have them use
`targetPlatform` instead. This special casing is fine because we
eventually want to remove `stdenv.cross` and use either `hostPlatform`
or `targetPlatform` instead.
Before all overrides were also pruned in the previous stage, now
only gcc and binutils are, because they alone care about about the
target platform. The rest of the overrides don't, so it's better to
preserve them in order to avoid spurious rebuilds.
@mention-bot
Copy link

@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @peti, @edolstra, @vizanto, @LnL7 and @copumpkin to be potential reviewers.

@Ericson2314 Ericson2314 merged commit 75441dd into NixOS:master Apr 24, 2017
@Ericson2314 Ericson2314 deleted the host-target-unconfuse branch April 24, 2017 23:07
@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label May 18, 2017
@Ericson2314 Ericson2314 added this to Prior in Cross compilation Oct 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants