Commit graph

376 commits

Author SHA1 Message Date
John Ericson 85b4d30c0b binutils: Respect the targetPlatform
Use `buildPackages.binutils` to get build = host != target binutils,
i.e. the old `binutilsCross`, and use
`buildPackages.buildPackages.binutils` to get build = host = target
binutils, i.e. the old `binutils`.

`buildPackages` chains like this are supposed to remove the need for
all such `*Cross` derivations. We start with binutils because it's
comparatively easy.

No hashes of cross-tests should be changed
2017-04-25 21:31:50 -04:00
John Ericson 78bb5f5f37 linux cross stdenv: Pull platforms from lib to cut eval time 2017-04-25 19:57:05 -04:00
John Ericson 49c99b70cf cross-stdenv: Only prune most overrides in the final stage
Before all overrides were also pruned in the previous stage, now
only gcc and binutils are, because they alone care about about the
target platform. The rest of the overrides don't, so it's better to
preserve them in order to avoid spurious rebuilds.
2017-04-24 16:31:53 -04:00
Tuomas Tynkkynen 28f87e4141 stdenv: ARM bootstrap: Update bootstrap tarballs to latest hydra-built ones
Fixes sandboxed build of glibc. Discussion about a similar failure on aarch64 at:
8bfa9f528c.

Picked from the following cross-trunk evaluation:
http://hydra.nixos.org/eval/1349278 based on nixpkgs
commit 1f32d4b4eb.

armv5tel job: http://hydra.nixos.org/build/51569718
armv6l job: http://hydra.nixos.org/build/51569717
armv7l job: http://hydra.nixos.org/build/51569713
2017-04-15 01:52:33 +03:00
Tuomas Tynkkynen 1f32d4b4eb make-bootstrap-tools.nix: Fix bzip2
Apparently our native bzip2 builds switched to using dynamic libraries at some point.
2017-04-13 17:22:55 +03:00
Tuomas Tynkkynen 20d9edff17 stdenv: aarch64: Update bootstrap tarballs
Hopefully fixes sandboxed build of glibc on aarch64, as discussed on
8bfa9f528c.

Picked from the following cross-trunk evaluation:
http://hydra.nixos.org/eval/1341395 based on nixpkgs
commit bb3ef8a95c.

build job: http://hydra.nixos.org/build/50125932

(busybox's hash not changing is not a bug!)
2017-03-15 19:17:52 +02:00
Tuomas Tynkkynen b2343099ab make-bootstrap-tools{,-cross}.nix: Fix build after binutils changes
Broken after commit 17a344a ("binutils: Add lib output").
2017-02-04 23:39:25 +02:00
Tuomas Tynkkynen d1d8ed21b6 stdenv: Aarch64 bootstrap: Update bootstrap tarballs to hydra-built ones
Picked from the following cross-trunk evaluation:
http://hydra.nixos.org/eval/1326772#tabs-still-succeed based on nixpkgs
commit 264d42b9cf.

dist job: http://hydra.nixos.org/build/47094514
2017-01-29 01:34:02 +02:00
Tuomas Tynkkynen e2a2f6d595 Merge pull request #22117 from dezgeg/aarch64-for-merge
Aarch64 (ARM64) support
2017-01-26 17:52:28 +02:00
John Ericson c869fe022e top-level: no more need to expose splicedPackages
This was just done temporarily on the last cross-overhauling PR for
testing purposes.
2017-01-25 09:24:55 -05:00
Tuomas Tynkkynen 5c0a385e1c stdenv: Add aarch64 bootstrap files
These are temporary and will be switched to Hydra-build ones once all
the aarch4 changs are merged.
2017-01-25 00:01:53 +02:00
Tuomas Tynkkynen de3cac0ece make-bootstrap-tools.nix test: Use busybox from store
Our bootstrap tools are actually broken right now due to busybox not
working when invoked directly from a store path. (It says e.g.
"0qqqw19y4gmknajw8vg4fvhx9gxdqlhz-busybox: applet not found").
Make this test actually fail in such case, the next commit will fix the
problem with busybox.
2017-01-25 00:01:52 +02:00
Tuomas Tynkkynen c909f1b18e stdenv: Add updateAutoconfGnuConfigScriptsHook for aarch64
This is required for Aarch64 since a lot of source tarballs ship with
outdated configure scripts that don't recognize aarch64. Simply
replacing the config.guess and config.sub with new versions from
upstream makes them build again.

This same approach is used by at least Buildroot and Fedora. In
principle this could be enabled for all architectures but
conditionalizing this on aarch64 avoids a mass rebuild on x86.
2017-01-25 00:01:52 +02:00
Tuomas Tynkkynen 7c8a060c09 stdenv: Bringup aarch64 architecture support 2017-01-25 00:01:51 +02:00
John Ericson a1a798f017 top-level: crossSystem is no longer exposed to packages. Use *Platform. 2017-01-24 11:37:56 -05:00
John Ericson 92edcb7ebb top-level: Lay the groundwork for {build,host,target}Platform
The long term goal is a big replace:
  { inherit system platform; } => buildPlatform
  crossSystem => hostPlatform
  stdenv.cross => targetPlatform
And additionally making sure each is defined even when not cross compiling.

This commit refactors the bootstrapping code along that vision, but leaves
the old identifiers with their null semantics in place so packages can be
modernized incrementally.
2017-01-24 11:37:56 -05:00
John Ericson bf17d6dacf top-level: Introduce buildPackages for resolving build-time deps
[N.B., this package also applies to the commits that follow it in the same
PR.]

In most cases, buildPackages = pkgs so things work just as before. For
cross compiling, however, buildPackages is resolved as the previous
bootstrapping stage. This allows us to avoid the mkDerivation hacks cross
compiling currently uses today.

To avoid a massive refactor, callPackage will splice together both package
sets. Again to avoid churn, it uses the old `nativeDrv` vs `crossDrv` to do
so. So now, whether cross compiling or not, packages with get a `nativeDrv`
and `crossDrv`---in the non-cross-compiling case they are simply the same
derivation. This is good because it reduces the divergence between the
cross and non-cross dataflow. See `pkgs/top-level/splice.nix` for a comment
along the lines of the preceding paragraph, and the code that does this
splicing.

Also, `forceNativeDrv` is replaced with `forceNativePackages`. The latter
resolves `pkgs` unless the host platform is different from the build
platform, in which case it resolves to `buildPackages`. Note that the
target platform is not important here---it will not prevent
`forcedNativePackages` from resolving to `pkgs`.

--------

Temporarily, we make preserve some dubious decisions in the name of preserving
hashes:

Most importantly, we don't distinguish between "host" and "target" in the
autoconf sense. This leads to the proliferation of *Cross derivations
currently used. What we ought to is resolve native deps of the cross "build
packages" (build = host != target) package set against the "vanilla
packages" (build = host = target) package set. Instead, "build packages"
uses itself, with (informally) target != build in all cases.

This is wrong because it violates the "sliding window" principle of
bootstrapping stages that shifting the platform triple of one stage to the
left coincides with the next stage's platform triple. Only because we don't
explicitly distinguish between "host" and "target" does it appear that the
"sliding window" principle is preserved--indeed it is over the reductionary
"platform double" of just "build" and "host/target".

Additionally, we build libc, libgcc, etc in the same stage as the compilers
themselves, which is wrong because they are used at runtime, not build
time. Fixing this is somewhat subtle, and the solution and problem will be
better explained in the commit that does fix it.

Commits after this will solve both these issues, at the expense of breaking
cross hashes. Native hashes won't be broken, thankfully.

--------

Did the temporary ugliness pan out? Of the packages that currently build in
`release-cross.nix`, the only ones that have their hash changed are
`*.gcc.crossDrv` and `bootstrapTools.*.coreutilsMinimal`. In both cases I
think it doesn't matter.

 1. GCC when doing a `build = host = target = foreign` build (maximally
    cross), still defines environment variables like `CPATH`[1] with
    packages.  This seems assuredly wrong because whether gcc dynamically
    links those, or the programs built by gcc dynamically link those---I
    have no idea which case is reality---they should be foreign. Therefore,
    in all likelihood, I just made the gcc less broken.

 2. Coreutils (ab)used the old cross-compiling infrastructure to depend on
    a native version of itself. When coreutils was overwritten to be built
    with fewer features, the native version it used would also be
    overwritten because the binding was tight. Now it uses the much looser
    `BuildPackages.coreutils` which is just fine as a richer build dep
    doesn't cause any problems and avoids a rebuild.

So, in conclusion I'd say the conservatism payed off. Onward to actually
raking the muck in the next PR!

[1]: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
2017-01-24 11:37:56 -05:00
Nicolas B. Pierron da8cf2662a Fix missing overlays argument in stdenv/linux/default.nix 2017-01-16 01:17:33 +01:00
Nicolas B. Pierron f5dfe78a1e Add overlays mechanism to Nixpkgs.
This patch add a new argument to Nixpkgs default expression named "overlays".

By default, the value of the argument is either taken from the environment variable `NIXPKGS_OVERLAYS`,
or from the directory `~/.nixpkgs/overlays/`.  If the environment variable does not name a valid directory
then this mechanism would fallback on the home directory.  If the home directory does not exists it will
fallback on an empty list of overlays.

The overlays directory should contain the list of extra Nixpkgs stages which would be used to extend the
content of Nixpkgs, with additional set of packages.  The overlays, i-e directory, files, symbolic links
are used in alphabetical order.

The simplest overlay which extends Nixpkgs with nothing looks like:

```nix
self: super: {
}
```

More refined overlays can use `super` as the basis for building new packages, and `self` as a way to query
the final result of the fix-point.

An example of overlay which extends Nixpkgs with a small set of packages can be found at:
  https://github.com/nbp/nixpkgs-mozilla/blob/nixpkgs-overlay/moz-overlay.nix

To use this file, checkout the repository and add a symbolic link to
the `moz-overlay.nix` file in `~/.nixpkgs/overlays` directory.
2017-01-16 01:17:33 +01:00
John Ericson ff35560460 linux stdenv: Inline stage funs to conform to new convention
Code is just moved around
2017-01-13 13:23:26 -05:00
John Ericson b10f415c21 linux stdenv: Remove stray use of stage0 to bootstrap more elegantly 2017-01-13 13:23:26 -05:00
John Ericson 6a45e911c4 linux stdenv: Utilize overrides and prevStage better
`gcc-unwrapped` basically replaces `gccPlain`. It may seem like an ugly
polution to stick it in all-packages, but a future PR will enshrine this
`*-unwrapped` pattern. In any event, the long term goal is stdenvs might
need to tweak how compilers are booted and wrapped, but the code to build
the unwrapped compilers themselves should be generic.
2017-01-13 13:23:25 -05:00
John Ericson 3e197f7d81 top-level: Normalize stdenv booting
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping
stages, and use it everywhere for consistency. See that file for more doc.

Stdenvs besides Linux and Darwin are completely refactored to utilize this.
Those two, due to their size and complexity, are minimally edited for
easier reviewing.

No hashes should be changed.
2017-01-13 13:23:23 -05:00
John Ericson 0ef8b69d12 top-level: Modernize stdenv.overrides giving it self and super
Document breaking change in 17.03 release notes
2017-01-13 10:36:11 -05:00
Tuomas Tynkkynen bde8632106 coreutils: Build with libattr to support xattrs
Fixes #21649
2017-01-05 00:55:35 +02:00
John Ericson 7960a1b1b8 linux stdenv: Avoid assert false
On one hand, don't want to pass garbage that affects hash, on the other
hand footguns are bad.

Now, factored out the derivation so only need to pass in what is used.
2016-12-15 17:09:29 -05:00
John Ericson 670256dc39 linux stdenv: Rename the bootstrap directory to bootstrap-files 2016-12-15 17:05:39 -05:00
John Ericson a94af71da7 linux stdenv: Fix assert that broke tests...and hydra 2016-12-15 16:45:08 -05:00
John Ericson 5c6234a7d3 top-level: Allow manually specifying a stdenv, and fix stdenv tests
- The darwin test can now force the use of the freshly-booted darwin stdenv
 - The linux test now passes enough dummy arguments

This may make debugging harder, if so, check out #20889
2016-12-03 17:21:07 -08:00
John Ericson 4751d9e5ad top-level: turn the screw
- Non-cross stdenvs are honest and assert that `crossSystem` is null

 - `crossSystem` is a mandatory argument to top-level/stage.nix, just like
   `system` and `platform`

 - Broken default arguments on stdenvs for testing are gone.

 - All stdenvs (but little-used stdenvNix) take the same arguments for easy
   testing.
2016-12-01 11:24:33 -05:00
John Ericson 39753f5360 top-level: Close over fewer arguments for stdenv stages
This makes the flow of data easier to understand. There's little downside
because the args in question are already inspected by the stdenvs.

cross-compiling in particular is simpler because we don't need to worry
about overriding the config closed over by `allPackages`.
2016-11-30 19:11:03 -05:00
John Ericson d240a0da1a top-level: Remove cycles: stdenv calls in top-level but not vice versa
This commit changes the dependencies of stdenv, and clean-up the stdenv
story by removing the `defaultStdenv` attribute as well as the `bootStdenv`
parameter.

Before, the final bootstrapping stage's stdenv was provided by
all-packages, which was iterating multiple times over the
top-level/default.nix expression, and non-final bootstrapping stages'
stdenvs were explicitly specified with the `bootStdenv` parameter.

Now, all stages' stdenvs are specified with the `stdenv` parameter.
For non-final bootstrapping stages, this is a small change---basically just
rename the parameter.
For the final stage, top-level/default.nix takes the chosen stdenv and
makes the final stage with it.

`allPackages` is used to make all bootstrapping stages, final and
non-final alike. It's basically the expression of `stage.nix` (along with a
few partially-applied default arguments)

Note, the make-bootstrap-tools scripts are temporarily broken
2016-11-30 19:10:59 -05:00
Tuomas Tynkkynen 1409bc003b make-bootstrap-tools-cross.nix: Fix gcc build-time options for armv5tel
I broke this in the cleanups I did in 171c7f0, the gcc inside the bootstrap
tarball is not getting built with the correct --with-fpu, --with-float
etc. options.
2016-08-28 00:30:48 +03:00
Tuomas Tynkkynen 61faa4415e stdenv: ARM bootstrap: Update bootstrap tarballs to hydra-built ones
Picked from the following cross-trunk evaluation:
http://hydra.nixos.org/eval/1283982#tabs-inputs based on nixpkgs
commit 33a1d8080b.

armv5tel job: http://hydra.nixos.org/build/37908177
armv6l job: http://hydra.nixos.org/build/37908176
armv7l job: http://hydra.nixos.org/build/37908175
2016-07-20 18:51:09 +03:00
Tuomas Tynkkynen 3d50989651 make-bootstrap-tools{,-cross}.nix: Create deterministic tars 2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 53c039b96a make-bootstrap-tools-cross.nix: Support 'dist' target 2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 5cbb6ac151 make-bootstrap-tools-cross.nix: More syncs from the non-cross version 2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 954e54f563 make-bootstrap-tools-cross.nix: Reference correct outputs 2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 0968641eda make-bootstrap-tools-cross.nix: Use busybox with musl
Do this because I cannot figure out how to refer to `glibc.static`
inside busybox when cross building in a manner that works.
2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 171c7f0e63 make-bootstrap-tools-cross.nix: Have more consistency with platforms.nix
E.g. we had `arch = "arm"` in the former and `arch = "armv6"` in the
latter. Try to have some more consistency.
2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 9f0dc294da make-bootstrap-tools-cross.nix: Add/fix some .so dependencies
- cloog, ppl, cloogppl aren't used by recent GCCs. Kill references to them.
- Use correct versions of isl, as the current GCC depends
  on non-default versions of them.
- Also clarify isl dynamic libraries are needed in cross
  builds, but not in native builds
- Since aeb3d8c (bzip2: fix cross build on mingw by using autoconf patch),
  it seems that the bzip2 binary depends on libbz2 when cross compiling.
  So copy libbz2 into the bootstrap tarball as well.
- Curl isn't used in the bootstrap tools since e6f61b4cf3.
2016-07-20 02:38:10 +03:00
Tuomas Tynkkynen 8d62f62a78 stdenv: Remove unpack-bootstrap-tools-arm.sh
This file was using the 'double patchelf' hack, which hasn't been needed
for a while, after the original patchelf bug was fixed:

65a4dc6aa9
2016-07-20 02:38:10 +03:00
Vladimír Čunát f4792cdc0c make-bootstrap-tools*: fixup after #16406
Our coreutils now uses single-binary-build mode where, by default,
simple shebang scripts are used for all the binaries. That doesn't work
e.g. with the Linux unpacker which only handles standard binaries and
symlinks. Let's use the symlinked mode instead for boostrapping.
This does NOT change any stdenv hashes.

I only tested the case most important to me:
$ nix-build pkgs/top-level/release.nix -A stdenvBootstrapTools.x86_64-linux.test
2016-06-28 09:54:22 +02:00
Tuomas Tynkkynen 2d3d105b02 make-bootstrap-tools-cross.nix: Strip extra whitespace 2016-06-10 16:17:30 +03:00
Alexander Ried c6952ece24 bootstrap-tools-linux: Use tar without acl 2016-04-18 00:02:44 +02:00
Alexander Ried 28780a4dad bootstrap-tools-linux: Qualify all multi-output packages 2016-04-18 00:01:44 +02:00
Vladimír Čunát d1df28f8e5 Merge 'staging' into closure-size
This is mainly to get the update of bootstrap tools.
Otherwise there were mysterious segfaults:
https://github.com/NixOS/nixpkgs/pull/7701#issuecomment-203389817
2016-04-07 14:40:51 +02:00
Eelco Dolstra c55cfe0cb3 stdenv-linux: Update bootstrap tools 2016-04-07 13:17:16 +02:00
Vladimír Čunát ab15a62c68 Merge branch 'master' into closure-size
Beware that stdenv doesn't build. It seems something more will be needed
than just resolution of merge conflicts.
2016-04-01 10:06:01 +02:00
Domen Kožar b07e7bfc7b Merge remote-tracking branch 'origin/staging' 2016-03-27 13:19:04 +01:00