Commit graph

302 commits

Author SHA1 Message Date
John Ericson 2c5d915200 Merge commit '92b7a814f26ee1d37e989431c18518c67285a332' into staging 2018-05-13 01:02:09 -04:00
John Ericson 92b7a814f2 Merge branch 'fix-gcc-with-float' 2018-05-12 15:21:30 -04:00
John Ericson f2004e6287 lib: Fix float handling for Aarch32
Forgot to adjust default so abi with explicit float attr would be used.
2018-05-12 15:18:31 -04:00
John Ericson 6f40d18d44 prebuilt android cc: Edit wrapper to pass the right -m flags for armv7a
(cherry picked from commit 827ef09140)
2018-05-12 15:16:16 -04:00
John Ericson 6a96dc0417 lib/system: Remove float from androideabi
There are two different official variations which differ in their float
support, so such a blanket statement is invalid.
`lib.systems.platforms.*android` already handles each case correctly.

Correcting an error in 827ef09140.
2018-05-11 20:16:28 -04:00
John Ericson 827ef09140 prebuilt android cc: Edit wrapper to pass the right -m flags for armv7a 2018-05-11 19:17:35 -04:00
John Ericson 28bacc2093 lib/systems: Add assertion to "android" ABI
This is analogous to the GNU assertion.
2018-05-11 19:03:07 -04:00
John Ericson f4de669777 lib/systems/inspect: Fix after assertions
Function are never equal in Nix, so we need to filter out this attribute
in ABIs.
2018-05-11 19:02:50 -04:00
John Ericson 98a1b89945
Merge pull request #40385 from obsidiansystems/lib-android-platforms
lib: Add 32-bit Android platforms
2018-05-11 19:01:22 -04:00
John Ericson e3f6c6d18d lib: Add 32-bit Android platforms 2018-05-11 18:41:55 -04:00
John Ericson 81387c2e78 Merge remote-tracking branch 'upstream/master' into staging 2018-05-11 17:12:04 -04:00
John Ericson 0a77a72895
Merge pull request #40378 from obsidiansystems/lib-platform-sort
lib/systems: Sort platforms, and space CPUs
2018-05-11 17:10:49 -04:00
John Ericson 341794a4b9 lib/systems: Sort platforms, and space CPUs 2018-05-11 15:02:18 -04:00
John Ericson ee4b56edd3 Merge remote-tracking branch 'upstream/master' into staging 2018-05-11 14:36:08 -04:00
John Ericson f18ddabee7 Merge remote-tracking branch 'upstream/master' into lib-float 2018-05-10 18:13:00 -04:00
John Ericson 1fe81a4bcd lib: Clean up float/fpu options
ARM ABIs now have a float field. This is used as a fallback to lessen
our use of `platform.gcc.float`. I didn't know what the MIPs convention
is so I kept using `platform.gcc.float` in that case.
2018-05-10 18:02:00 -04:00
John Ericson 67db915a43 Merge remote-tracking branch 'upstream/master' into staging 2018-05-10 16:35:04 -04:00
John Ericson 58b2e875c2 lib/systems: Prohibit "gnu" ABI (*-gnu) with 32-bit ARM
It is ambiguous, and therefore banned within GCC.
2018-05-10 15:05:23 -04:00
John Ericson 006422d08d Merge commit 'feb648ce59ffbed94c58133eb7aa2761992a35e1' into staging 2018-05-10 01:55:26 -04:00
John Ericson feb648ce59 Merge commit '70963b382f3f820ba6d3bc3b3aaf50a2957ec1ff' into lib-platform-simplify 2018-05-10 01:40:38 -04:00
John Ericson a02be2bd85 treewide: Get rid of *Platform.arch
Use `parsed.cpu.name` or `platform.gcc.arch` instead.
2018-05-10 01:37:31 -04:00
John Ericson f063a860d6 xbursttools: Cleanup slightly 2018-05-09 23:40:13 -04:00
John Ericson e42a7a5c0b lib/systems: Add uClibc just like MUSL 2018-05-09 23:39:23 -04:00
John Ericson 3fa0ba9177 lib/systems: Parse more arm cpu types 2018-05-09 18:57:39 -04:00
Ben Gamari 8b32cfdbc0 lib.systems.gnu: Accept gnueabi as a gnu platform 2018-05-03 17:06:01 -04:00
John Ericson db4f96b3cb lib/systems: Fix eval for iphone32* examples
Whoops messed up 9a845de873 slightly.
2018-05-01 13:04:57 -04:00
John Ericson 9a845de873 lib/systems: Update iOS examples
The commented-out configs are @shlevy's old known-good ones. I changed
them as needed to play nice with lib.systems.parse but did not test so
leaving them as comments for now.
2018-05-01 01:16:27 -04:00
John Ericson 57723e947a Merge remote-tracking branch 'upstream/master' into aarch32 2018-04-30 23:06:59 -04:00
John Ericson b9acfb4ecf 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

(cherry picked from commit ba52ae5048)
2018-04-25 15:50:41 -04:00
John Ericson ba52ae5048 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-04-25 15:28:55 -04:00
John Ericson cf0dd1dbd2
Merge pull request #39172 from obsidiansystems/ios-cross
ios-sdk-pkgs: Init from iOS SDK from XCode
2018-04-19 17:00:05 -04:00
Ken Micklas ef3db7d14c ios-sdk-pkgs: Init from iOS SDK from XCode 2018-04-19 16:09:30 -04:00
John Ericson 53686e8995
Merge pull request #38485 from obsidiansystems/nixos-nixpkgs-options
nixpkgs module: Clean up platform options
2018-04-19 14:59:58 -04:00
John Wiegley 4cfdcedb71 Fix a typo: types.openSignifiantByte -> types.openSignificantByte 2018-04-13 18:41:53 -07:00
John Ericson c6f7d43678 nixpkgs module: Clean up platform options
- `localSystem` is added, it strictly supercedes system

 - `crossSystem`'s description mentions `localSystem` (and vice versa).

 - No more weird special casing I don't even understand

TEMP
2018-04-06 12:41:44 -04:00
Shea Levy 26e8d58cb5
libseccomp: Disable only on RISC-V if Linux.
The isSeccomputable flag treated Linux without seccomp as just a
normal variant, when it really should be treated as a special case
incurring complexity debt to support.
2018-03-27 08:16:24 -04:00
Shea Levy cdf9a78a3e
kexectools: Disable only on RISC-V if Linux.
The isKexecable flag treated Linux without kexec as just a normal
variant, when it really should be treated as a special case incurring
complexity debt to support.
2018-03-27 08:15:07 -04:00
Shea Levy 20f51922c0
riscv-pk: Set platforms properly 2018-03-24 08:44:26 -04:00
John Ericson d9a1800239 lib: Add lib.platforms.windows 2018-03-20 12:47:45 -04:00
John Ericson 3c8ae01a45 lib: Make platforms.all actually match all platforms
Otherwise obscure cross-compilations are hampered. `all` breaks all but
the initial derivation (which we can't even write yet) in an open world
setting however, so we really shouldn't have it.
2018-03-20 12:46:19 -04:00
John Ericson 175d4ab1db lib: Make platform predicates greppable
Should have commited on here and on merged master to begin with, but I
didn't, so instead I cherry-pick.

(cherry picked from commit 88c04a8b6b)
2018-03-20 12:35:20 -04:00
John Ericson 88c04a8b6b lib: Make platform predicates greppable 2018-03-19 22:20:48 -04:00
John Ericson bbfa2f9701 lib: Split Darwin into macOS and iOS
I noticed LLVM accepts `ios` as its own OS in platform triples; a
recent change as far as I know. I see it also accepts `macos*` for macOS
(formerly OS X). If it's now customary to distinguish iOS like so
(rather than guessing from the aarch, lets add both so our OSes are
still disjoint, and make Darwin a family instead.

But changing the config everywhere would probably be a mass rebuild, and
I'm not sure how well other software supports OSes besides "darwin", so
I'm keeping that the default name for macOS for now.
2018-03-19 12:02:49 -04:00
John Ericson c26252af3e 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-03-15 00:44:34 -04:00
John Ericson f79f80dbf2 treewide: get rid of platforms.allBut
Negative reasoning like `allBut` is a bad idea with an open world of
platforms. Concretely, if we add a new, quite different sort of
platform, existing packages with `allBut` will claim they work on it
even though they probably won't.
2018-03-14 18:44:42 -04:00
John Ericson 2482e2858e prebuilt android tools: Init using SDK
Expose as an option for the cross stdenv.
2018-02-27 14:15:39 -05:00
John Ericson dfc5d7835d
Merge pull request #35247 from telent/mips32
lib, treewide: Add missing MIPS arches, and fix existing usage
2018-02-27 14:01:15 -05:00
Shea Levy 3c57e770cf
Only build libseccomp on supported systems 2018-02-24 23:05:08 -05:00
Shea Levy 0ac6d4aeb6
gnu-efi: Fix aarch64 cross-build 2018-02-24 22:15:48 -05:00
Shea Levy 87270fb306
gnu-efi: Only build on efi-enabled systems 2018-02-24 21:49:31 -05:00
Shea Levy 63fa1fcb04
kexectools: Only build on kexecable architectures. 2018-02-24 10:37:54 -05:00
Daniel Barlow 9c50ae6898 lib, treewide: Add missing MIPS arches, and fix existing usage
Existing "mips64el" should be "mipsel".

This is just the barest minimum so that nixpkgs can recognize them as
systems - although required for building individual derivations onto
MIPS boards, it is not sufficient if you want to actually build nixos on
those targets
2018-02-23 20:43:42 -05:00
Shea Levy 32d3533b29
riscv: Compile console support into the kernel. 2018-02-19 22:43:18 -05:00
Shea Levy 6173f2f945
linux_riscv: Add 4.16-rc1.
Fixes #35148.
2018-02-19 12:14:22 -05:00
Shea Levy e288febee0
Add riscv{32,64} crossSystems. 2018-02-18 00:09:25 -05:00
Tuomas Tynkkynen e4bfe5aac9 treewide: Drop kernelHeadersBaseConfig
Nothing actually needs this.
2018-02-14 01:47:28 +02:00
Will Dietz f090bbb248 Drop "isGlibc", but keep isMusl.
gnu "abi" doesn't mean glibc (mingw, apparently).
2018-02-11 14:55:17 -06:00
Will Dietz 2dfee94fe7 lib/systems: musl, libc predicates
Note this doesn't actually provide musl support yet,
just improves our "system" code to understand
musl-based triples and non-glibc linux configurations.
2018-02-11 14:20:14 -06:00
Tuomas Tynkkynen c9d1bf3e76 platforms.nix: Include RPi 3 serial port in the kernel config 2018-02-06 22:14:09 +02:00
John Ericson afb87a66b3 lib: Avoid double import 2018-01-31 00:13:11 -05:00
John Ericson ad78ba1efa lib: Better use the module type system in platform parsing
I need some module system types here so I can next fix meta-checks for
derivations. I'd like to use a "proper" record type here, but submodule
types seem overkill so holding off with ad-hoc stuff for now. In
practice, all I need for the next step are the `.check` functions so
this is good, especially as the submodule check function is shallow,
saving full inductive type-checking for a later step.
2018-01-30 22:03:06 -05:00
John Ericson 57b01b1bcf lib, openssl: Get rid of openssl.system
We compute it on the fly, careful to avoid any mass rebuilds for now.
2018-01-26 21:22:00 -05:00
John Ericson 16a50f5a07 lib: Remove examples platforms' bigEndian attr
They still have `parsed.cpu.significantByte` which has the same info.
2018-01-26 21:22:00 -05:00
John Ericson 71f814a889 lib, glibc: Get rid of withTLS
glibc removed the underlying flag in 2011 in
83cd14204559abbb52635006832eaf4d2f42514a [1].

This gets us one step closer to fixing #34274: the cross stdenv for
aarch64-unknown-linux-gnu at least evals now.

Thanks to @Dezgeg for doing all the research for this.

[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=83cd14204559abbb52635006832eaf4d2f42514a
2018-01-26 23:29:06 +02:00
John Ericson d1478c91c3 lib: Allow parsing platform configs with arch of {riscv,wasm}{32,64}
Also add `isRiscv` and `isWasm` predicates.
2018-01-26 12:44:05 -05:00
John Ericson 992bd2f6d3 Merge commit 'ab77a6bb1e7d2ff475210ad392f1a9bd1bb6ba3a' into gcc-simplify-flags 2017-12-05 17:41:15 -05:00
John Ericson 93cd0685c5 Merge commit '71186e73455a4e06e96a31da34b76f84e545ba1f' into gcc-simplify-flags 2017-12-05 17:09:41 -05:00
John Ericson c8d435476d lib: Unbreak pogoplug example platform
Vendor needed to be made valid
2017-12-05 14:17:00 -05:00
John Ericson 1fe9798ac2 lib, gcc: No inherit (platform) gcc; in {host,build,target}Platform 2017-12-05 13:52:20 -05:00
Drew Hess 67ba83a934 kernel: add beagleboard.org kernel
And update the existing platform variant to use it
2017-11-09 18:28:14 +02:00
Tuomas Tynkkynen 0d9f2f0bb4 platforms.nix: Clean up more 'uboot' legacy
For a while now, the only thing the 'uboot' attribute does is to tell
whether to add ubootTools to kernel/initrd builds. That can be
determined with platform.kernelTarget == "uImage" just as well.
2017-11-05 17:06:59 +02:00
Drew Hess ceb2b71f69 kernel: Build Tegra PCI support. 2017-10-18 02:31:18 +03:00
John Ericson bc9f471997 Merge pull request #27797 from grahamc/fixed-lib
Convert libs to a fixed-point
2017-09-19 10:52:15 -04:00
Graham Christensen 152c63c9ff
Convert libs to a fixed-point
This does break the API of being able to import any lib file and get
its libs, however I'm not sure people did this.

I made this while exploring being able to swap out docFn with a stub
in #2305, to avoid functor performance problems. I don't know if that
is going to move forward (or if it is a problem or not,) but after
doing all this work figured I'd put it up anyway :)

Two notable advantages to this approach:

1. when a lib inherits another lib's functions, it doesn't
   automatically get put in to the scope of lib
2. when a lib implements a new obscure functions, it doesn't
   automatically get put in to the scope of lib

Using the test script (later in this commit) I got the following diff
on the API:

  + diff master fixed-lib
  11764a11765,11766
  > .types.defaultFunctor
  > .types.defaultTypeMerge
  11774a11777,11778
  > .types.isOptionType
  > .types.isType
  11781a11786
  > .types.mkOptionType
  11788a11794
  > .types.setType
  11795a11802
  > .types.types

This means that this commit _adds_ to the API, however I can't find a
way to fix these last remaining discrepancies. At least none are
_removed_.

Test script (run with nix-repl in the PATH):

  #!/bin/sh

  set -eux

  repl() {
      suff=${1:-}
      echo "(import ./lib)$suff" \
          | nix-repl 2>&1
  }

  attrs_to_check() {
      repl "${1:-}" \
          | tr ';'  $'\n' \
          | grep "\.\.\." \
          | cut -d' ' -f2 \
          | sed -e "s/^/${1:-}./" \
          | sort
  }

  summ() {
      repl "${1:-}" \
          | tr ' ' $'\n' \
          | sort \
          | uniq
  }

  deep_summ() {
      suff="${1:-}"
      depth="${2:-4}"
      depth=$((depth - 1))
      summ "$suff"

      for attr in $(attrs_to_check "$suff" | grep -v "types.types"); do
          if [ $depth -eq 0 ]; then
              summ "$attr" | sed -e "s/^/$attr./"
          else
              deep_summ "$attr" "$depth" | sed -e "s/^/$attr./"
          fi
      done
  }

  (
      cd nixpkgs

      #git add .
      #git commit -m "Auto-commit, sorry" || true
      git checkout fixed-lib
      deep_summ > ../fixed-lib
      git checkout master
      deep_summ > ../master
  )

  if diff master fixed-lib; then
      echo "SHALLOW MATCH!"
  fi

  (
      cd nixpkgs
      git checkout fixed-lib
      repl .types
  )
2017-09-16 21:36:43 -04:00
John Ericson 741839a687 lib: Add *Platform.extensions
This is used to platform specific library and exectuable extensions. In
the next commit I'll replace a bunch of ad-hoc logic with it.
2017-09-13 11:07:50 -04:00
Tuomas Tynkkynen 5674da5aed Fix "treewide: Consistently call ARM 'arm'"
0c0fad6141 was broken. I didn't realize there's some hidden
metaprogramming code where one can't even grep for 'isFoo' to find its
definition :(
2017-08-24 14:43:57 +03:00
Tuomas Tynkkynen 0c0fad6141 treewide: Consistently call ARM 'arm'
No need for silly differences.
2017-08-24 01:17:01 +03:00
Tuomas Tynkkynen 5b99d53975 kernel: Build Tegra X1 USB support as a module 2017-07-28 22:14:12 +03:00
John Ericson 02464668c0 lib: Add isPowerPC predicate, and fix family name 2017-07-10 11:13:56 -04:00
David McFarland bb3c8a164c lib: Include darwin in isUnix 2017-07-03 09:31:25 -03:00
David McFarland 4ac1901d54 stdenv: remove unix kernel family
System predicate patterns can now be specified as a list of OR'd
attribute sets.
2017-06-26 09:33:41 -03:00
David McFarland be75c5dffb cygwin: fix doubleFromSystem for cygwin 2017-06-26 09:33:38 -03:00
John Ericson 9f680d30f4 lib and doc: Use "libSystem" as identifier for that libc in platforms 2017-05-31 00:47:25 -04:00
John Ericson c66ff8ec3c cross tests and stdenv: armv5te*l* of sheevaplug explicit
The "l" suffix presumably indicates it is little-endian, which it
is.
2017-05-29 20:12:06 -04:00
John Ericson 20e756a093 lib: Consolidate platform configurations (used for crossSystem)
This is good for maintenance and education.
2017-05-29 18:56:03 -04:00
John Ericson fedcda6cda zpaqd: Modernize derivation
- Simplified platform-specific options
 - Almost ready for cross-compilation
2017-05-22 18:52:50 -04:00
John Ericson eaa509f33a stdenv: Rename isGNU to isHurd as GNU is a userland
Elsewhere, things called GNU indeed includes GNU/Linux or GNU/Hurd, but this
predicate was defined excluding Linux regardless of userland.
2017-05-22 13:55:26 -04:00
John Ericson c5c6606048 lib: Infer libc field of platform if not specified
This is especially useful when not cross compiling. It means we can
remove the `stdenv.isGlibc` predicate too.

Additionally, use this to simplify the logic to choose the
appropriate libiconv derivation.
2017-05-22 00:25:02 -04:00
John Ericson 2e7ec6fb70 lib: Make platform predicates more ergonomic to use
`hostPlatform.isDarwin` instead of `lib.system.parse.isDarwin
hostPlatform.parsed`
2017-05-22 00:25:02 -04:00
John Ericson 80ed251f17 lib platform parsing: Whitelist darwin10 and darwin14 as stopgap
Something better should be done longer term to support such version
suffixes.
2017-05-17 15:33:05 -04:00
John Ericson 371ebc89ca lib platform parsing: Fix windows support to conform to LLVM, take 2
Second attempt at pull request #25275

This reverts commit b70924bd80,
reapplying 2282a5774c
2017-05-17 11:16:00 -04:00
Vladimír Čunát b70924bd80
Revert "Merge pull request #25275 from Ericson2314/platform-normalize"
This reverts commit 2282a5774c, reversing
changes made to 14adea9156.

The lib tests are bloking nixpkgs-unstable, and I don't like debugging
it soon enough.
2017-05-06 13:28:07 +02:00
Michael Raskin bcbafdefc4 Merge pull request #25035 from elitak/cross-staging
Add some ARM platforms
2017-05-01 13:30:32 +02:00
John Ericson fcde869e7e lib platform parsing: Fix windows
There is no more `cygwin` OS, but instead a `cygnus` abi. "win32"
and "mingw32" parse as `windows`. Add a 3-part hack because autotools
breaks on explicit abi with windows-like (e.g. "i686-pc-windows-gnu").

Also change cross triples to conform
2017-04-27 14:30:42 -04:00
John Ericson 7d546d7771 lib platform parsing: Turn assertion back on 2017-04-27 12:55:52 -04:00
John Ericson 23cc0c4420 lib: Whitelist two ABIs used on Arm 2017-04-25 19:58:03 -04:00
Eric Litak 127347f1fd platforms: add CompuLab Utilite (armv7) 2017-04-19 14:09:56 -07:00
Eric Litak c3eca1f8dc platforms: add pogoplug4 (armv5tel softfloat) 2017-04-19 14:09:56 -07:00
Eric Litak 3b7395683c platforms: add scaleway-c1 (armv7 sans NEON) 2017-04-19 14:09:56 -07:00
John Ericson 3efc661a1d Elaborate localSystem and crossSystem in a consistent manner 2017-04-17 17:13:01 -04:00
John Ericson 8c99aab3ea lib: Fix system parsing, and use for doubles lists
The old hard-coded lists are now used to test system parsing.

In the process, make an `assertTrue` in release lib for eval tests; also
use it in release-cross
2017-04-17 17:13:01 -04:00
John Ericson 2227789392 lib: Collect system/platform related files
Previously, platforms was a random thing in top-level
2017-04-17 17:13:01 -04:00