3
0
Fork 0
forked from mirrors/nixpkgs

rename gcc-wrapper to cc-wrapper.

also makes cc-wrapper compatible with clang in the darwin fork.
This commit is contained in:
Eric Seidel 2015-01-09 11:22:12 -08:00
parent e38c351f2b
commit 48f63c2f2e
17 changed files with 146 additions and 127 deletions

View file

@ -33,7 +33,7 @@ in
composableDerivation { composableDerivation {
# use gccApple to compile on darwin # use gccApple to compile on darwin
mkDerivation = ( if stdenv.isDarwin mkDerivation = ( if stdenv.isDarwin
then stdenvAdapters.overrideGCC stdenv gccApple then stdenvAdapters.overrideCC stdenv gccApple
else stdenv ).mkDerivation; else stdenv ).mkDerivation;
} (fix: { } (fix: {

View file

@ -8,7 +8,7 @@ let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {
# use gccApple to compile on darwin # use gccApple to compile on darwin
mkDerivation = ( if stdenv.isDarwin mkDerivation = ( if stdenv.isDarwin
then stdenvAdapters.overrideGCC stdenv gccApple then stdenvAdapters.overrideCC stdenv gccApple
else stdenv ).mkDerivation; else stdenv ).mkDerivation;
} (fix: { } (fix: {

View file

@ -6,7 +6,7 @@ if [ -e @out@/nix-support/libc-cflags ]; then
fi fi
if [ -e @out@/nix-support/gcc-cflags ]; then if [ -e @out@/nix-support/gcc-cflags ]; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE" export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE"
fi fi
if [ -e @out@/nix-support/gnat-cflags ]; then if [ -e @out@/nix-support/gnat-cflags ]; then
@ -18,7 +18,7 @@ if [ -e @out@/nix-support/libc-ldflags ]; then
fi fi
if [ -e @out@/nix-support/gcc-ldflags ]; then if [ -e @out@/nix-support/gcc-ldflags ]; then
export NIX_LDFLAGS+=" $(cat @out@/nix-support/gcc-ldflags)" export NIX_LDFLAGS+=" $(cat @out@/nix-support/cc-ldflags)"
fi fi
if [ -e @out@/nix-support/libc-ldflags-before ]; then if [ -e @out@/nix-support/libc-ldflags-before ]; then

View file

@ -79,6 +79,18 @@ if [ "$NIX_ENFORCE_PURITY" = 1 -a -n "$NIX_STORE" ]; then
params=("${rest[@]}") params=("${rest[@]}")
fi fi
if test -n "@libcxx@"; then
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem@libcxx@/include/c++/v1"
if [[ "@prog@" = *++ ]]; then
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -stdlib=libc++"
if test -z "$NIX_SKIP_CXX"; then
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L@libcxx@/lib -stdlib=libc++"
fi
if test -z "$NIX_SKIP_CXXABI" && echo "$@" | grep -qvw -- -nostdlib; then
NIX_CFLAGS_LINK="$NIX_CFLAGS_LINK -L@libcxxabi@/lib -lc++abi"
fi
fi
fi
# Add the flags for the C compiler proper. # Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE) extraAfter=($NIX_CFLAGS_COMPILE)

View file

@ -1,4 +1,4 @@
# The Nixpkgs GCC is not directly usable, since it doesn't know where # The Nixpkgs CC is not directly usable, since it doesn't know where
# the C library and standard header files are. Therefore the compiler # the C library and standard header files are. Therefore the compiler
# produced by that package cannot be installed directly in a user # produced by that package cannot be installed directly in a user
# environment and used from the command line. So we use a wrapper # environment and used from the command line. So we use a wrapper
@ -6,34 +6,35 @@
# compiler and the linker just "work". # compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell , cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
, zlib ? null, extraPackages ? [] , zlib ? null, extraPackages ? []
, libcxx ? null, libcxxabi ? null
}: }:
with stdenv.lib; with stdenv.lib;
assert nativeTools -> nativePrefix != ""; assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null && coreutils != null; assert !nativeTools -> cc != null && binutils != null && coreutils != 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.
assert gcc.langVhdl or false -> zlib != null; assert cc.langVhdl or false -> zlib != null;
let let
gccVersion = (builtins.parseDrvName gcc.name).version; ccVersion = (builtins.parseDrvName cc.name).version;
gccName = (builtins.parseDrvName gcc.name).name; ccName = (builtins.parseDrvName cc.name).name;
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = name =
(if name != "" then name else gccName + "-wrapper") + (if name != "" then name else ccName + "-wrapper") +
(if gcc != null && gccVersion != "" then "-" + gccVersion else ""); (if cc != null && ccVersion != "" then "-" + ccVersion else "");
preferLocalBuild = true; preferLocalBuild = true;
inherit gcc shell; inherit cc shell libcxx libcxxabi;
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 null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils. # The wrapper scripts use 'cat', so we may need coreutils.
@ -73,7 +74,7 @@ stdenv.mkDerivation {
# compile, because it uses "#include_next <limits.h>" to find the # compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem, # limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again. # another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags echo "-B$libc/lib/ -idirafter $libc/include -idirafter $cc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags echo "-L$libc/lib" > $out/nix-support/libc-ldflags
@ -86,43 +87,50 @@ stdenv.mkDerivation {
'' ''
+ (if nativeTools then '' + (if nativeTools then ''
gccPath="${nativePrefix}/bin" ccPath="${nativePrefix}/bin"
ldPath="${nativePrefix}/bin" ldPath="${nativePrefix}/bin"
'' else '' '' else ''
echo $gcc > $out/nix-support/orig-gcc echo $cc > $out/nix-support/orig-cc
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not # GCC shows $cc/lib in `gcc -print-search-dirs', but not
# $gcc/lib64 (even though it does actually search there...).. # $cc/lib64 (even though it does actually search there...)..
# This confuses libtool. So add it to the compiler tool search # This confuses libtool. So add it to the compiler tool search
# path explicitly. # path explicitly.
if [ -e "$gcc/lib64" -a ! -L "$gcc/lib64" ]; then if [ -e "$cc/lib64" -a ! -L "$cc/lib64" ]; then
gccLDFlags+=" -L$gcc/lib64" ccLDFlags+=" -L$cc/lib64"
gccCFlags+=" -B$gcc/lib64" ccCFlags+=" -B$cc/lib64"
fi fi
gccLDFlags+=" -L$gcc/lib" ccLDFlags+=" -L$cc/lib"
${optionalString gcc.langVhdl or false '' ${optionalString cc.langVhdl or false ''
gccLDFlags+=" -L${zlib}/lib" ccLDFlags+=" -L${zlib}/lib"
''} ''}
# Find the gcc libraries path (may work only without multilib). # Find the gcc libraries path (may work only without multilib).
${optionalString gcc.langAda or false '' ${optionalString cc.langAda or false ''
basePath=`echo $gcc/lib/*/*/*` basePath=`echo $cc/lib/*/*/*`
gccCFlags+=" -B$basePath -I$basePath/adainclude" ccCFlags+=" -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib" gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags echo "$gnatCFlags" > $out/nix-support/gnat-cflags
''} ''}
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags if [ -e $ccPath/clang ]; then
echo "$gccCFlags" > $out/nix-support/gcc-cflags # Need files like crtbegin.o from gcc
# It's unclear if these will ever be provided by an LLVM project
ccCFlags="$ccCFlags -B$basePath"
ccCFlags="$ccCFlags -isystem$cc/lib/clang/$ccVersion/include"
fi
gccPath="$gcc/bin" echo "$ccLDFlags" > $out/nix-support/cc-ldflags
echo "$ccCFlags" > $out/nix-support/cc-cflags
ccPath="$cc/bin"
ldPath="$binutils/bin" ldPath="$binutils/bin"
# Propagate the wrapped gcc so that if you install the wrapper, # Propagate the wrapped cc so that if you install the wrapper,
# you get tools like gcov, the manpages, etc. as well (including # you get tools like gcov, the manpages, etc. as well (including
# for binutils and Glibc). # for binutils and Glibc).
echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages echo $cc $binutils $libc > $out/nix-support/propagated-user-env-packages
echo ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs echo ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
'' ''
@ -136,7 +144,7 @@ stdenv.mkDerivation {
+ '' + ''
# Create a symlink to as (the assembler). This is useful when a # Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that # cc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called. # the right assembler is called.
if [ -e $ldPath/as ]; then if [ -e $ldPath/as ]; then
ln -s $ldPath/as $out/bin/as ln -s $ldPath/as $out/bin/as
@ -152,64 +160,56 @@ stdenv.mkDerivation {
wrap ld.bfd ${./ld-wrapper.sh} $binutils/bin/ld.bfd wrap ld.bfd ${./ld-wrapper.sh} $binutils/bin/ld.bfd
fi fi
if [ -e $gccPath/gcc ]; then if [ -e $ccPath/gcc ]; then
wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc wrap gcc ${./cc-wrapper.sh} $ccPath/gcc
ln -s gcc $out/bin/cc ln -s gcc $out/bin/cc
elif [ -e $gccPath/clang ]; then elif [ -e $ccPath/clang ]; then
wrap clang ${./gcc-wrapper.sh} $gccPath/clang wrap clang ${./cc-wrapper.sh} $ccPath/clang
ln -s clang $out/bin/cc ln -s clang $out/bin/cc
fi fi
if [ -e $gccPath/g++ ]; then if [ -e $ccPath/g++ ]; then
wrap g++ ${./gcc-wrapper.sh} $gccPath/g++ wrap g++ ${./cc-wrapper.sh} $ccPath/g++
ln -s g++ $out/bin/c++ ln -s g++ $out/bin/c++
elif [ -e $gccPath/clang++ ]; then elif [ -e $ccPath/clang++ ]; then
wrap clang++ ${./gcc-wrapper.sh} $gccPath/clang++ wrap clang++ ${./cc-wrapper.sh} $ccPath/clang++
ln -s clang++ $out/bin/c++ ln -s clang++ $out/bin/c++
fi fi
if [ -e $gccPath/cpp ]; then if [ -e $ccPath/cpp ]; then
wrap cpp ${./gcc-wrapper.sh} $gccPath/cpp wrap cpp ${./cc-wrapper.sh} $ccPath/cpp
fi fi
'' ''
+ optionalString gcc.langFortran or false '' + optionalString cc.langFortran or false ''
wrap gfortran ${./gcc-wrapper.sh} $gccPath/gfortran wrap gfortran ${./cc-wrapper.sh} $ccPath/gfortran
ln -sv gfortran $out/bin/g77 ln -sv gfortran $out/bin/g77
ln -sv gfortran $out/bin/f77 ln -sv gfortran $out/bin/f77
'' ''
+ optionalString gcc.langJava or false '' + optionalString cc.langJava or false ''
wrap gcj ${./gcc-wrapper.sh} $gccPath/gcj wrap gcj ${./cc-wrapper.sh} $ccPath/gcj
'' ''
+ optionalString gcc.langGo or false '' + optionalString cc.langGo or false ''
wrap gccgo ${./gcc-wrapper.sh} $gccPath/gccgo wrap ccgo ${./cc-wrapper.sh} $ccPath/gccgo
'' ''
+ optionalString gcc.langAda or false '' + optionalString cc.langAda or false ''
wrap gnatgcc ${./gcc-wrapper.sh} $gccPath/gnatgcc wrap gnatgcc ${./cc-wrapper.sh} $ccPath/gnatgcc
wrap gnatmake ${./gnat-wrapper.sh} $gccPath/gnatmake wrap gnatmake ${./gnat-wrapper.sh} $ccPath/gnatmake
wrap gnatbind ${./gnat-wrapper.sh} $gccPath/gnatbind wrap gnatbind ${./gnat-wrapper.sh} $ccPath/gnatbind
wrap gnatlink ${./gnatlink-wrapper.sh} $gccPath/gnatlink wrap gnatlink ${./gnatlink-wrapper.sh} $ccPath/gnatlink
'' ''
+ optionalString gcc.langVhdl or false '' + optionalString cc.langVhdl or false ''
ln -s $gccPath/ghdl $out/bin/ghdl ln -s $ccPath/ghdl $out/bin/ghdl
'' ''
+ '' + ''
substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook
substituteAll ${./add-flags} $out/nix-support/add-flags.sh substituteAll ${./add-flags} $out/nix-support/add-flags.sh
cp -p ${./utils.sh} $out/nix-support/utils.sh cp -p ${./utils.sh} $out/nix-support/utils.sh
if [ -e $out/bin/clang ]; then
echo 'export CC; : ''${CC:=clang}' >> $out/nix-support/setup-hook
fi
if [ -e $out/bin/clang++ ]; then
echo 'export CXX; : ''${CXX:=clang++}' >> $out/nix-support/setup-hook
fi
''; '';
# The dynamic linker has different names on different Linux platforms. # The dynamic linker has different names on different Linux platforms.
@ -229,7 +229,7 @@ stdenv.mkDerivation {
libc = stdenv.ccCross.libc; libc = stdenv.ccCross.libc;
coreutils = coreutils.crossDrv; coreutils = coreutils.crossDrv;
binutils = binutils.crossDrv; binutils = binutils.crossDrv;
gcc = gcc.crossDrv; cc = cc.crossDrv;
# #
# This is not the best way to do this. I think the reference should be # This is not the best way to do this. I think the reference should be
# the style in the gcc-cross-wrapper, but to keep a stable stdenv now I # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
@ -242,10 +242,10 @@ stdenv.mkDerivation {
}; };
meta = meta =
let gcc_ = if gcc != null then gcc else {}; in let cc_ = if cc != null then cc else {}; in
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) // (if cc_ ? meta then removeAttrs cc.meta ["priority"] else {}) //
{ description = { description =
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_ stdenv.lib.attrByPath ["meta" "description"] "System C compiler" cc_
+ " (wrapper script)"; + " (wrapper script)";
}; };
} }

View file

@ -18,8 +18,8 @@ envHooks+=(addCVars)
# Note: these come *after* $out in the PATH (see setup.sh). # Note: these come *after* $out in the PATH (see setup.sh).
if [ -n "@gcc@" ]; then if [ -n "@cc@" ]; then
addToSearchPath PATH @gcc@/bin addToSearchPath PATH @cc@/bin
fi fi
if [ -n "@binutils@" ]; then if [ -n "@binutils@" ]; then

View file

@ -8,7 +8,7 @@ rec {
# Override the compiler in stdenv for specific packages. # Override the compiler in stdenv for specific packages.
overrideGCC = stdenv: gcc: stdenv.override { allowedRequisites = null; cc = gcc; }; overrideCC = stdenv: cc: stdenv.override { allowedRequisites = null; cc = cc; };
# Add some arbitrary packages to buildInputs for specific packages. # Add some arbitrary packages to buildInputs for specific packages.

View file

@ -18,13 +18,13 @@ import ../generic rec {
system = stdenv.system; system = stdenv.system;
cc = import ../../build-support/gcc-wrapper { cc = import ../../build-support/cc-wrapper {
nativeTools = false; nativeTools = false;
nativeLibc = true; nativeLibc = true;
inherit stdenv; inherit stdenv;
extraPackages = stdenv.lib.optional haveLibCxx pkgs.libcxx; extraPackages = stdenv.lib.optional haveLibCxx pkgs.libcxx;
binutils = import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}; binutils = import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;};
gcc = if useClang33 then pkgs.clang_33.gcc else pkgs.clang.gcc; cc = if useClang33 then pkgs.clang_33.cc else pkgs.clang.cc;
coreutils = pkgs.coreutils; coreutils = pkgs.coreutils;
shell = pkgs.bash + "/bin/sh"; shell = pkgs.bash + "/bin/sh";
}; };

View file

@ -85,10 +85,10 @@ rec {
cc = if isNull gccPlain cc = if isNull gccPlain
then "/no-such-path" then "/no-such-path"
else lib.makeOverridable (import ../../build-support/gcc-wrapper) { else lib.makeOverridable (import ../../build-support/cc-wrapper) {
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
gcc = gccPlain; cc = gccPlain;
libc = glibc; libc = glibc;
inherit binutils coreutils; inherit binutils coreutils;
name = name; name = name;
@ -209,7 +209,7 @@ rec {
mpc = pkgs.mpc.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; mpc = pkgs.mpc.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
isl = pkgs.isl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; isl = pkgs.isl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
cloog = pkgs.cloog.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; }; cloog = pkgs.cloog.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
gccPlain = pkgs.gcc.gcc; gccPlain = pkgs.gcc.cc;
}; };
extraBuildInputs = [ stage2.pkgs.patchelf stage2.pkgs.paxctl ]; extraBuildInputs = [ stage2.pkgs.patchelf stage2.pkgs.paxctl ];
}; };
@ -229,10 +229,10 @@ rec {
# other purposes (binutils and top-level pkgs) too. # other purposes (binutils and top-level pkgs) too.
inherit (stage3.pkgs) gettext gnum4 gmp perl glibc zlib linuxHeaders; inherit (stage3.pkgs) gettext gnum4 gmp perl glibc zlib linuxHeaders;
gcc = lib.makeOverridable (import ../../build-support/gcc-wrapper) { gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
nativeTools = false; nativeTools = false;
nativeLibc = false; nativeLibc = false;
gcc = stage4.stdenv.cc.gcc; cc = stage4.stdenv.cc.cc;
libc = stage4.pkgs.glibc; libc = stage4.pkgs.glibc;
inherit (stage4.pkgs) binutils coreutils; inherit (stage4.pkgs) binutils coreutils;
name = ""; name = "";

View file

@ -98,8 +98,8 @@ rec {
}; };
cc = import ../../build-support/gcc-wrapper { cc = import ../../build-support/cc-wrapper {
name = "gcc-native"; name = "cc-native";
nativeTools = true; nativeTools = true;
nativeLibc = true; nativeLibc = true;
nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr"; nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr";

View file

@ -13,13 +13,13 @@ import ../generic rec {
system = stdenv.system; system = stdenv.system;
gcc = import ../../build-support/gcc-wrapper { cc = import ../../build-support/cc-wrapper {
nativeTools = false; nativeTools = false;
nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr"; nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
nativeLibc = true; nativeLibc = true;
inherit stdenv; inherit stdenv;
binutils = pkgs.binutils; binutils = pkgs.binutils;
gcc = pkgs.gcc.gcc; cc = pkgs.gcc.cc;
coreutils = pkgs.coreutils; coreutils = pkgs.coreutils;
shell = pkgs.bash + "/bin/sh"; shell = pkgs.bash + "/bin/sh";
}; };
@ -29,8 +29,8 @@ import ../generic rec {
fetchurlBoot = stdenv.fetchurlBoot; fetchurlBoot = stdenv.fetchurlBoot;
overrides = pkgs_: { overrides = pkgs_: {
inherit gcc; inherit cc;
inherit (gcc) binutils; inherit (cc) binutils;
inherit (pkgs) inherit (pkgs)
gzip bzip2 xz bash coreutils diffutils findutils gawk gzip bzip2 xz bash coreutils diffutils findutils gawk
gnumake gnused gnutar gnugrep gnupatch perl; gnumake gnused gnutar gnugrep gnupatch perl;

View file

@ -239,7 +239,7 @@ let
# just the plain stdenv. # just the plain stdenv.
stdenv_32bit = lowPrio ( stdenv_32bit = lowPrio (
if system == "x86_64-linux" then if system == "x86_64-linux" then
overrideGCC stdenv gcc48_multi overrideCC stdenv gcc48_multi
else else
stdenv); stdenv);
@ -2624,7 +2624,7 @@ let
torbutton = callPackage ../tools/security/torbutton { }; torbutton = callPackage ../tools/security/torbutton { };
torbrowser = callPackage ../tools/security/tor/torbrowser.nix { torbrowser = callPackage ../tools/security/tor/torbrowser.nix {
stdenv = overrideGCC stdenv gcc49; stdenv = overrideCC stdenv gcc49;
}; };
torsocks = callPackage ../tools/security/tor/torsocks.nix { }; torsocks = callPackage ../tools/security/tor/torsocks.nix { };
@ -3046,10 +3046,10 @@ let
ccl = callPackage ../development/compilers/ccl { }; ccl = callPackage ../development/compilers/ccl { };
clang = wrapGCC llvmPackages.clang; clang = wrapCC llvmPackages.clang;
clang_34 = wrapGCC llvmPackages_34.clang; clang_34 = wrapCC llvmPackages_34.clang;
clang_33 = wrapGCC (clangUnwrapped llvm_33 ../development/compilers/llvm/3.3/clang.nix); clang_33 = wrapCC (clangUnwrapped llvm_33 ../development/compilers/llvm/3.3/clang.nix);
clangAnalyzer = callPackage ../development/tools/analysis/clang-analyzer { clangAnalyzer = callPackage ../development/tools/analysis/clang-analyzer {
clang = clang_34; clang = clang_34;
@ -3062,8 +3062,8 @@ let
clangSelf = clangWrapSelf llvmPackagesSelf.clang; clangSelf = clangWrapSelf llvmPackagesSelf.clang;
clangWrapSelf = build: (import ../build-support/gcc-wrapper) { clangWrapSelf = build: (import ../build-support/cc-wrapper) {
gcc = build; cc = build;
stdenv = clangStdenv; stdenv = clangStdenv;
libc = glibc; libc = glibc;
binutils = binutils; binutils = binutils;
@ -3074,8 +3074,8 @@ let
}; };
#Use this instead of stdenv to build with clang #Use this instead of stdenv to build with clang
clangStdenv = if stdenv.isDarwin then stdenv else lowPrio (stdenvAdapters.overrideGCC stdenv clang); clangStdenv = if stdenv.isDarwin then stdenv else lowPrio (stdenvAdapters.overrideCC stdenv clang);
libcxxStdenv = stdenvAdapters.overrideGCC stdenv (clangWrapSelf llvmPackages.clang); libcxxStdenv = stdenvAdapters.overrideCC stdenv (clangWrapSelf llvmPackages.clang);
clean = callPackage ../development/compilers/clean { }; clean = callPackage ../development/compilers/clean { };
@ -3115,7 +3115,7 @@ let
gccApple = throw "gccApple is no longer supported"; gccApple = throw "gccApple is no longer supported";
gcc34 = wrapGCC (import ../development/compilers/gcc/3.4 { gcc34 = wrapCC (import ../development/compilers/gcc/3.4 {
inherit fetchurl stdenv noSysDirs; inherit fetchurl stdenv noSysDirs;
}); });
@ -3177,14 +3177,14 @@ let
cross = assert crossSystem != null; crossSystem; cross = assert crossSystem != null; crossSystem;
}; };
gcc44 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc/4.4) { gcc44 = lowPrio (wrapCC (makeOverridable (import ../development/compilers/gcc/4.4) {
inherit fetchurl stdenv gmp mpfr /* ppl cloogppl */ inherit fetchurl stdenv gmp mpfr /* ppl cloogppl */
gettext which noSysDirs; gettext which noSysDirs;
texinfo = texinfo4; texinfo = texinfo4;
profiledCompiler = true; profiledCompiler = true;
})); }));
gcc45 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.5 { gcc45 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.5 {
inherit fetchurl stdenv gmp mpfr mpc libelf zlib perl inherit fetchurl stdenv gmp mpfr mpc libelf zlib perl
gettext which noSysDirs; gettext which noSysDirs;
texinfo = texinfo4; texinfo = texinfo4;
@ -3207,7 +3207,7 @@ let
else null; else null;
})); }));
gcc46 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.6 { gcc46 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.6 {
inherit noSysDirs; inherit noSysDirs;
ppl = null; ppl = null;
@ -3229,7 +3229,7 @@ let
texinfo = texinfo413; texinfo = texinfo413;
})); }));
gcc48 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
inherit noSysDirs; inherit noSysDirs;
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion # PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
@ -3248,14 +3248,14 @@ let
gcc48_multi = gcc48_multi =
if system == "x86_64-linux" then lowPrio ( if system == "x86_64-linux" then lowPrio (
wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi (gcc48.gcc.override { wrapCCWith (import ../build-support/cc-wrapper) glibc_multi (gcc48.gcc.override {
stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc.gcc); stdenv = overrideCC stdenv (wrapCCWith (import ../build-support/cc-wrapper) glibc_multi gcc.gcc);
profiledCompiler = false; profiledCompiler = false;
enableMultilib = true; enableMultilib = true;
})) }))
else throw "Multilib gcc not supported on ${system}"; else throw "Multilib gcc not supported on ${system}";
gcc48_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { gcc48_debug = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
stripped = false; stripped = false;
inherit noSysDirs; inherit noSysDirs;
@ -3264,7 +3264,7 @@ let
binutilsCross = null; binutilsCross = null;
})); }));
gcc49 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.9 { gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 {
inherit noSysDirs; inherit noSysDirs;
# PGO seems to speed up compilation by gcc by ~10%, see #445 discussion # PGO seems to speed up compilation by gcc by ~10%, see #445 discussion
@ -3283,7 +3283,7 @@ let
gfortran = gfortran48; gfortran = gfortran48;
gfortran48 = wrapGCC (gcc48.gcc.override { gfortran48 = wrapCC (gcc48.cc.override {
name = "gfortran"; name = "gfortran";
langFortran = true; langFortran = true;
langCC = false; langCC = false;
@ -3293,7 +3293,7 @@ let
gcj = gcj48; gcj = gcj48;
gcj48 = wrapGCC (gcc48.gcc.override { gcj48 = wrapCC (gcc48.cc.override {
name = "gcj"; name = "gcj";
langJava = true; langJava = true;
langFortran = false; langFortran = false;
@ -3309,7 +3309,7 @@ let
gnat = gnat45; # failed to make 4.6 or 4.8 build gnat = gnat45; # failed to make 4.6 or 4.8 build
gnat45 = wrapGCC (gcc45.gcc.override { gnat45 = wrapCC (gcc45.cc.override {
name = "gnat"; name = "gnat";
langCC = false; langCC = false;
langC = true; langC = true;
@ -3328,14 +3328,14 @@ let
gccgo = gccgo48; gccgo = gccgo48;
gccgo48 = wrapGCC (gcc48.gcc.override { gccgo48 = wrapCC (gcc48.cc.override {
name = "gccgo"; name = "gccgo";
langCC = true; #required for go. langCC = true; #required for go.
langC = true; langC = true;
langGo = true; langGo = true;
}); });
ghdl = wrapGCC (import ../development/compilers/gcc/4.3 { ghdl = wrapCC (import ../development/compilers/gcc/4.3 {
inherit stdenv fetchurl gmp mpfr noSysDirs gnat; inherit stdenv fetchurl gmp mpfr noSysDirs gnat;
texinfo = texinfo4; texinfo = texinfo4;
name = "ghdl"; name = "ghdl";
@ -4020,7 +4020,18 @@ let
win32hello = callPackage ../development/compilers/visual-c++/test { }; win32hello = callPackage ../development/compilers/visual-c++/test { };
wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper { wrapCCWith = ccWrapper: libc: baseCC: ccWrapper {
nativeTools = stdenv.cc.nativeTools or false;
nativeLibc = stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or "";
cc = baseCC;
libc = libc;
inherit stdenv binutils coreutils zlib;
};
wrapCC = wrapCCWith (makeOverridable (import ../build-support/cc-wrapper)) glibc;
# legacy version, used for gnat bootstrapping
wrapGCC-old = baseGCC: (makeOverridable (import ../build-support/gcc-wrapper-old)) {
nativeTools = stdenv.cc.nativeTools or false; nativeTools = stdenv.cc.nativeTools or false;
nativeLibc = stdenv.cc.nativeLibc or false; nativeLibc = stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or ""; nativePrefix = stdenv.cc.nativePrefix or "";
@ -4029,10 +4040,6 @@ let
inherit stdenv binutils coreutils zlib; inherit stdenv binutils coreutils zlib;
}; };
wrapGCC = wrapGCCWith (makeOverridable (import ../build-support/gcc-wrapper)) glibc;
# legacy version, used for gnat bootstrapping
wrapGCC-old = wrapGCCWith (makeOverridable (import ../build-support/gcc-wrapper-old)) glibc;
wrapGCCCross = wrapGCCCross =
{gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}: {gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}:
@ -4361,7 +4368,7 @@ let
avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc { avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc {
gcc = gcc46; gcc = gcc46;
stdenv = overrideGCC stdenv gcc46; stdenv = overrideCC stdenv gcc46;
}; };
avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { };
@ -4517,8 +4524,8 @@ let
# }; # };
# #
ccacheWrapper = makeOverridable ({ extraConfig ? "" }: ccacheWrapper = makeOverridable ({ extraConfig ? "" }:
wrapGCC (ccache.links extraConfig)) {}; wrapCC (ccache.links extraConfig)) {};
ccacheStdenv = lowPrio (overrideGCC stdenv ccacheWrapper); ccacheStdenv = lowPrio (overrideCC stdenv ccacheWrapper);
cccc = callPackage ../development/tools/analysis/cccc { }; cccc = callPackage ../development/tools/analysis/cccc { };
@ -4600,8 +4607,8 @@ let
# }; # };
# #
distccWrapper = makeOverridable ({ extraConfig ? "" }: distccWrapper = makeOverridable ({ extraConfig ? "" }:
wrapGCC (distcc.links extraConfig)) {}; wrapCC (distcc.links extraConfig)) {};
distccStdenv = lowPrio (overrideGCC stdenv distccWrapper); distccStdenv = lowPrio (overrideCC stdenv distccWrapper);
distccMasquerade = if stdenv.isDarwin distccMasquerade = if stdenv.isDarwin
then null then null
@ -4772,7 +4779,7 @@ let
phantomjs = callPackage ../development/tools/phantomjs { phantomjs = callPackage ../development/tools/phantomjs {
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then overrideGCC stdenv gccApple then overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -4925,7 +4932,7 @@ let
# On Darwin, Valgrind 3.7.0 expects Apple's GCC (for # On Darwin, Valgrind 3.7.0 expects Apple's GCC (for
# `__private_extern'.) # `__private_extern'.)
if stdenv.isDarwin if stdenv.isDarwin
then overrideGCC stdenv gccApple then overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -5243,7 +5250,7 @@ let
vpxSupport = !stdenv.isMips; vpxSupport = !stdenv.isMips;
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then overrideGCC stdenv gccApple then overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -6141,7 +6148,7 @@ let
libmikmod = callPackage ../development/libraries/libmikmod { libmikmod = callPackage ../development/libraries/libmikmod {
# resolve the "stray '@' in program" errors # resolve the "stray '@' in program" errors
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then overrideGCC stdenv gccApple then overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -6250,7 +6257,7 @@ let
libproxy = callPackage ../development/libraries/libproxy { libproxy = callPackage ../development/libraries/libproxy {
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then overrideGCC stdenv gcc then overrideCC stdenv gcc
else stdenv; else stdenv;
}; };
@ -7072,7 +7079,7 @@ let
stfl = callPackage ../development/libraries/stfl { stfl = callPackage ../development/libraries/stfl {
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then overrideGCC stdenv gccApple then overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -10213,7 +10220,7 @@ let
irssi = callPackage ../applications/networking/irc/irssi { irssi = callPackage ../applications/networking/irc/irssi {
# compile with gccApple on darwin to support the -no-cpp-precompile flag # compile with gccApple on darwin to support the -no-cpp-precompile flag
stdenv = if stdenv.isDarwin stdenv = if stdenv.isDarwin
then stdenvAdapters.overrideGCC stdenv gccApple then stdenvAdapters.overrideCC stdenv gccApple
else stdenv; else stdenv;
}; };
@ -11542,7 +11549,7 @@ let
xdotool = callPackage ../tools/X11/xdotool { }; xdotool = callPackage ../tools/X11/xdotool { };
xen = callPackage ../applications/virtualization/xen { xen = callPackage ../applications/virtualization/xen {
stdenv = overrideGCC stdenv gcc45; stdenv = overrideCC stdenv gcc45;
}; };
xfe = callPackage ../applications/misc/xfe { xfe = callPackage ../applications/misc/xfe {
@ -11661,7 +11668,7 @@ let
(let callPackage = newScope pkgs.zathuraCollection; in (let callPackage = newScope pkgs.zathuraCollection; in
import ../applications/misc/zathura { import ../applications/misc/zathura {
inherit callPackage pkgs fetchurl; inherit callPackage pkgs fetchurl;
stdenv = overrideGCC stdenv gcc49; stdenv = overrideCC stdenv gcc49;
useMupdf = config.zathura.useMupdf or false; useMupdf = config.zathura.useMupdf or false;
}); });
@ -11673,7 +11680,7 @@ let
girara = callPackage ../applications/misc/girara { girara = callPackage ../applications/misc/girara {
gtk = gtk3; gtk = gtk3;
stdenv = overrideGCC stdenv gcc49; stdenv = overrideCC stdenv gcc49;
}; };
girara-light = callPackage ../applications/misc/girara { girara-light = callPackage ../applications/misc/girara {