treewide: Less {cc,bintools}-wrapper eta expansion

Also makes the LLVM ones more correct
This commit is contained in:
John Ericson 2018-05-22 19:21:35 -04:00 committed by John Ericson
parent 07d73c4ab0
commit 25e866a7fe
7 changed files with 41 additions and 63 deletions

View File

@ -1,5 +1,5 @@
{ newScope, stdenv, libstdcxxHook, cmake, libxml2, python2, isl, fetchurl { newScope, stdenv, libstdcxxHook, cmake, libxml2, python2, isl, fetchurl
, overrideCC, wrapCC, ccWrapperFun, darwin , overrideCC, wrapCCWith, darwin
}: }:
let let
@ -27,17 +27,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -1,4 +1,4 @@
{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun, darwin }: { newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCCWith, darwin }:
let let
callPackage = newScope (self // { inherit stdenv isl version fetch; }); callPackage = newScope (self // { inherit stdenv isl version fetch; });
@ -26,17 +26,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -1,4 +1,4 @@
{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun, darwin }: { newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCCWith, darwin }:
let let
callPackage = newScope (self // { inherit stdenv isl version fetch; }); callPackage = newScope (self // { inherit stdenv isl version fetch; });
@ -26,17 +26,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook { lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun , libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
, darwin , darwin
}: }:
@ -40,17 +40,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook { lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun , libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
, darwin , darwin
}: }:
@ -40,17 +40,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -1,5 +1,5 @@
{ lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook { lowPrio, newScope, stdenv, targetPlatform, cmake, libstdcxxHook
, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun , libxml2, python2, isl, fetchurl, overrideCC, wrapCCWith
, darwin , darwin
}: }:
@ -40,17 +40,13 @@ let
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang; clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun { libstdcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ]; extraPackages = [ libstdcxxHook ];
}; };
libcxxClang = ccWrapperFun { libcxxClang = wrapCCWith {
cc = self.clang-unwrapped; cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) bintools libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ]; extraPackages = [ self.libcxx self.libcxxabi ];
}; };

View File

@ -6996,42 +6996,46 @@ with pkgs;
wla-dx = callPackage ../development/compilers/wla-dx { }; wla-dx = callPackage ../development/compilers/wla-dx { };
wrapCCWith = { name ? "", cc, bintools, libc, extraBuildCommands ? "" }: wrapCCWith =
ccWrapperFun rec { { cc
, # This should be the only bintools runtime dep with this sort of logic. The
# Others should instead delegate to the next stage's choice with
# `targetPackages.stdenv.cc.bintools`. This one is different just to
# provide the default choice, avoiding infinite recursion.
bintools ? if targetPlatform.isDarwin then darwin.binutils else binutils
, libc ? bintools.libc
, ...
} @ extraArgs:
callPackage ../build-support/cc-wrapper (let self = {
nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false; nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false; nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or ""; nativePrefix = stdenv.cc.nativePrefix or "";
noLibc = !nativeLibc && (libc == null); noLibc = !self.nativeLibc && (self.libc == null);
isGNU = cc.isGNU or false; isGNU = cc.isGNU or false;
isClang = cc.isClang or false; isClang = cc.isClang or false;
inherit name cc bintools libc extraBuildCommands; inherit cc bintools libc;
}; } // extraArgs; in self);
ccWrapperFun = callPackage ../build-support/cc-wrapper;
bintoolsWrapperFun = callPackage ../build-support/bintools-wrapper;
wrapCC = cc: wrapCCWith { wrapCC = cc: wrapCCWith {
name = lib.optionalString (targetPlatform != hostPlatform) "gcc-cross-wrapper";
inherit cc; inherit cc;
# This should be the only bintools runtime dep with this sort of logic. The
# Others should instead delegate to the next stage's choice with
# `targetPackages.stdenv.cc.bintools`. This one is different just to
# provide the default choice, avoiding infinite recursion.
bintools = if targetPlatform.isDarwin then darwin.binutils else binutils;
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
}; };
wrapBintoolsWith = { bintools, libc, extraBuildCommands ? "" }: bintoolsWrapperFun { wrapBintoolsWith =
{ bintools
, libc ? if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc
, ...
} @ extraArgs:
callPackage ../build-support/bintools-wrapper (let self = {
nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false; nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false; nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or ""; nativePrefix = stdenv.cc.nativePrefix or "";
noLibc = (libc == null); noLibc = (self.libc == null);
inherit bintools libc extraBuildCommands; inherit bintools libc;
}; } // extraArgs; in self);
# prolog # prolog
yap = callPackage ../development/compilers/yap { }; yap = callPackage ../development/compilers/yap { };
@ -7637,11 +7641,9 @@ with pkgs;
noSysDirs = (targetPlatform != buildPlatform) || noSysDirs; noSysDirs = (targetPlatform != buildPlatform) || noSysDirs;
}; };
binutils = wrapBintoolsWith { binutils = wrapBintoolsWith {
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
bintools = binutils-unwrapped; bintools = binutils-unwrapped;
}; };
binutils_nogold = lowPrio (wrapBintoolsWith { binutils_nogold = lowPrio (wrapBintoolsWith {
libc = if targetPlatform != hostPlatform then libcCross else stdenv.cc.libc;
bintools = binutils-unwrapped.override { bintools = binutils-unwrapped.override {
gold = false; gold = false;
}; };