The `platform` field is pointless nesting: it's just stuff that happens to be defined together, and that should be an implementation detail. This instead makes `linux-kernel` and `gcc` top level fields in platform configs. They join `rustc` there [all are optional], which was put there and not in `platform` in anticipation of a change like this. `linux-kernel.arch` in particular also becomes `linuxArch`, to match the other `*Arch`es. The next step after is this to combine the *specific* machines from `lib.systems.platforms` with `lib.systems.examples`, keeping just the "multiplatform" ones for defaulting.
17 lines
642 B
Nix
17 lines
642 B
Nix
{ lib, targetPlatform }:
|
|
|
|
let
|
|
p = targetPlatform.gcc or {}
|
|
// targetPlatform.parsed.abi;
|
|
in lib.concatLists [
|
|
(lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
|
|
(lib.optional (p ? cpu) "--with-cpu=${p.cpu}")
|
|
(lib.optional (p ? abi) "--with-abi=${p.abi}")
|
|
(lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
|
|
(lib.optional (p ? float) "--with-float=${p.float}")
|
|
(lib.optional (p ? mode) "--with-mode=${p.mode}")
|
|
(lib.optional
|
|
(let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit && tp.isLittleEndian)
|
|
"--with-long-double-128")
|
|
]
|