2017-07-29 01:05:35 +01:00
|
|
|
{ lib }:
|
2017-02-09 21:09:47 +00:00
|
|
|
let
|
2017-07-29 01:05:35 +01:00
|
|
|
inherit (lib) lists;
|
2018-01-31 03:10:34 +00:00
|
|
|
inherit (lib.systems) parse;
|
|
|
|
inherit (lib.systems.inspect) predicates;
|
2017-07-29 01:05:35 +01:00
|
|
|
inherit (lib.attrsets) matchAttrs;
|
2017-05-21 18:39:23 +01:00
|
|
|
|
2017-02-09 21:09:47 +00:00
|
|
|
all = [
|
|
|
|
"aarch64-linux"
|
2019-10-01 17:51:57 +01:00
|
|
|
"armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux"
|
2017-02-09 21:09:47 +00:00
|
|
|
|
2017-12-05 10:27:45 +00:00
|
|
|
"mipsel-linux"
|
2017-02-09 21:09:47 +00:00
|
|
|
|
|
|
|
"i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd"
|
|
|
|
|
2019-07-10 19:38:55 +01:00
|
|
|
"x86_64-cygwin" "x86_64-freebsd" "x86_64-linux"
|
2017-02-09 21:09:47 +00:00
|
|
|
"x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris"
|
2018-10-17 03:56:58 +01:00
|
|
|
|
2019-07-10 19:38:55 +01:00
|
|
|
"x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"
|
|
|
|
|
2018-10-17 23:03:00 +01:00
|
|
|
"x86_64-windows" "i686-windows"
|
2019-01-30 02:01:24 +00:00
|
|
|
|
|
|
|
"wasm64-wasi" "wasm32-wasi"
|
2019-04-30 16:50:45 +01:00
|
|
|
|
2020-07-21 21:11:36 +01:00
|
|
|
"x86_64-redox"
|
|
|
|
|
2019-06-04 18:34:40 +01:00
|
|
|
"powerpc64le-linux"
|
|
|
|
|
2019-04-30 16:50:45 +01:00
|
|
|
"riscv32-linux" "riscv64-linux"
|
2019-06-04 18:34:40 +01:00
|
|
|
|
2020-03-12 13:56:17 +00:00
|
|
|
"arm-none" "armv6l-none" "aarch64-none"
|
|
|
|
"avr-none"
|
|
|
|
"i686-none" "x86_64-none"
|
|
|
|
"powerpc-none"
|
|
|
|
"msp430-none"
|
|
|
|
"riscv64-none" "riscv32-none"
|
|
|
|
"vc4-none"
|
2019-11-24 23:07:20 +00:00
|
|
|
|
|
|
|
"js-ghcjs"
|
2020-03-24 08:02:18 +00:00
|
|
|
|
2020-08-04 16:50:55 +01:00
|
|
|
"aarch64-genode" "i686-genode" "x86_64-genode"
|
2017-02-09 21:09:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
allParsed = map parse.mkSystemFromString all;
|
|
|
|
|
|
|
|
filterDoubles = f: map parse.doubleFromSystem (lists.filter f allParsed);
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
in {
|
2017-02-09 21:09:47 +00:00
|
|
|
inherit all;
|
2009-09-23 20:45:02 +01:00
|
|
|
|
2016-02-26 18:53:03 +00:00
|
|
|
none = [];
|
|
|
|
|
treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.
The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:
```
ISA: ARMv8 {-A, -R, -M}
/ \
Mode: Aarch32 Aarch64
| / \
Encoding: A64 A32 T32
```
At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.
The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.
[1]: https://developer.arm.com/products/architecture/a-profile
2018-03-20 02:41:06 +00:00
|
|
|
arm = filterDoubles predicates.isAarch32;
|
2018-03-13 22:00:52 +00:00
|
|
|
aarch64 = filterDoubles predicates.isAarch64;
|
|
|
|
x86 = filterDoubles predicates.isx86;
|
2017-05-21 18:39:23 +01:00
|
|
|
i686 = filterDoubles predicates.isi686;
|
|
|
|
x86_64 = filterDoubles predicates.isx86_64;
|
lib, stdenv: Check `meta.platforms` against host platform and be open world
First, we need check against the host platform, not the build platform.
That's simple enough.
Second, we move away from exahustive finite case analysis (i.e.
exhaustively listing all platforms the package builds on). That only
work in a closed-world setting, where we know all platforms we might
build one. But with cross compilation, we may be building for arbitrary
platforms, So we need fancier filters. This is the closed world to open
world change.
The solution is instead of having a list of systems (strings in the form
"foo-bar"), we have a list of of systems or "patterns", i.e. attributes
that partially match the output of the parsers in `lib.systems.parse`.
The "check meta" logic treats the systems strings as an exact whitelist
just as before, but treats the patterns as a fuzzy whitelist,
intersecting the actual `hostPlatform` with the pattern and then
checking for equality. (This is done using `matchAttrs`).
The default convenience lists for `meta.platforms` are now changed to be
lists of patterns (usually a single pattern) in
`lib/systems/for-meta.nix` for maximum flexibility under this new
system.
Fixes #30902
2018-01-31 05:11:03 +00:00
|
|
|
mips = filterDoubles predicates.isMips;
|
2019-04-30 16:50:45 +01:00
|
|
|
riscv = filterDoubles predicates.isRiscV;
|
2019-11-02 15:47:38 +00:00
|
|
|
vc4 = filterDoubles predicates.isVc4;
|
2019-11-25 14:09:50 +00:00
|
|
|
js = filterDoubles predicates.isJavaScript;
|
2017-05-21 18:39:23 +01:00
|
|
|
|
|
|
|
cygwin = filterDoubles predicates.isCygwin;
|
|
|
|
darwin = filterDoubles predicates.isDarwin;
|
|
|
|
freebsd = filterDoubles predicates.isFreeBSD;
|
2018-08-28 22:17:54 +01:00
|
|
|
# Should be better, but MinGW is unclear.
|
2018-10-18 20:12:49 +01:00
|
|
|
gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; });
|
2017-05-21 18:39:23 +01:00
|
|
|
illumos = filterDoubles predicates.isSunOS;
|
|
|
|
linux = filterDoubles predicates.isLinux;
|
|
|
|
netbsd = filterDoubles predicates.isNetBSD;
|
|
|
|
openbsd = filterDoubles predicates.isOpenBSD;
|
|
|
|
unix = filterDoubles predicates.isUnix;
|
2019-01-30 02:01:24 +00:00
|
|
|
wasi = filterDoubles predicates.isWasi;
|
2020-07-21 21:11:36 +01:00
|
|
|
redox = filterDoubles predicates.isRedox;
|
2018-10-17 03:56:58 +01:00
|
|
|
windows = filterDoubles predicates.isWindows;
|
2020-03-24 08:02:18 +00:00
|
|
|
genode = filterDoubles predicates.isGenode;
|
2016-02-26 18:53:03 +00:00
|
|
|
|
2019-06-04 19:49:58 +01:00
|
|
|
embedded = filterDoubles predicates.isNone;
|
|
|
|
|
2019-02-22 02:02:59 +00:00
|
|
|
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"];
|
2009-08-25 09:28:08 +01:00
|
|
|
}
|