-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
Platform normalization #24610
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
Platform normalization #24610
Changes from all commits
213d29f
b477851
2227789
fffcee3
8c99aab
d86caa3
3efc661
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| rec { | ||
| doubles = import ./doubles.nix; | ||
| parse = import ./parse.nix; | ||
| platforms = import ./platforms.nix; | ||
|
|
||
| # Elaborate a `localSystem` or `crossSystem` so that it contains everything | ||
| # necessary. | ||
| # | ||
| # `parsed` is inferred from args, both because there are two options with one | ||
| # clearly prefered, and to prevent cycles. A simpler fixed point where the RHS | ||
| # always just used `final.*` would fail on both counts. | ||
| elaborate = args: let | ||
| final = { | ||
| # Prefer to parse `config` as it is strictly more informative. | ||
| parsed = parse.mkSystemFromString (if args ? config then args.config else args.system); | ||
|
||
| # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. | ||
| system = parse.doubleFromSystem final.parsed; | ||
| config = parse.tripleFromSystem final.parsed; | ||
| # Just a guess, based on `system` | ||
| platform = platforms.selectBySystem final.system; | ||
| } // args; | ||
| in final; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| let lists = import ../lists.nix; in | ||
| let parse = import ./parse.nix; in | ||
| let inherit (import ../attrsets.nix) matchAttrs; in | ||
|
|
||
| let | ||
| all = [ | ||
| "aarch64-linux" | ||
| "armv5tel-linux" "armv6l-linux" "armv7l-linux" | ||
|
|
||
| "mips64el-linux" | ||
|
|
||
| "i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd" | ||
|
|
||
| "x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux" | ||
| "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris" | ||
| ]; | ||
|
|
||
| allParsed = map parse.mkSystemFromString all; | ||
|
|
||
| filterDoubles = f: map parse.doubleFromSystem (lists.filter f allParsed); | ||
|
|
||
| in rec { | ||
| inherit all; | ||
|
|
||
| allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all; | ||
| none = []; | ||
|
|
||
| arm = filterDoubles (matchAttrs { cpu = { family = "arm"; bits = 32; }; }); | ||
| i686 = filterDoubles parse.isi686; | ||
| mips = filterDoubles (matchAttrs { cpu = { family = "mips"; }; }); | ||
| x86_64 = filterDoubles parse.isx86_64; | ||
|
|
||
| cygwin = filterDoubles (matchAttrs { kernel = parse.kernels.cygwin; }); | ||
| darwin = filterDoubles parse.isDarwin; | ||
| freebsd = filterDoubles (matchAttrs { kernel = parse.kernels.freebsd; }); | ||
| gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); # Should be better | ||
| illumos = filterDoubles (matchAttrs { kernel = parse.kernels.solaris; }); | ||
| linux = filterDoubles parse.isLinux; | ||
| netbsd = filterDoubles (matchAttrs { kernel = parse.kernels.netbsd; }); | ||
| openbsd = filterDoubles (matchAttrs { kernel = parse.kernels.openbsd; }); | ||
| unix = filterDoubles parse.isUnix; | ||
|
|
||
| mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux"]; | ||
| } |
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.
Can we remove the FIXME from the comment now?
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.
Done