nixpkgs/pkgs/development
John Ericson 63bd851e95 stdenv: Introduce hasCC attribute
Before, we'd always use `cc = null`, and check for that. The problem is
this breaks for cross compilation to platforms that don't support a C
compiler.

It's a very subtle issue. One might think there is no problem because we
have `stdenvNoCC`, and presumably one would only build derivations that
use that. The problem is that one still wants to use tools at build-time
that are themselves built with a C compiler, and those are gotten via
"splicing". The runtime version of those deps will explode, but the
build time / `buildPackages` versions of those deps will be fine, and
splicing attempts to work this by using `builtins.tryEval` to filter out
any broken "higher priority" packages (runtime is the default and
highest priority) so that both `foo` and `foo.nativeDrv` works.

However, `tryEval` only catches certain evaluation failures (e.g.
exceptions), and not arbitrary failures (such as `cc.attr` when `cc` is
null). This means `tryEval` fails to let us use our build time deps, and
everything comes apart.

The right solution is, as usually, to get rid of splicing. Or, baring
that, to make it so `foo` never works and one has to explicitly do
`foo.*`. But that is a much larger change, and certaily one unsuitable
to be backported to stable.

Given that, we instead make an exception-throwing `cc` attribute, and
create a `hasCC` attribute for those derivations which wish to
condtionally use a C compiler: instead of doing `stdenv.cc or null ==
null` or something similar, one does `stdenv.hasCC`. This allows quering
without "tripping" the exception, while also allowing `tryEval` to work.

No platform without a C compiler is yet wired up by default. That will
be done in a following commit.
2019-11-25 00:12:38 +00:00
..
androidndk-pkgs
arduino treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
beam-modules treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
bower-modules/generic
compilers ghcjs-ng: The GHC source should be configured with native build inputs 2019-11-24 23:08:47 +00:00
coq-modules treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
dhall-modules
dotnet-modules/patches
em-modules/generic treewide: Get rid of most parseDrvName without breaking compat 2019-11-24 17:22:28 +00:00
go-modules
go-packages
guile-modules
haskell-modules cachix: fix build 2019-09-09 09:52:29 +02:00
idris-modules
interpreters stdenv: Introduce hasCC attribute 2019-11-25 00:12:38 +00:00
java-modules
libraries treewide: Get rid of most parseDrvName without breaking compat 2019-11-24 17:22:28 +00:00
lisp-modules treewide: Get rid of most parseDrvName without breaking compat 2019-11-24 17:22:28 +00:00
lua-modules
misc treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
mobile treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
node-packages
ocaml-modules treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
perl-modules treewide: Get rid of most parseDrvName without breaking compat 2019-11-24 17:22:28 +00:00
pharo treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
pure-modules
python-modules python.pkgs.MySQL_python: remove 2019-09-09 13:18:07 +01:00
r-modules treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
ruby-modules treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
tools treewide: Get rid of most parseDrvName without breaking compat 2019-11-24 17:22:28 +00:00
web