Merge remote-tracking branch 'upstream/staging' into strictDeps

This commit is contained in:
John Ericson
2018-05-14 23:33:03 -04:00
4956 changed files with 139379 additions and 92174 deletions
+21 -42
View File
@@ -5,24 +5,22 @@
# script that sets up the right environment variables so that the
# compiler and the linker just "work".
{ name ? "", stdenvNoCC, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
{ name ? ""
, stdenvNoCC, nativeTools, propagateDoc ? !nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, cc ? null, libc ? null, bintools, coreutils ? null, shell ? stdenvNoCC.shell
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
, extraPackages ? [], extraBuildCommands ? ""
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
}:
with stdenvNoCC.lib;
assert nativeTools -> nativePrefix != "";
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
cc != null && coreutils != null && gnugrep != null;
assert !(nativeLibc && noLibc);
assert (noLibc || nativeLibc) == (libc == null);
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
assert cc.langVhdl or false -> zlib != null;
let
stdenv = stdenvNoCC;
inherit (stdenv) hostPlatform targetPlatform;
@@ -73,7 +71,7 @@ assert nativePrefix == bintools.nativePrefix;
stdenv.mkDerivation {
name = targetPrefix
+ (if name != "" then name else "${ccName}-wrapper")
+ (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
preferLocalBuild = true;
@@ -84,7 +82,7 @@ stdenv.mkDerivation {
inherit targetPrefix infixSalt;
outputs = [ "out" "man" ];
outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = {
# "cc" is the generic name for a C compiler, but there is no one for package
@@ -115,7 +113,7 @@ stdenv.mkDerivation {
''
set -u
mkdir -p $out/bin $out/nix-support $man/nix-support
mkdir -p $out/bin $out/nix-support
wrap() {
local dst="$1"
@@ -188,24 +186,18 @@ stdenv.mkDerivation {
+ optionalString cc.langGo or false ''
wrap ${targetPrefix}gccgo ${./cc-wrapper.sh} $ccPath/${targetPrefix}gccgo
''
+ optionalString cc.langAda or false ''
wrap ${targetPrefix}gnatgcc ${./cc-wrapper.sh} $ccPath/${targetPrefix}gnatgcc
wrap ${targetPrefix}gnatmake ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatmake
wrap ${targetPrefix}gnatbind ${./gnat-wrapper.sh} $ccPath/${targetPrefix}gnatbind
wrap ${targetPrefix}gnatlink ${./gnatlink-wrapper.sh} $ccPath/${targetPrefix}gnatlink
''
+ optionalString cc.langVhdl or false ''
ln -s $ccPath/${targetPrefix}ghdl $out/bin/${targetPrefix}ghdl
'';
strictDeps = true;
propagatedBuildInputs = [ bintools ];
depsTargetTargetPropagated = extraPackages;
setupHook = ./setup-hook.sh;
wrapperName = "CC_WRAPPER";
setupHooks = [
../setup-hooks/role.bash
./setup-hook.sh
];
postFixup =
''
@@ -247,7 +239,6 @@ stdenv.mkDerivation {
''
+ optionalString (!nativeTools) ''
##
## Initial CFLAGS
##
@@ -263,33 +254,21 @@ stdenv.mkDerivation {
ccLDFlags+=" -L${cc_solib}/lib"
ccCFlags+=" -B${cc_solib}/lib"
${optionalString cc.langVhdl or false ''
ccLDFlags+=" -L${zlib.out}/lib"
''}
# Find the gcc libraries path (may work only without multilib).
${optionalString cc.langAda or false ''
basePath=`echo ${cc_solib}/lib/*/*/*`
ccCFlags+=" -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
''}
echo "$ccLDFlags" > $out/nix-support/cc-ldflags
echo "$ccCFlags" > $out/nix-support/cc-cflags
''
+ optionalString propagateDoc ''
##
## User env support
## Man page and info support
##
# Propagate the wrapped cc so that if you install the wrapper,
# you get tools like gcov, the manpages, etc. as well (including
# for binutils and Glibc).
mkdir -p $man/nix-support $info/nix-support
printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages
printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages
''
+ ''
##
## Hardening support
##
@@ -304,18 +283,18 @@ stdenv.mkDerivation {
+ ''
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
substituteAll ${./utils.sh} $out/nix-support/utils.sh
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
##
## Extra custom steps
##
''
+ extraBuildCommands;
inherit expand-response-params;
# for substitution in utils.sh
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
meta =