Merge pull request #29584 from obsidiansystems/no-wrapCCCross

top-level: Remove useless abstractions
This commit is contained in:
John Ericson 2017-09-20 01:25:02 -04:00 committed by GitHub
commit 19e3c580ad
4 changed files with 55 additions and 54 deletions

View File

@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
inherit (common) version src postPatch hardeningDisable enableParallelBuilding meta; inherit (common) version src postPatch hardeningDisable enableParallelBuilding meta;
buildInputs = [ ncurses pkgconfig ] nativeBuildInputs = [ gettext pkgconfig ];
buildInputs = [ ncurses ]
++ stdenv.lib.optionals hostPlatform.isDarwin [ Carbon Cocoa ]; ++ stdenv.lib.optionals hostPlatform.isDarwin [ Carbon Cocoa ];
nativeBuildInputs = [ gettext ];
configureFlags = [ configureFlags = [
"--enable-multibyte" "--enable-multibyte"

View File

@ -4,10 +4,14 @@ let
self = { self = {
emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {}; emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc '' emscriptenfastcomp-wrapped = wrapCCWith {
cc = self.emscriptenfastcomp-unwrapped;
libc = stdenv.cc.libc;
extraBuildCommands = ''
# hardening flags break WASM support # hardening flags break WASM support
cat > $out/nix-support/add-hardening.sh cat > $out/nix-support/add-hardening.sh
'' self.emscriptenfastcomp-unwrapped; '';
};
emscriptenfastcomp = symlinkJoin { emscriptenfastcomp = symlinkJoin {
name = "emscriptenfastcomp"; name = "emscriptenfastcomp";
paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ]; paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];

View File

@ -3,15 +3,22 @@
args@{ fetchgit, stdenv, autoconf, automake, automake111x, libtool args@{ fetchgit, stdenv, autoconf, automake, automake111x, libtool
, texinfo, glibcCross, hurdPartedCross, libuuid, samba , texinfo, glibcCross, hurdPartedCross, libuuid, samba
, gccCrossStageStatic, gccCrossStageFinal , gccCrossStageStatic, gccCrossStageFinal
, forcedNativePackages, forceSystem, newScope, platform, config , forceSystem, newScope, platform, config
, targetPlatform, buildPlatform , targetPlatform, buildPlatform
, overrides ? {} }: , overrides ? {}
, buildPackages, pkgs
}:
with args; with args;
let let
callPackage = newScope gnu; callPackage = newScope gnu;
forcedNativePackages =
if stdenv.hostPlatform == stdenv.buildPlatform
then pkgs
else buildPackages;
gnu = { gnu = {
hurdCross = forcedNativePackages.callPackage ./hurd { hurdCross = forcedNativePackages.callPackage ./hurd {
inherit fetchgit stdenv autoconf libtool texinfo inherit fetchgit stdenv autoconf libtool texinfo

View File

@ -29,8 +29,6 @@ with pkgs;
callPackage_i686 = pkgsi686Linux.callPackage; callPackage_i686 = pkgsi686Linux.callPackage;
forcedNativePackages = if hostPlatform == buildPlatform then pkgs else buildPackages;
# A stdenv capable of building 32-bit binaries. On x86_64-linux, # A stdenv capable of building 32-bit binaries. On x86_64-linux,
# it uses GCC compiled with multilib support; on i686-linux, it's # it uses GCC compiled with multilib support; on i686-linux, it's
# just the plain stdenv. # just the plain stdenv.
@ -5390,17 +5388,22 @@ with pkgs;
}; };
wrapCCMulti = cc: wrapCCMulti = cc:
if system == "x86_64-linux" then lowPrio ( if system == "x86_64-linux" then lowPrio (wrapCCWith {
let cc = cc.cc.override {
stdenv = overrideCC stdenv (wrapCCWith {
cc = cc.cc;
libc = glibc_multi;
});
profiledCompiler = false;
enableMultilib = true;
};
libc = glibc_multi;
extraBuildCommands = '' extraBuildCommands = ''
echo "dontMoveLib64=1" >> $out/nix-support/setup-hook echo "dontMoveLib64=1" >> $out/nix-support/setup-hook
''; '';
in wrapCCWith glibc_multi extraBuildCommands (cc.cc.override { }) else throw "Multilib ${cc.name} not supported on ${system}";
stdenv = overrideCC stdenv (wrapCCWith glibc_multi "" cc.cc);
profiledCompiler = false;
enableMultilib = true;
}))
else throw "Multilib ${cc.name} not supported on ${system}";
gcc_multi = wrapCCMulti gcc; gcc_multi = wrapCCMulti gcc;
@ -5427,35 +5430,31 @@ with pkgs;
if targetPlatform.libc == "msvcrt" then __targetPackages.windows.mingw_w64_headers if targetPlatform.libc == "msvcrt" then __targetPackages.windows.mingw_w64_headers
else if targetPlatform.libc == "libSystem" then darwin.xcode else if targetPlatform.libc == "libSystem" then darwin.xcode
else null; else null;
in wrapCCCross { in wrapCCWith {
cc = forcedNativePackages.gcc.cc.override { name = "gcc-cross-wrapper";
cc = gcc.cc.override {
crossStageStatic = true; crossStageStatic = true;
langCC = false; langCC = false;
libcCross = libcCross1; libcCross = libcCross1;
enableShared = false; enableShared = false;
# Why is this needed? # Why is this needed?
inherit (forcedNativePackages) binutils;
}; };
libc = libcCross1; libc = libcCross1;
inherit (forcedNativePackages) binutils;
}; };
# Only needed for mingw builds # Only needed for mingw builds
gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapCCCross { gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapCCWith {
name = "gcc-cross-wrapper";
cc = gccCrossStageStatic.gcc; cc = gccCrossStageStatic.gcc;
libc = windows.mingw_headers2; libc = windows.mingw_headers2;
inherit (forcedNativePackages) binutils;
}; };
gccCrossStageFinal = assert targetPlatform != buildPlatform; wrapCCCross { gccCrossStageFinal = assert targetPlatform != buildPlatform; wrapCCWith {
cc = forcedNativePackages.gcc.cc.override { name = "gcc-cross-wrapper";
cc = gcc.cc.override {
crossStageStatic = false; crossStageStatic = false;
# Why is this needed?
inherit (forcedNativePackages) binutils;
}; };
libc = libcCross; libc = libcCross;
inherit (forcedNativePackages) binutils;
}; };
gcc45 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.5 { gcc45 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.5 {
@ -6207,19 +6206,24 @@ with pkgs;
wla-dx = callPackage ../development/compilers/wla-dx { }; wla-dx = callPackage ../development/compilers/wla-dx { };
wrapCCWith = libc: extraBuildCommands: baseCC: ccWrapperFun { wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun {
nativeTools = stdenv.cc.nativeTools or false; nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
nativeLibc = stdenv.cc.nativeLibc or false; nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
nativePrefix = stdenv.cc.nativePrefix or ""; nativePrefix = stdenv.cc.nativePrefix or "";
cc = baseCC; noLibc = (libc == null);
isGNU = baseCC.isGNU or false;
isClang = baseCC.isClang or false; isGNU = cc.isGNU or false;
inherit libc extraBuildCommands; isClang = cc.isClang or false;
inherit name cc libc extraBuildCommands;
}; };
ccWrapperFun = callPackage ../build-support/cc-wrapper; ccWrapperFun = callPackage ../build-support/cc-wrapper;
wrapCC = wrapCCWith stdenv.cc.libc ""; wrapCC = cc: wrapCCWith {
inherit cc;
inherit (stdenv.cc) libc;
};
# legacy version, used for gnat bootstrapping # legacy version, used for gnat bootstrapping
wrapGCC-old = baseGCC: callPackage ../build-support/gcc-wrapper-old { wrapGCC-old = baseGCC: callPackage ../build-support/gcc-wrapper-old {
nativeTools = stdenv.cc.nativeTools or false; nativeTools = stdenv.cc.nativeTools or false;
@ -6229,20 +6233,6 @@ with pkgs;
libc = glibc; libc = glibc;
}; };
wrapCCCross =
{cc, libc, binutils, name ? "gcc-cross-wrapper"}:
forcedNativePackages.ccWrapperFun {
nativeTools = false;
nativeLibc = false;
noLibc = (libc == null);
isGNU = cc.isGNU or false;
isClang = cc.isClang or false;
inherit cc binutils libc name;
};
# prolog # prolog
yap = callPackage ../development/compilers/yap { }; yap = callPackage ../development/compilers/yap { };
@ -7334,7 +7324,7 @@ with pkgs;
cross_renaming: we should make all programs use pkgconfig as cross_renaming: we should make all programs use pkgconfig as
nativeBuildInput after the renaming. nativeBuildInput after the renaming.
*/ */
pkgconfig = forcedNativePackages.callPackage ../development/tools/misc/pkgconfig { pkgconfig = callPackage ../development/tools/misc/pkgconfig {
fetchurl = fetchurlBoot; fetchurl = fetchurlBoot;
}; };
pkgconfigUpstream = lowPrio (pkgconfig.override { vanilla = true; }); pkgconfigUpstream = lowPrio (pkgconfig.override { vanilla = true; });