-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
pkgs/top-level/all-packages.nix: add cc & ccChooser #409851
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
base: master
Are you sure you want to change the base?
Changes from all commits
124de9e
b6a1b6e
d33a89d
7ef4495
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| dieHook, | ||
| writeShellScript, | ||
| tests, | ||
| cc ? targetPackages.stdenv.cc, | ||
| cc, | ||
| sanitizers ? [ ], | ||
| }: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8197,6 +8197,44 @@ with pkgs; | |||||||||
| null; | ||||||||||
|
|
||||||||||
| # We can choose: | ||||||||||
| ccChooser = | ||||||||||
| platform: pkgs: fallback: | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to make this more self-explanatory.
Suggested change
or
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is Or don't take
Can someone explain this? Edit: I was looking at a two-month old Nixpkgs clone.. But asking on the stdenv team's Matrix channel. |
||||||||||
| let | ||||||||||
| # TODO: use cc when https://github.com/NixOS/nixpkgs/pull/365057 is merged | ||||||||||
| inherit (platform) useLLVM isDarwin isGhcjs; | ||||||||||
| useArocc = platform.useArocc or false; | ||||||||||
| useZig = platform.useZig or false; | ||||||||||
| useiOSPrebuilt = platform.useiOSPrebuilt or false; | ||||||||||
| useAndroidPrebuilt = platform.useAndroidPrebuilt or false; | ||||||||||
| in | ||||||||||
| if useiOSPrebuilt then | ||||||||||
| pkgs.darwin.iosSdkPkgs.clang or fallback | ||||||||||
| else if useAndroidPrebuilt then | ||||||||||
| pkgs."androidndkPkgs_${platform.androidNdkVersion}".clang or fallback | ||||||||||
| else if isGhcjs then | ||||||||||
| # Need to use `throw` so tryEval for splicing works, ugh. Using | ||||||||||
| # `null` or skipping the attribute would cause an eval failure | ||||||||||
| # `tryEval` wouldn't catch, wrecking accessing previous stages | ||||||||||
| # when there is a C compiler and everything should be fine. | ||||||||||
| # NOTE: maybe we remove this and return null instead? | ||||||||||
| throw "no C compiler provided for this platform" | ||||||||||
| else if isDarwin then | ||||||||||
| pkgs.llvmPackages.libcxxClang or fallback | ||||||||||
| else if useArocc then | ||||||||||
| pkgs.arocc or fallback | ||||||||||
| else if useZig then | ||||||||||
| pkgs.zig.cc or fallback | ||||||||||
| else if useLLVM then | ||||||||||
| pkgs.llvmPackages.clang or fallback | ||||||||||
| else | ||||||||||
| # NOTE: we shouldn't imply GCC, ideally we should either fallback, null, or error. | ||||||||||
| pkgs.gcc or fallback; | ||||||||||
|
|
||||||||||
| # The default C compiler to use, this has been provided by the stdenv for a long time. | ||||||||||
| # However, we're working to move it out of the stdenv. It is recommended to switch to | ||||||||||
| # this attribute and using an "stdenvNoCC" as soon as possible. | ||||||||||
| cc = ccChooser stdenv.targetPlatform pkgs null; | ||||||||||
|
|
||||||||||
| libc = | ||||||||||
| let | ||||||||||
| inherit (stdenv.hostPlatform) libc; | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment looks potentially incomplete? Or at least I don't understand what it is trying to convey beyond the rest of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not incomplete, copies what
libcCrossChoosersays:nixpkgs/pkgs/top-level/all-packages.nix
Lines 8224 to 8226 in 36f6e42