Commit Graph

436 Commits

Author SHA1 Message Date
Adam Joseph
8c0416ef36 lib.systems.inspect: add patternLogicalAnd 2023-11-05 00:55:16 +00:00
Adam Joseph
72c279f477 lib.systems, test.cross.sanity: add test case for #264989
We have several cross-compilation bugs that show up if
hostPlatform!=buildPlatform yet
hostPlatform.config==buildPlatform.config.

These bugs have appeared and disappeared as we've fiddled with the
definition of equality for platform objects.  This commit adds a
clear-cut case where they are *not* equal and never will be, so we
can test it.
2023-11-04 05:57:34 +00:00
Adam Joseph
20b62456f0 lib/systems/parse.nix: add, use removeAbiSuffix
gnu-config will ignore the portion of a triple matching the regex
`e?abi.*$` when determining the validity of a triple.  In other
words, `i386-linuxabichickenlips` is a valid triple.

This commit updates our parsing routines to match gnu-config.

I was recently surprised to discover that it is in fact possible to
shoehorn ABI flavors into nix doubles in a way which preserves their
property of being a (non-canonical) subset of the valid gnu-config
triples.  This commit is required in order to exploit that discovery
to add automatic detection of ILP32 platforms (64-bit void*, 32-bit
int, like the Apple Watch and MIPS n32) to Nix.
2023-10-22 17:05:05 -07:00
Artturi
bf25d8782b
Merge pull request #249069 from amjoseph-nixpkgs/pr/lib/systems/ubootArch
lib.systems: add ubootArch
2023-09-30 10:45:36 +03:00
Artturi
6f300706ef
Merge pull request #247077 from jmbaur/aarch64-embedded-rustc 2023-09-23 06:30:47 +03:00
Artturi
aeaa0a7be9
Merge pull request #247288 from amjoseph-nixpkgs/pr/lib/systems/qemu-mips64n32 2023-09-21 03:06:24 +03:00
Moritz Angermann
1e0561d78a nixpkgs/systems: Add ucrt64 as MinGW libc
The Minimalist Gnu for Windows distribution comes with support for
the traditional msvcrt libc, as well as ucrt64 libc. The latter
being the newer universal compiler runtime. We follow the msys2
environment naming convention[1]:

| name       | toolchain | arch    | libc   | libc++    |
|------------|-----------|---------|--------|-----------|
| mingw32    | gcc       | i686    | msvcrt | libstdc++ |
| mingw64    | gcc       | x86_64  | msvcrt | libstdc++ |
| ucrt64     | gcc       | x86_64  | ucrt   | libstdc++ |
| clang32    | llvm      | i686    | ucrt   | libc++    |
| clang64    | llvm      | x86_64  | ucrt   | libc++    |
| clangarm64 | llvm      | aarch64 | ucrt   | libc++    |

For now nixpkgs only supports the first three with this commit.

--
[1]: https://www.msys2.org/docs/environments/
2023-09-08 10:56:08 +00:00
Artturin
5472b08075 lib/systems: disable pipewireSupport in qemu-user
Option added in 5b0ed68c10

it causes infinite recursion in cross builds

There's a another inf rec that needs 6946977de0 which is in staging
2023-09-08 00:23:19 +03:00
John Ericson
c6590b61e1
Merge pull request #238509 from amjoseph-nixpkgs/pr/knuth/respect
lib/systems/parse.nix: show respect where deserved
2023-08-16 11:14:12 -04:00
Adam Joseph
a0c77aecaa lib.systems: add ubootArch
u-boot has its own rosetta stone, almost but not exactly the same as
the Linux kernel's.  This commit adds it and the two cases where it
diverges.
2023-08-14 01:34:07 -07:00
Adam Joseph
8a543acc2b lib.systems: add qemu's funky custom name for mips n32
Qemu's name for mips64[el] using the n32 ABI is "mipsn32[el]".
That's the first time I've seen that name for it.  Oh well.
2023-08-05 00:24:17 -07:00
Jared Baur
aca7042069
lib/systems: Add rustc config for aarch64-embedded
The target aarch64-none-elf is not a valid rustc target, use
aarch64-unknown-none instead.
2023-08-03 23:35:38 -07:00
Adam Joseph
057d63a797
Merge pull request #244330 from thillux/bluefield2-remove-cpu
lib.systems.bluefield2: remove cpu profile
2023-07-24 05:50:46 +00:00
Markus Theil
e43792e88d lib.systems.bluefield2: remove cpu profile
Some software, e.g. systemd, failed to build with set cpu
profile.

Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-19 13:38:43 +02:00
Markus Theil
f6f0ccd6c9 lib.systems.bluefield2: init
Add support for Nvidia's Bluefield 2 plattform as a compilation
target. There exists a version with and without crypto support,
while the crypto supported version is the most common one.

Support for the non-crypto version can be easily added in the future,
if needed.

For a datasheet of the hardware, see:

https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/documents/datasheet-nvidia-bluefield-2-dpu.pdf

Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-14 11:19:11 +02:00
Adam Joseph
218669e143
Merge pull request #238154 from amjoseph-nixpkgs/pr/gcc/crossStageStatic
gccCrossStageStatic: enable dynamic libraries, rename it
2023-07-12 23:30:43 +00:00
Ryan Burns
2964b720de
Merge pull request #240825 from r-burns/mips-embedded
lib.platforms.mips{,64}-embedded: init
2023-07-05 21:26:47 -07:00
Artturi
359e1136a6
Merge pull request #239120 from LibreCybernetics/arch-stuff 2023-07-05 00:20:25 +03:00
Adam Joseph
d278fd78af lib.systems.extensions.sharedLibrary: do not throw
Because downstream code expects to use `==` on platform attrsets, we
are unfortunately not able to throw a useful error message when the
`sharedLibrary` attribute is accessed.

When users do a comparison like:

  stdenv.hostPlatform == pkgsStatic.stdenv.hostPlatform

... in a situation where `stdenv.hostPlatform.hasSharedLibraries`,
they expect this to return `false`.  Unfortunately Nix does a deep
equality comparison here, and ends up forcing the
`pkgsStatic.stdenv.hostPlatform.extensions.sharedLibrary` attribute,
which throws the error.

Rather than returning `null`, this commit instead simply omits the
`extensions.sharedLibrary` attribute.  This provides the user with a
more-useful error message: instead of waiting until the `null` is
used (and hoping that produces an error), the user will get an error
about the `extensions.sharedLibrary` attribute being missing, at the
position where it was referenced.

Big thanks to @trofi for his PR to add
`NIX_VALIDATE_EVAL_NONDETERMINISM` to Nix, which I am now using.  It
made tracking this down really easy!

Fixes #244045
2023-07-04 13:39:19 -07:00
Adam Joseph
6980e6b35a lib.systems: introduce hasSharedLibraries
This commit adds `hasSharedLibraries` to `lib.systems`.

We need `plat.hasSharedLibraries` in order to know whether or not to
expect `gcc` (and many other tools) to emit shared libraries (like
`libgcc_s.so`).  Many of the GNU build scripts are smart enough that
if you configure them with `--enable-shared` on a platform (such as
`arm-none-eabi`) that doesn't support dynamic linking, they will
simply skip the shared libraries instead of aborting the
`configurePhase`.  Unfortunately the missing shared libraries in the
final build product cause very hard-to-troubleshoot problems later
on.

The alternative to introducing `hasSharedLibraries` would be to set
`isStatic` in these situations.  However doing so causes
`make-derivation.nix` to insert `-static` between the `pname` and
`hostPlatform` suffix, which is undesirable.

If at some point in the future we eliminate the `-static` suffix,
then `hasSharedLibraries` can be made equal to `!isStatic`.
2023-07-01 13:12:22 -07:00
Ryan Burns
c8ae88d97b lib.platforms.mips{,64}-embedded: init 2023-06-30 18:19:00 -07:00
Adam Joseph
4cb579b536 lib.systems: add gnuabin32 to isGnu
The `isGnu` predicate was missing `gnuabin32`.  This commit corrects
that by adding it.
2023-06-29 12:26:12 -07:00
Fabián Heredia Montiel
79dfc50bb8 lib.systems.architectures: add microarchitecture levels
Variation on:
- https://github.com/NixOS/nixpkgs/pull/208398
- https://github.com/NixOS/nixpkgs/pull/224978

Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
Co-authored-by: Shawn8901 <shawn8901@googlemail.com>
Co-authored-by: AveryanAlex <alex@averyan.ru>
2023-06-24 00:50:40 -06:00
Adam Joseph
00a749a3a6 lib/system: move toLosslessStringMaybe into lib/tests
toLosslessStringMaybe is not used by anything other than lib/tests,
so it can be private to that file.

I don't think this function was terribly well thought-through.  If
people start using it, we will become permanently dependent on the
ability to test platforms for equality.  It also makes the
elaboration process more fragile, because it encourages code outside
of nixpkgs to become sensitive to the minute details of how
elaboration happens.
2023-06-22 00:18:33 -07:00
Sandro
9a670fec3b
Merge pull request #237167 from CHN-beta/master 2023-06-19 14:14:03 +02:00
Adam Joseph
92939f4ce2 lib/systems/parse.nix: show respect where deserved
The eminent Donald E. Knuth should be recognized as having equal
standing with such entities as IBM, Apple, and the Personal
Computer.  We should acknowledge this by including him as a "vendor".

Also, `gnu-config` recognizes `mmix-knuth-*` triples (and in fact
requires `vendor="knuth"` when `cpu="mmix"`) -- so we sort of have
to.  But we should do it anyways.
2023-06-18 21:02:46 -07:00
Adam Joseph
6c9be0bf7a lib/systems: remove redundant test from selectEmulator
Commit eef4bbd82f changed the conditional in selectEmulator from
`isCompatible` (which examines only the CPU, rather than the entire
platform) to `canExecute`.  This made the first conjunct redundant.
Let's drop the redundant part.

https://github.com/NixOS/nixpkgs/pull/238331#discussion_r1233277119
2023-06-18 14:39:09 -07:00
Fabián Heredia Montiel
1b7776a3fb lib.systems: add znver4 architecture 2023-06-16 13:47:10 -06:00
Robert Hensing
144018541b lib.systems.equals: Ignore all function attributes reflectively
Co-authored-by: Artturi <Artturin@artturin.com>
2023-06-13 10:22:06 +02:00
Robert Hensing
18c7f6237f lib.systems.{equals,toLosslessStringMaybe}: init 2023-06-13 10:17:02 +02:00
chn
a41e973062 stdenv: add alderlake support
Signed-off-by: Haonan Chen <chn@chn.moe>
2023-06-11 21:11:03 +08:00
Alyssa Ross
4e80f80864 lib.systems.doubles: add big-endian MIPS linux doubles
We already have examples for these, but since we didn't actually
recognise the doubles, it wasn't possible to build any packages for
them without setting allowUnsupportedSystem.
2023-06-01 10:42:27 +00:00
Alyssa Ross
94d9a6ce17 lib.systems: remove mipsisa(32|64)r6 triples
These arc the same as the normal triples apart for a difference in
-march, so there's no need for them to be separate triples.
2023-06-01 10:42:27 +00:00
Alyssa Ross
91488fb6db
lib.systems: remove (accidental?) rust/rustc alias
I imagine this was supposed to be rustc = args.rustc, like the other
two lines.  This meant that we accepted both rust and rustc
attributes, with the same effect.  I doubt anybody was using the
undocumented, probably-accidental "rust" spelling, but we should
remove it before somebody starts.

In fact, we don't need to set rustc here at all, because no value
platforms.select could return will ever include a rustc key (unlike
the other two), so then rustc will be filled in later, when args is
merged into final.
2023-05-09 17:49:05 +00:00
Adam Joseph
89325a10b0
Merge pull request #228013 from amjoseph-nixpkgs/pr/qemuArch/mips
lib/systems: add mips64[el] entries to qemuArch
2023-05-09 06:39:13 +00:00
github-actions[bot]
bf19e21376
Merge master into staging-next 2023-05-04 12:01:18 +00:00
Weijia Wang
1348f199a5 lib/systems: move loongarch64-linux out of mips block 2023-05-04 09:52:01 +03:00
github-actions[bot]
e1fd5ee13e
Merge staging-next into staging 2023-04-28 12:01:49 +00:00
Weijia Wang
b2ef7956b6
Merge pull request #227560 from jackyliu16/loongnix-commit
lib.platforms.loongarch64: init
2023-04-28 13:21:42 +03:00
Alyssa Ross
e5d1511d5b lib.systems: allow specifying libc = null
It makes sense to allow platform definitions to opt out of having libc
at all.  One use case would be targetting some obscure new Linux
target that doesn't have a libc implementation yet, and another is
UEFI, which is basically libc-less Windows.

Not having libc is not commonly specified in (GNU) triples (even
Linux's build system will just target either -gnu or -musl depending
on the platform), so instead, we use a separate attribute for it.
2023-04-28 10:01:22 +00:00
jackyliu16
edcad332d9 lib.platforms.loongarch64: init 2023-04-27 20:04:30 +03:00
Adam Joseph
7001445909 lib/systems: add mips64[el] entries to qemuArch
This commit adds `mips64el` to the `qemuArch` table.
2023-04-24 13:17:45 -07:00
Adam Joseph
ed65f784a7
Merge pull request #191995 from amjoseph-nixpkgs/lib/systems/inspect/comment
lib/systems/inspect.nix: explanatory comment
2023-04-24 02:21:36 +00:00
Artturin
06e8d82e9c lib/systems: disable docs in qemu-user
45M -> 31M
2023-04-22 00:38:56 +03:00
github-actions[bot]
bf7ad8aa57
Merge master into haskell-updates 2023-03-10 00:14:11 +00:00
Alyssa Ross
bc7d355dc0 lib.systems: don't try to emulate s390-linux
We don't have an emulator that can do this.
2023-03-09 19:25:23 +00:00
sternenseemann
471b9cab41 haskell.compiler.ghcHEAD: 9.7.20221224 -> 9.7.20230217
- Christmas is over!

- Upstream has changed the name of the target triplet used for the JS
  backend from js-unknown-ghcjs to javascript-unknown-ghcjs, since Cabal
  calls the architecture "javascript":
  6636b67023

  Since the triplet is made up anyways, i.e. autoconf does not support
  it and Rust uses different triplets for its emscripten backends, we'll
  just change it as well.

- Upstream fixed the problem with ar(1) being invoked incorrectly by stage0:
  e987e345c8
2023-03-08 17:12:18 +01:00
Atemu
19e81a9269
Merge pull request #211950 from Atemu/armv8-no-more-armv7
lib/systems/parse: stop considering armv8a able to execute armv7l
2023-03-07 19:25:32 +01:00
Sandro
d05e6727a2
Merge pull request #203539 from SuperSandro2000/architectures-expand-inferiors
lib/systems/architectures: expand inferiors
2023-02-15 16:27:00 +01:00
github-actions[bot]
dd1ff149da
Merge master into staging-next 2023-01-31 00:02:31 +00:00