nixpkgs/pkgs/build-support/cc-wrapper
Anthony Cowley d96893647d cc-wrapper: fix on darwin
The ld-wrapper.sh script calls `readlink` in some circumstances. We need
to ensure that this is the `readlink` from the `coreutils` package so
that flag support is as expected.

This is accomplished by explicitly setting PATH at the top of each shell
script.

Without doing this, the following happens with a trivial `main.c`:

```
nix-env -f "<nixpkgs>" -iA pkgs.clang
$ clang main.c -L /nix/../nix/store/2ankvagznq062x1gifpxwkk7fp3xwy63-xnu-2422.115.4/Library -o a.out
readlink: illegal option -- f
usage: readlink [-n] [file ...]
```

The key element is the `..` in the path supplied to the linker via a
`-L` flag. With this patch, the above invocation works correctly on
darwin, whose native `/usr/bin/readlink` does not support the `-f` flag.

The explicit path also ensures that the `grep` called by `cc-wrapper.sh`
is the one from Nix.

Fixes #6447
2016-01-19 17:47:11 -05:00
..
add-flags rename gcc-wrapper to cc-wrapper. 2015-01-14 20:26:56 -08:00
cc-wrapper.sh cc-wrapper: fix on darwin 2016-01-19 17:47:11 -05:00
default.nix cc-wrapper: fix on darwin 2016-01-19 17:47:11 -05:00
gnat-wrapper.sh cc-wrapper: fix on darwin 2016-01-19 17:47:11 -05:00
gnatlink-wrapper.sh rename gcc-wrapper to cc-wrapper. 2015-01-14 20:26:56 -08:00
ld-solaris-wrapper.sh Fix compilation of GCC 4.9 on SmartOS. 2015-11-16 17:20:16 +01:00
ld-wrapper.sh cc-wrapper: fix on darwin 2016-01-19 17:47:11 -05:00
setup-hook.sh Remove gccStdInc 2015-05-13 18:17:25 +02:00
utils.sh rename gcc-wrapper to cc-wrapper. 2015-01-14 20:26:56 -08:00