Merge #11798: cc-wrapper: fix on darwin

This commit is contained in:
Vladimír Čunát 2016-01-25 10:03:42 +01:00
commit c0599fdd61
6 changed files with 32 additions and 9 deletions

View File

@ -1,4 +1,8 @@
#! @shell@ -e #! @shell@ -e
path_backup="$PATH"
if [ -n "@coreutils@" ]; then
PATH="@coreutils@/bin:@gnugrep@/bin"
fi
if [ -n "$NIX_CC_WRAPPER_START_HOOK" ]; then if [ -n "$NIX_CC_WRAPPER_START_HOOK" ]; then
source "$NIX_CC_WRAPPER_START_HOOK" source "$NIX_CC_WRAPPER_START_HOOK"
@ -141,4 +145,5 @@ if [ -n "$NIX_CC_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_CC_WRAPPER_EXEC_HOOK" source "$NIX_CC_WRAPPER_EXEC_HOOK"
fi fi
PATH="$path_backup"
exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}" exec @prog@ ${extraBefore[@]} "${params[@]}" "${extraAfter[@]}"

View File

@ -9,13 +9,14 @@
, cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell , cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
, zlib ? null, extraPackages ? [], extraBuildCommands ? "" , zlib ? null, extraPackages ? [], extraBuildCommands ? ""
, dyld ? null # TODO: should this be a setup-hook on dyld? , 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; with stdenv.lib;
assert nativeTools -> nativePrefix != ""; 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; assert !nativeLibc -> libc != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper. # For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
@ -37,9 +38,11 @@ stdenv.mkDerivation {
inherit cc shell; inherit cc shell;
libc = if nativeLibc then null else libc; libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils; binutils = if nativeTools then "" else binutils;
# The wrapper scripts use 'cat', so we may need coreutils. # The wrapper scripts use 'cat' and 'grep', so we may need coreutils
coreutils = if nativeTools then null else coreutils; # and gnugrep.
coreutils = if nativeTools then "" else coreutils;
gnugrep = if nativeTools then "" else gnugrep;
passthru = { inherit nativeTools nativeLibc nativePrefix isGNU isClang; }; passthru = { inherit nativeTools nativeLibc nativePrefix isGNU isClang; };

View File

@ -1,4 +1,8 @@
#! @shell@ -e #! @shell@ -e
path_backup="$PATH"
if [ -n "@coreutils@" ]; then
PATH="@coreutils@/bin"
fi
if [ -n "$NIX_GNAT_WRAPPER_START_HOOK" ]; then if [ -n "$NIX_GNAT_WRAPPER_START_HOOK" ]; then
source "$NIX_GNAT_WRAPPER_START_HOOK" source "$NIX_GNAT_WRAPPER_START_HOOK"
@ -100,4 +104,5 @@ if [ -n "$NIX_GNAT_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK" source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi fi
PATH="$path_backup"
exec @prog@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} exec @prog@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}

View File

@ -1,4 +1,8 @@
#! @shell@ -e #! @shell@ -e
path_backup="$PATH"
if [ -n "@coreutils@" ]; then
PATH="@coreutils@/bin"
fi
if [ -n "$NIX_LD_WRAPPER_START_HOOK" ]; then if [ -n "$NIX_LD_WRAPPER_START_HOOK" ]; then
source "$NIX_LD_WRAPPER_START_HOOK" source "$NIX_LD_WRAPPER_START_HOOK"
@ -163,4 +167,5 @@ if [ -n "$NIX_LD_WRAPPER_EXEC_HOOK" ]; then
source "$NIX_LD_WRAPPER_EXEC_HOOK" source "$NIX_LD_WRAPPER_EXEC_HOOK"
fi fi
PATH="$path_backup"
exec @prog@ ${extraBefore[@]} "${params[@]}" ${extra[@]} exec @prog@ ${extraBefore[@]} "${params[@]}" ${extra[@]}

View File

@ -278,7 +278,7 @@ in rec {
inherit stdenv shell; inherit stdenv shell;
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
inherit (pkgs) coreutils binutils; inherit (pkgs) coreutils binutils gnugrep;
inherit (pkgs.darwin) dyld; inherit (pkgs.darwin) dyld;
cc = pkgs.llvmPackages.clang-unwrapped; cc = pkgs.llvmPackages.clang-unwrapped;
libc = pkgs.darwin.Libsystem; libc = pkgs.darwin.Libsystem;

View File

@ -64,7 +64,7 @@ rec {
# the bootstrap. In all stages, we build an stdenv and the package # the bootstrap. In all stages, we build an stdenv and the package
# set that can be built with that stdenv. # set that can be built with that stdenv.
stageFun = stageFun =
{gccPlain, glibc, binutils, coreutils, name, overrides ? (pkgs: {}), extraBuildInputs ? []}: {gccPlain, glibc, binutils, coreutils, gnugrep, name, overrides ? (pkgs: {}), extraBuildInputs ? []}:
let let
@ -93,7 +93,7 @@ rec {
cc = gccPlain; cc = gccPlain;
isGNU = true; isGNU = true;
libc = glibc; libc = glibc;
inherit binutils coreutils; inherit binutils coreutils gnugrep;
name = name; name = name;
stdenv = stage0.stdenv; stdenv = stage0.stdenv;
}; };
@ -125,6 +125,7 @@ rec {
glibc = null; glibc = null;
binutils = null; binutils = null;
coreutils = null; coreutils = null;
gnugrep = null;
name = null; name = null;
overrides = pkgs: { overrides = pkgs: {
@ -160,6 +161,7 @@ rec {
inherit (stage0.pkgs) glibc; inherit (stage0.pkgs) glibc;
binutils = bootstrapTools; binutils = bootstrapTools;
coreutils = bootstrapTools; coreutils = bootstrapTools;
gnugrep = bootstrapTools;
name = "bootstrap-gcc-wrapper"; name = "bootstrap-gcc-wrapper";
# Rebuild binutils to use from stage2 onwards. # Rebuild binutils to use from stage2 onwards.
@ -184,6 +186,7 @@ rec {
inherit (stage1.pkgs) glibc; inherit (stage1.pkgs) glibc;
binutils = stage1.pkgs.binutils; binutils = stage1.pkgs.binutils;
coreutils = bootstrapTools; coreutils = bootstrapTools;
gnugrep = bootstrapTools;
name = "bootstrap-gcc-wrapper"; name = "bootstrap-gcc-wrapper";
overrides = pkgs: { overrides = pkgs: {
@ -200,6 +203,7 @@ rec {
gccPlain = bootstrapTools; gccPlain = bootstrapTools;
inherit (stage2.pkgs) glibc binutils; inherit (stage2.pkgs) glibc binutils;
coreutils = bootstrapTools; coreutils = bootstrapTools;
gnugrep = bootstrapTools;
name = "bootstrap-gcc-wrapper"; name = "bootstrap-gcc-wrapper";
overrides = pkgs: rec { overrides = pkgs: rec {
@ -228,6 +232,7 @@ rec {
# still from the bootstrap tools. # still from the bootstrap tools.
stage4 = stageFun { stage4 = stageFun {
inherit (stage3.pkgs) gccPlain glibc binutils; inherit (stage3.pkgs) gccPlain glibc binutils;
gnugrep = bootstrapTools;
coreutils = bootstrapTools; coreutils = bootstrapTools;
name = ""; name = "";
@ -244,7 +249,7 @@ rec {
isGNU = true; isGNU = true;
cc = stage4.stdenv.cc.cc; cc = stage4.stdenv.cc.cc;
libc = stage4.pkgs.glibc; libc = stage4.pkgs.glibc;
inherit (stage4.pkgs) binutils coreutils; inherit (stage4.pkgs) binutils coreutils gnugrep;
name = ""; name = "";
stdenv = stage4.stdenv; stdenv = stage4.stdenv;
shell = stage4.pkgs.bash + "/bin/bash"; shell = stage4.pkgs.bash + "/bin/bash";