summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2017-09-20 01:25:02 -0400
committerGitHub <noreply@github.com>2017-09-20 01:25:02 -0400
commit19e3c580ad60319596cab44e1ed75640b69c09d4 (patch)
tree8a6ad702b34c982ceee4bd366f297b65b94877db
parentc1de354a3db238ddd1c125a77fd931566b2dda47 (diff)
parent1fc12241edb27fc9bb40b2c191f2718493a7f895 (diff)
downloadnixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar.gz
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar.bz2
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar.lz
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar.xz
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.tar.zst
nixpkgs-19e3c580ad60319596cab44e1ed75640b69c09d4.zip
Merge pull request #29584 from obsidiansystems/no-wrapCCCross
top-level: Remove useless abstractions
-rw-r--r--pkgs/applications/editors/vim/default.nix4
-rw-r--r--pkgs/development/compilers/emscripten-fastcomp/default.nix12
-rw-r--r--pkgs/os-specific/gnu/default.nix11
-rw-r--r--pkgs/top-level/all-packages.nix82
4 files changed, 55 insertions, 54 deletions
diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix
index 4eefb207fd7..2f110749277 100644
--- a/pkgs/applications/editors/vim/default.nix
+++ b/pkgs/applications/editors/vim/default.nix
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
 
   inherit (common) version src postPatch hardeningDisable enableParallelBuilding meta;
 
-  buildInputs = [ ncurses pkgconfig ]
+  nativeBuildInputs = [ gettext pkgconfig ];
+  buildInputs = [ ncurses ]
     ++ stdenv.lib.optionals hostPlatform.isDarwin [ Carbon Cocoa ];
-  nativeBuildInputs = [ gettext ];
 
   configureFlags = [
     "--enable-multibyte"
diff --git a/pkgs/development/compilers/emscripten-fastcomp/default.nix b/pkgs/development/compilers/emscripten-fastcomp/default.nix
index e543f799495..5d952073740 100644
--- a/pkgs/development/compilers/emscripten-fastcomp/default.nix
+++ b/pkgs/development/compilers/emscripten-fastcomp/default.nix
@@ -4,10 +4,14 @@ let
 
   self = {
     emscriptenfastcomp-unwrapped = callPackage ./emscripten-fastcomp.nix {};
-    emscriptenfastcomp-wrapped = wrapCCWith stdenv.cc.libc ''
-      # hardening flags break WASM support
-      cat > $out/nix-support/add-hardening.sh
-    '' self.emscriptenfastcomp-unwrapped;
+    emscriptenfastcomp-wrapped = wrapCCWith {
+      cc = self.emscriptenfastcomp-unwrapped;
+      libc = stdenv.cc.libc;
+      extraBuildCommands = ''
+        # hardening flags break WASM support
+        cat > $out/nix-support/add-hardening.sh
+      '';
+    };
     emscriptenfastcomp = symlinkJoin {
       name = "emscriptenfastcomp";
       paths = [ self.emscriptenfastcomp-wrapped self.emscriptenfastcomp-unwrapped ];
diff --git a/pkgs/os-specific/gnu/default.nix b/pkgs/os-specific/gnu/default.nix
index 247c73e468d..fb3796394e8 100644
--- a/pkgs/os-specific/gnu/default.nix
+++ b/pkgs/os-specific/gnu/default.nix
@@ -3,15 +3,22 @@
 args@{ fetchgit, stdenv, autoconf, automake, automake111x, libtool
 , texinfo, glibcCross, hurdPartedCross, libuuid, samba
 , gccCrossStageStatic, gccCrossStageFinal
-, forcedNativePackages, forceSystem, newScope, platform, config
+, forceSystem, newScope, platform, config
 , targetPlatform, buildPlatform
-, overrides ? {} }:
+, overrides ? {}
+, buildPackages, pkgs
+}:
 
 with args;
 
 let
   callPackage = newScope gnu;
 
+  forcedNativePackages =
+    if stdenv.hostPlatform == stdenv.buildPlatform
+    then pkgs
+    else buildPackages;
+
   gnu = {
     hurdCross = forcedNativePackages.callPackage ./hurd {
       inherit fetchgit stdenv autoconf libtool texinfo
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 068fa3230d6..60a3bc8394d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -29,8 +29,6 @@ with pkgs;
 
   callPackage_i686 = pkgsi686Linux.callPackage;
 
-  forcedNativePackages = if hostPlatform == buildPlatform then pkgs else buildPackages;
-
   # A stdenv capable of building 32-bit binaries.  On x86_64-linux,
   # it uses GCC compiled with multilib support; on i686-linux, it's
   # just the plain stdenv.
@@ -5390,17 +5388,22 @@ with pkgs;
   };
 
   wrapCCMulti = cc:
-    if system == "x86_64-linux" then lowPrio (
-      let
-        extraBuildCommands = ''
-          echo "dontMoveLib64=1" >> $out/nix-support/setup-hook
-        '';
-      in wrapCCWith glibc_multi extraBuildCommands (cc.cc.override {
-        stdenv = overrideCC stdenv (wrapCCWith glibc_multi "" cc.cc);
+    if system == "x86_64-linux" then lowPrio (wrapCCWith {
+      cc = cc.cc.override {
+        stdenv = overrideCC stdenv (wrapCCWith {
+          cc = cc.cc;
+          libc = glibc_multi;
+        });
         profiledCompiler = false;
         enableMultilib = true;
-      }))
-    else throw "Multilib ${cc.name} not supported on ‘${system}’";
+      };
+
+      libc = glibc_multi;
+
+      extraBuildCommands = ''
+        echo "dontMoveLib64=1" >> $out/nix-support/setup-hook
+      '';
+  }) else throw "Multilib ${cc.name} not supported on ‘${system}’";
 
   gcc_multi = wrapCCMulti gcc;
 
@@ -5427,35 +5430,31 @@ with pkgs;
       if targetPlatform.libc == "msvcrt" then __targetPackages.windows.mingw_w64_headers
       else if targetPlatform.libc == "libSystem" then darwin.xcode
       else null;
-    in wrapCCCross {
-      cc = forcedNativePackages.gcc.cc.override {
+    in wrapCCWith {
+      name = "gcc-cross-wrapper";
+      cc = gcc.cc.override {
         crossStageStatic = true;
         langCC = false;
         libcCross = libcCross1;
         enableShared = false;
         # Why is this needed?
-        inherit (forcedNativePackages) binutils;
       };
       libc = libcCross1;
-      inherit (forcedNativePackages) binutils;
   };
 
   # Only needed for mingw builds
-  gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapCCCross {
+  gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapCCWith {
+    name = "gcc-cross-wrapper";
     cc = gccCrossStageStatic.gcc;
     libc = windows.mingw_headers2;
-    inherit (forcedNativePackages) binutils;
   };
 
-  gccCrossStageFinal = assert targetPlatform != buildPlatform; wrapCCCross {
-    cc = forcedNativePackages.gcc.cc.override {
+  gccCrossStageFinal = assert targetPlatform != buildPlatform; wrapCCWith {
+    name = "gcc-cross-wrapper";
+    cc = gcc.cc.override {
       crossStageStatic = false;
-
-      # Why is this needed?
-      inherit (forcedNativePackages) binutils;
     };
     libc = libcCross;
-    inherit (forcedNativePackages) binutils;
   };
 
   gcc45 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.5 {
@@ -6207,19 +6206,24 @@ with pkgs;
 
   wla-dx = callPackage ../development/compilers/wla-dx { };
 
-  wrapCCWith = libc: extraBuildCommands: baseCC: ccWrapperFun {
-    nativeTools = stdenv.cc.nativeTools or false;
-    nativeLibc = stdenv.cc.nativeLibc or false;
+  wrapCCWith = { name ? "", cc, libc, extraBuildCommands ? "" }: ccWrapperFun {
+    nativeTools = targetPlatform == hostPlatform && stdenv.cc.nativeTools or false;
+    nativeLibc = targetPlatform == hostPlatform && stdenv.cc.nativeLibc or false;
     nativePrefix = stdenv.cc.nativePrefix or "";
-    cc = baseCC;
-    isGNU = baseCC.isGNU or false;
-    isClang = baseCC.isClang or false;
-    inherit libc extraBuildCommands;
+    noLibc = (libc == null);
+
+    isGNU = cc.isGNU or false;
+    isClang = cc.isClang or false;
+
+    inherit name cc libc extraBuildCommands;
   };
 
   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
   wrapGCC-old = baseGCC: callPackage ../build-support/gcc-wrapper-old {
     nativeTools = stdenv.cc.nativeTools or false;
@@ -6229,20 +6233,6 @@ with pkgs;
     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
   yap = callPackage ../development/compilers/yap { };
 
@@ -7334,7 +7324,7 @@ with pkgs;
      cross_renaming: we should make all programs use pkgconfig as
      nativeBuildInput after the renaming.
      */
-  pkgconfig = forcedNativePackages.callPackage ../development/tools/misc/pkgconfig {
+  pkgconfig = callPackage ../development/tools/misc/pkgconfig {
     fetchurl = fetchurlBoot;
   };
   pkgconfigUpstream = lowPrio (pkgconfig.override { vanilla = true; });