3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

377 commits

Author SHA1 Message Date
Alyssa Ross 6d165a9474
lib.platforms.s390x: init 2023-01-19 17:43:50 +00:00
Alyssa Ross 541a2a5e91
lib.platforms.power: init 2023-01-19 17:43:49 +00:00
Alyssa Ross 48f3fd2d49
lib.platforms.armv7: init 2023-01-19 17:43:41 +00:00
Nick Cao 35bede2be5
Merge pull request #184521 from dramforever/riscv-isefi
lib/systems/inspect.nix: Add riscv to isEfi
2023-01-13 14:28:11 +08:00
Adam Joseph 06939ff3de add mipsisa{32,64}r6[el], closes 209952 2023-01-09 16:04:16 -08:00
Martin Weinelt b38111a665
Merge pull request #208698 from amjoseph-nixpkgs/pr/nss/ilp32 2023-01-03 07:00:45 +01:00
Adam Joseph 14f337afb6 lib/systems/inspect.nix: add isILP32 predicate
I've run into a few packages that need an extra flag on platforms
where `int` has more bits than `void*` does.  I know of three such
platforms:

* [aarch64ilp32], used on both Linux and also on the [Apple Watch]
* [x32], the x86 ILP32 ABI
* [mips64n32], used on [Longsoon] and Cavium Octeon routers.

This PR introduces a predicate so the package flags can be added in
a generic way.

[Apple Watch]: https://gist.github.com/woachk/943828f37c14563a607a26116435bf27#watch
[mips64n32]: https://en.wikipedia.org/wiki/MIPS_architecture#Calling_conventions
[Longsoon]: https://en.wikipedia.org/wiki/Loongson
[x32]: https://en.wikipedia.org/wiki/X32_ABI
2023-01-01 17:16:06 -08:00
Adam Joseph de88969f12 lib/systems: fix uname.processor for powerpc{32,64}, mips64
Cross-compilation of anything downstream of gtk3 requires qemu (due to
gobject-introspection) with --target-list=*-linux-user.  Without this commit,
those qemu builds will fail on a powerpc64le host due to qemu being configured
with --cpu=powerpc64le instead of --cpu=ppc64le.  Unfortunately the build
failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that
on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le)
for the cpu instead of the linux-name (ppc64le) for the cpu.

uname.processor on mips64el also needs adjustment -- the Linux-name is "mips64"
for both big and little endian (unlike powerpc64, where the Linux-name includes
a "le" suffix):

```
nix@oak:/tmp$ uname -m; lscpu | head -n2
mips64
Architecture:        mips64
Byte Order:          Little Endian
```

uname.processor on powerpc32 has also been adjusted.
2023-01-01 16:20:50 -08:00
figsoda 695d4bc76b lib: fix typos 2022-12-17 18:59:29 -05:00
John Ericson 2cb8f1a0ac
Merge pull request #180964 from amjoseph-nixpkgs/pr/mkSkeletonFromList/simplify
lib/systems/parse.nix: mkSkeletonFromList: improve readability
2022-11-22 15:02:22 -05:00
Artturi 20fc948445
Merge pull request #170737 from amjoseph-nixpkgs/fix-mips32-detection
lib/systems/platforms.nix: fix broken mips32 detection
2022-11-21 19:40:18 +02:00
Adam Joseph 36a566b78f lib/systems/parse.nix: mkSkeletonFromList: improve readability
The main purpose of this PR is to make the basis for
`mkSkeletonFromList`'s decision between `cpu-kernel-libcabi` vs
`cpu-vendor-os` clear, without changing its behavior.  The existing
code obscures this decision behind a sequence of prioritized matches
(i.e. `if-then`) which jump around between different coordinates.

Two side benefits of this PR:

1. It makes the root cause of #165836 obvious: we are missing a case
   for `cpu-vendor-libcabi`.  This is why nixpkgs stumbles over
   `*-none-*`.

2. It illuminates some very weird corner cases in the existing
   logic, like `*-${vendor}-ghcjs` overriding the `vendor` field,
   and `mingw32` being transformed into `windows` in some cases.

Co-authored-by: John Ericson <git@JohnEricson.me>
2022-11-13 23:08:57 -08:00
John Ericson cd27a5b436
Merge pull request #82131 from Ericson2314/bsd-cross
FreeBSD packages: Init at 13.1
2022-11-13 21:35:17 -05:00
Jörg Thalheim 87f4f101d7 cross/mingw: fix emulator for mingw32 2022-11-06 20:29:37 +01:00
John Ericson 66aa02f190 lib/systems: Support FreeBSD
A tricky thing about FreeBSD is that there is no stable ABI across
versions. That means that putting in the version as part of the config
string is paramount.

We have a parsed represenation that separates name versus version to
accomplish this. We include FreeBSD versions 12 and 13 to demonstrate
how it works.
2022-11-04 16:49:28 -04:00
John Ericson f172d86a4e lib/systems: Simplify NetBSD examples
The libc will be inferred.
2022-11-04 16:49:28 -04:00
Ivan Nikolaenko f251840237 lib/systems/default.nix: add efiArch suffixes
Move already implemented functionality to the upper level so
it could be used in a more generic way.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
2022-09-29 08:02:35 +00:00
Artturi d73864ae2f
Merge pull request #189314 from Artturin/addemulatoravailable 2022-09-13 21:13:07 +03:00
Artturin 20f90d3921 lib/systems: add emulatorAvailable
```
nix-repl> pkgsCross.arm-embedded.stdenv.hostPlatform.emulatorAvailable pkgsCross.arm-embedded.buildPackages
false

nix-repl> pkgsCross.aarch64-multiplatform.stdenv.hostPlatform.emulatorAvailable pkgsCross.aarch64-multiplatform.buildPackages
true
```

will be useful for stuff like handling https://github.com/NixOS/nixpkgs/issues/187109
2022-09-11 19:34:15 +03:00
Adam Joseph ba3c562fdc
lib/systems: uname.processor is "uname -m", not "uname -p" (#189958)
The comment in lib/systems/default.nix for uname.processor indicates that it
should match `uname -p`.  I tried that command and found that it reports
`unknown` on all of these machines:

- `x86_64-linux`
- `aarch64-linux`
- `mips64el-linux`
- `powerpc64le-linux`

The command `uname -m` reports the expected value on all of the above.

I think the comment is wrong.  So I fixed it.
2022-09-06 10:17:09 -05:00
Minijackson b2190a3cce lib/systems/doubles: add ELFvx GNU ABIs 2022-08-28 21:46:44 +02:00
Minijackson 345595a8b8 lib/systems: add convenience isAbiElfv2 function 2022-08-28 21:46:44 +02:00
Minijackson cdb0f02a36 lib/systems/examples: use provided ABIs in PPC64 triple 2022-08-28 21:46:44 +02:00
Minijackson 3fa4274ff6 lib/systems/parse: use ELFv2 by default for PPC64 BE 2022-08-28 21:46:44 +02:00
Minijackson da2d9a2aca lib/systems: add elfv1 / elfv2 ABIs 2022-08-28 21:46:44 +02:00
Minijackson 4db467f7e9
lib/systems: add MicroBlaze architectures 2022-08-25 16:00:42 +02:00
Daniel Olsen 875d77ca03 lib/systems: Add staticLibrary and library
staticLibrary includes common extensions for static libraries
library is a new common attribute that includes both shared and static extensions
2022-08-16 08:36:57 +00:00
Sandro 7c073f917a
lib/system: resolve TODO 2022-08-02 14:13:18 +02:00
dramforever 584cfd8caa lib/systems/inspect.nix: Add riscv to isEfi
EFI boot on RISC-V is supported by GRUB and systemd-boot. Add them to
isEfi to reflect this fact.
2022-08-01 16:43:55 +08:00
Sandro 463327086d lib/systems/inspect.nix: add isAarch 2022-07-29 19:16:01 +00:00
Vladimír Čunát 87980a5a14
Merge #170736: lib/systems/platforms.nix: fix mips32 ABI 2022-07-27 19:53:38 +02:00
Rick van Schijndel 9532db9eb7
Merge pull request #160554 from Cloudef/android-prebuilt
Fix android prebuilt toolchains
2022-07-18 10:01:00 +02:00
Alyssa Ross e8d7d52fae lib.systems.examples: canonicalize MIPS triples
In Nixpkgs, we assume that the "config" field is a canonicalized GNU
triple.  I noticed that non-canonical values were being used here,
because the pkgsCross.mips64el-linux-gnu triples did not contain the
vendor field, but the pkgsCross.mips64el-linux-gnu.pkgsStatic did.

Here, I've run all the MIPS triples in lib.systems.examples through
config.sub to canonicalize them.  I think this will avoid nasty
surprises in future.

Tested by building Nix and the bootstrap files for
pkgsCross.mips64el-linux-gnu.
2022-07-03 23:01:21 +00:00
Jari Vetoniemi 539222e8d4 canExecute: check for android 2022-06-29 18:27:16 +09:00
Jari Vetoniemi 2a914f022c update android targets to recommended ones 2022-06-29 18:27:16 +09:00
Alyssa Ross 74562a214e
lib.systems.amd64-netbsd: remove
This has been deprecated for a long time, and it's doubtful it had any
users to start with.  And having an undisablable warning when
enumarating platforms is not good.
2022-06-08 17:14:05 +00:00
sternenseemann d01774baa3
Merge pull request #174917 from alyssais/scaleway-c1
lib.systems: drop scaleway-c1
2022-05-27 14:52:42 +02:00
Alyssa Ross 089ff89f49
lib.systems: drop scaleway-c1
These servers apparently no longer exist, since September 2, 2021[1].
If somebody needs this for non-Scaleway machines, they should suggest
its reintroduction with a different name.

[1]: https://news.ycombinator.com/item?id=27192757
2022-05-27 12:02:39 +00:00
Adam Joseph c0085404bd lib/systems/inspect.nix: remove isPowerPC
Very confusingly, the `isPowerPC` predicate in
`lib/systems/inspect.nix` does *not* match `powerpc64le`!

This is because `isPowerPC` is defined as

  isPowerPC      = { cpu = cpuTypes.powerpc; };

Where `cpuTypes.powerpc` is:

  { bits = 32; significantByte = bigEndian; family = "power"; };

This means that the `isPowerPC` predicate actually only matches the
subset of machines marketed under this name which happen to be 32-bit
and running in big-endian mode which is equivalent to:

  with stdenv.hostPlatform; isPower && isBigEndian && is32bit

This seems like a sharp edge that people could easily cut themselves
on.  In fact, that has already happened: in
`linux/kernel/common-config.nix` there is a test which will always
fail:

  (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit)

A more subtle case of the strict isPowerPC being used instead of the
moreg general isPower accidentally are the GHC expressions:

  Update pkgs/development/compilers/ghc/8.10.7.nix
  Update pkgs/development/compilers/ghc/8.8.4.nix
  Update pkgs/development/compilers/ghc/9.2.2.nix
  Update pkgs/development/compilers/ghc/9.0.2.nix
  Update pkgs/development/compilers/ghc/head.nix

Since the remaining legitimate use sites of isPowerPC are so few, remove
the isPowerPC predicate completely. The alternative expression above is
noted in the release notes as an alternative.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2022-05-25 09:45:42 +02:00
Nick Cao eef4bbd82f
stdenv: fix evaluation of platform emulator 2022-05-24 12:01:56 +08:00
sternenseemann 82c434b3de lib.systems: inform isCompatible users about removal 2022-05-23 21:26:03 +02:00
sternenseemann acb063701a lib.systems.elaborate: expose canExecute predicate over isCompatible
canExecute is like isCompatible, but also checks that the Kernels are
_equal_, i.e. that both platforms use the same syscall interface. This
is crucial in order to actually be able to execute binaries for the
other platform.

isCompatible is dropped, since it has changed semantically and there's
no use case left in nixpkgs.
2022-05-23 21:25:04 +02:00
sternenseemann fe836f3564 lib/systems/parse: don't consider mode switching CPUs compatible
Since we (exclusively) use isCompatible to gauge whether platform a can
execute binaries built for platform b, mode switching CPUs are not to be
considered compatible for our purposes: Switching the mode of a CPU
usually requires a reset. At the very least we can't execute a mix of
executables for the two modes which would usually be the case in nixpkgs
where we may want to execute buildInputs for the hostPlatform in
addition to nativeBuildInputs for the buildPlatform.
2022-05-23 21:25:04 +02:00
sternenseemann 168b926435 lib.systems: remove supported, replace with flakeExposed
Since the list only gates the platforms the nixpkgs flake exposes
packages to build on, the `hydra` label made little sense. It was also
only used for this purpose, so the `tier*` attributes were largely
unnecessary.

To reflect the intention more accurately, we expose
`lib.systems.flakeExposed` and use it to gate flake.nix's system list.
2022-05-23 15:27:30 +02:00
yvt bf139d83ec
systems: support cross-compiling for Renesas RX microcontrollers (#173858) 2022-05-22 20:52:36 -04:00
Rick van Schijndel b9e8ed239f
Merge pull request #161156 from a-m-joseph/abort-on-failed-platform-detection-instead-of-silently-assuming-pc
platforms.nix: use {} on failed detection instead of silently assuming pc
2022-05-04 05:37:16 +02:00
Adam Joseph 006c38fa53 platforms.nix: use {} on failed detection instead of silently assuming pc
This patch causes the autodetection code in lib/systems/platforms.nix
to return {} if it cannot detect the platform and one of the
platform.nix-detection-provided attributes (linux-kernel, gcc, and
rustc) are accessed, rather than silently assuming the "pc" platform
as was previously done.

It is definitely safe to assume that code using these attributes is
prepared to deal with `gcc` and `rustc` not being defined, because
many of the working entries in this file don't define it.

Regarding `linux-kernel` the situation is less certain, but some code
(`lib/systems/default.nix` for example) is already designed to deal
with that attribute being missing.  At worst it would result in an
"attribute not found" error.

While adding mips64el bootstrap support to nixpkgs, the silent
assumption that mips64el routers are actually Intel PCs caused
significant frustration.  This commit removes that assumption in order
to save people who port nixpkgs to new platforms in the future from
this frustration.
2022-05-03 13:31:41 -07:00
Adam Joseph 4d46ee8691 platforms.nix: use inherit syntax 2022-04-28 03:52:15 -07:00
Alyssa Ross 2a6288d9b9 lib.systems: add riscv{32,64} sets and filters
For other platforms like Intel and ARM, we can do
e.g. lib.platforms.aarch64 to get only the 64-bit ARM platorms, but
until now there were no equivalents for RISC-V.
2022-04-28 08:17:02 +00:00
Adam Joseph eabc6d2902 lib/systems/platforms.nix: fix broken mips32 detection
Prior to this commit, nixpkgs would assume that every little-endian
mips32 system was a "fuloong2f_n32".

Not only are there plenty of mips32 chips other than the fuloong, but
the fuloong is actually a mips64 chip!  Note that the "n32" ABI is
(confusingly) an ABI for 64-bit mips chips (like the "x32" ABI for
amd64 chips -- both are ABIs which use 32-bit pointers on an
otherwise-64-bit system).

This error causes far-ranging problems.  One of them was particularly
difficult to track down: it caused GCC to select 128-bit `long double`
types, which is invalid for the mips32 ABI.  This isn't noticed until
you try to build musl-libc, which is careful to check for these things.

Prior to this commit,

  nix-build . -A pkgsCross.mipsel-linux-gnu.pkgsStatic.hello

would fail.  With this commit and #170736, it succeeds.
2022-04-27 23:49:09 -07:00