diff options
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r-- | pkgs/build-support/cc-wrapper/cc-wrapper.sh | 5 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 12 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/gnat-wrapper.sh | 5 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/ld-wrapper.sh | 5 |
4 files changed, 22 insertions, 5 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 5bd59f8c5850..6e12a0d8bc8f 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -1,4 +1,8 @@ #! @shell@ -e +path_backup="$PATH" +if [ -n "@coreutils@" ]; then + PATH="@coreutils@/bin:@gnugrep@/bin" +fi if [ -n "$NIX_CC_WRAPPER_START_HOOK" ]; then source "$NIX_CC_WRAPPER_START_HOOK" @@ -141,4 +145,5 @@ if [ -n "$NIX_CC_WRAPPER_EXEC_HOOK" ]; then source "$NIX_CC_WRAPPER_EXEC_HOOK" fi +PATH="$path_backup" exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}" diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 2eadb89e0c16..0458eedc62bc 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -9,13 +9,14 @@ , cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell , zlib ? null, extraPackages ? [], extraBuildCommands ? "" , dyld ? null # TODO: should this be a setup-hook on dyld? -, isGNU ? false, isClang ? cc.isClang or false +, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null }: with stdenv.lib; assert nativeTools -> nativePrefix != ""; -assert !nativeTools -> cc != null && binutils != null && coreutils != null; +assert !nativeTools -> + cc != null && binutils != null && coreutils != null && gnugrep != null; assert !nativeLibc -> libc != null; # For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper. @@ -30,9 +31,9 @@ let libc_dev = if nativeLibc then null else libc.dev or libc; libc_lib = if nativeLibc then null else libc.out or libc; cc_solib = cc.lib or cc; - binutils_bin = if nativeTools then "$binutils" else binutils.bin or binutils; - # The wrapper scripts use 'cat', so we may need coreutils. - coreutils_bin = if nativeTools then null else coreutils.bin or coreutils; + binutils_bin = if nativeTools then "" else binutils.bin or binutils; + # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. + coreutils_bin = if nativeTools then "" else coreutils.bin or coreutils; in stdenv.mkDerivation { @@ -43,6 +44,7 @@ stdenv.mkDerivation { preferLocalBuild = true; inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin; + gnugrep = if nativeTools then "" else gnugrep; passthru = { inherit libc nativeTools nativeLibc nativePrefix isGNU isClang; }; diff --git a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh index 3514ccd67325..ae46b40ac631 100644 --- a/pkgs/build-support/cc-wrapper/gnat-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/gnat-wrapper.sh @@ -1,4 +1,8 @@ #! @shell@ -e +path_backup="$PATH" +if [ -n "@coreutils@" ]; then + PATH="@coreutils@/bin" +fi if [ -n "$NIX_GNAT_WRAPPER_START_HOOK" ]; then source "$NIX_GNAT_WRAPPER_START_HOOK" @@ -100,4 +104,5 @@ if [ -n "$NIX_GNAT_WRAPPER_EXEC_HOOK" ]; then source "$NIX_GNAT_WRAPPER_EXEC_HOOK" fi +PATH="$path_backup" exec @prog@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} diff --git a/pkgs/build-support/cc-wrapper/ld-wrapper.sh b/pkgs/build-support/cc-wrapper/ld-wrapper.sh index 30c531b76479..6ef06eb70348 100644 --- a/pkgs/build-support/cc-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/ld-wrapper.sh @@ -1,4 +1,8 @@ #! @shell@ -e +path_backup="$PATH" +if [ -n "@coreutils@" ]; then + PATH="@coreutils@/bin" +fi if [ -n "$NIX_LD_WRAPPER_START_HOOK" ]; then source "$NIX_LD_WRAPPER_START_HOOK" @@ -163,4 +167,5 @@ if [ -n "$NIX_LD_WRAPPER_EXEC_HOOK" ]; then source "$NIX_LD_WRAPPER_EXEC_HOOK" fi +PATH="$path_backup" exec @prog@ ${extraBefore[@]} "${params[@]}" ${extra[@]} |