nixpkgs/pkgs/build-support
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
..
add-opengl-runpath addOpenGLRunpath: only apply to ELF files 2019-05-23 16:52:45 -04:00
agda
appimage gdk-pixbuf: rename from gdk_pixbuf 2019-07-22 18:50:57 -04:00
bintools-wrapper stdenv: Introduce hasCC attribute 2019-11-25 00:12:38 +00:00
build-bazel-package buildBazelPackage: remove top-level symlinks 2019-08-19 11:23:17 +03:00
build-dotnet-package
build-fhs-userenv chrootenv: propagate nested chrootenv /host 2019-05-30 15:34:01 +03:00
build-setupcfg
buildenv
cc-wrapper stdenv: Introduce hasCC attribute 2019-11-25 00:12:38 +00:00
docker dockertools.buildLayeredImage: default layer count up to 100 2019-08-12 19:59:40 -04:00
dotnetbuildhelpers
dotnetenv
emacs emacsPackages: Drop old emacsPackages (non-NG) sets 2019-08-30 16:43:16 +01:00
expand-response-params
fetchbitbucket
fetchbower
fetchbzr
fetchcvs
fetchdarcs
fetchdocker treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
fetchfossil
fetchgit treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
fetchgithub
fetchgitlab
fetchgitlocal
fetchgx
fetchhg
fetchipfs
fetchmavenartifact
fetchmtn
fetchnuget
fetchpatch
fetchrepoorcz
fetchrepoproject
fetchs3
fetchsavannah
fetchsvn
fetchsvnrevision
fetchsvnssh
fetchurl fetchurl: Eliminate pointless cross differences 2019-11-11 00:25:24 -05:00
fetchzip treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
icon-conv-tools
install-shell-files installShellFiles: init (#65211) 2019-09-04 23:19:17 +02:00
kernel build-support/make-initrd: Don't derive derivation name from file name 2019-05-29 16:07:05 +02:00
libredirect libredirect: add posix_spawnp support 2019-06-18 22:47:11 +02:00
make-desktopitem
make-startupitem
make-symlinks
mkshell mkshell: improve mergeInputs 2019-06-23 22:20:10 +02:00
mono-dll-fixer
nix-gitignore
nix-prefetch-github nix-prefetch-github: 2.3 -> 2.3.1 2019-09-02 14:32:41 +02:00
nuke-references
ocaml Suggested edits 2019-08-07 09:50:46 +02:00
oci-tools ociTools: init 2019-09-04 22:46:42 +00:00
prefer-remote-fetch
references-by-popularity
release treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
remove-references-to
rust treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
setup-hooks installShellFiles: init (#65211) 2019-09-04 23:19:17 +02:00
singularity-tools treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
skaware treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
snap doc: fix after snaptools merge 2019-07-10 08:02:14 -07:00
src-only
substitute
substitute-files
templaterpm treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
upstream-updater treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
vm treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
wrapper-common
writers treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
build-maven.nix
build-pecl.nix phpPackages: build phpPackages with re2c 2019-06-11 22:21:35 +03:00
closure-info.nix treewide: remove unused variables (#63177) 2019-06-16 19:59:05 +00:00
dhall-to-nix.nix treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
plugins.nix
replace-dependency.nix
setup-systemd-units.nix
source-from-head-fun.nix
trivial-builders.nix trivial-builders: add the applyPatches function 2019-09-02 11:18:52 +02:00