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 06:11:03 +01:00
|
|
|
{ lib }:
|
|
|
|
let
|
|
|
|
inherit (lib.systems) parse;
|
|
|
|
inherit (lib.systems.inspect) patterns;
|
|
|
|
|
2018-05-24 16:43:14 +02:00
|
|
|
abis = lib.mapAttrs (_: abi: builtins.removeAttrs abi [ "assertions" ]) parse.abis;
|
|
|
|
|
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 06:11:03 +01:00
|
|
|
in rec {
|
2018-03-20 16:46:12 +01:00
|
|
|
all = [ {} ]; # `{}` matches anything
|
|
|
|
none = [];
|
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 06:11:03 +01:00
|
|
|
|
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 03:41:06 +01:00
|
|
|
arm = [ patterns.isAarch32 ];
|
2018-03-20 03:14:45 +01:00
|
|
|
aarch64 = [ patterns.isAarch64 ];
|
|
|
|
x86 = [ patterns.isx86 ];
|
|
|
|
i686 = [ patterns.isi686 ];
|
|
|
|
x86_64 = [ patterns.isx86_64 ];
|
|
|
|
mips = [ patterns.isMips ];
|
2018-03-24 13:44:26 +01:00
|
|
|
riscv = [ patterns.isRiscV ];
|
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 06:11:03 +01:00
|
|
|
|
2018-03-20 03:14:45 +01:00
|
|
|
cygwin = [ patterns.isCygwin ];
|
|
|
|
darwin = [ patterns.isDarwin ];
|
|
|
|
freebsd = [ patterns.isFreeBSD ];
|
2018-08-28 23:17:54 +02:00
|
|
|
# Should be better, but MinGW is unclear.
|
2018-04-24 22:25:33 +02:00
|
|
|
gnu = [
|
2018-05-29 19:06:17 +02:00
|
|
|
{ kernel = parse.kernels.linux; abi = abis.gnu; }
|
|
|
|
{ kernel = parse.kernels.linux; abi = abis.gnueabi; }
|
|
|
|
{ kernel = parse.kernels.linux; abi = abis.gnueabihf; }
|
2018-04-24 22:25:33 +02:00
|
|
|
];
|
2018-03-20 03:14:45 +01:00
|
|
|
illumos = [ patterns.isSunOS ];
|
|
|
|
linux = [ patterns.isLinux ];
|
|
|
|
netbsd = [ patterns.isNetBSD ];
|
|
|
|
openbsd = [ patterns.isOpenBSD ];
|
|
|
|
unix = patterns.isUnix; # Actually a list
|
2018-03-20 17:31:07 +01:00
|
|
|
windows = [ patterns.isWindows ];
|
2019-01-30 03:01:24 +01:00
|
|
|
wasi = [ patterns.isWasi ];
|
2018-03-20 16:46:12 +01:00
|
|
|
|
|
|
|
inherit (lib.systems.doubles) mesaPlatforms;
|
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 06:11:03 +01:00
|
|
|
}
|