ghc, go, guile: Use new pkgs*

`pkgsBuildTarget` allows us to avoid repeated and confusing conditions.
The others merely provide clarity for one the foreign package set's
target platform matters.
This commit is contained in:
John Ericson 2019-03-13 17:03:53 -04:00 committed by John Ericson
parent 70d71bbbe4
commit 655a29ff9c
9 changed files with 34 additions and 48 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages { stdenv, pkgsBuildTarget, targetPackages
# build-tools # build-tools
, bootPkgs , bootPkgs
@ -70,11 +70,9 @@ let
++ stdenv.lib.optional (!enableIntegerSimple) gmp ++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc") libiconv; ++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
toolsForTarget = toolsForTarget = [
if hostPlatform == buildPlatform then pkgsBuildTarget.targetPackages.stdenv.cc
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget; targetCC = builtins.head toolsForTarget;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages { stdenv, pkgsBuildTarget, targetPackages
# build-tools # build-tools
, bootPkgs , bootPkgs
@ -72,11 +72,9 @@ let
++ stdenv.lib.optional (!enableIntegerSimple) gmp ++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
toolsForTarget = toolsForTarget = [
if hostPlatform == buildPlatform then pkgsBuildTarget.targetPackages.stdenv.cc
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget; targetCC = builtins.head toolsForTarget;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages { stdenv, pkgsBuildTarget, targetPackages
# build-tools # build-tools
, bootPkgs , bootPkgs
@ -72,11 +72,9 @@ let
++ stdenv.lib.optional (!enableIntegerSimple) gmp ++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
toolsForTarget = toolsForTarget = [
if hostPlatform == buildPlatform then pkgsBuildTarget.targetPackages.stdenv.cc
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget; targetCC = builtins.head toolsForTarget;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages { stdenv, pkgsBuildTarget, targetPackages
# build-tools # build-tools
, bootPkgs , bootPkgs
@ -69,11 +69,9 @@ let
++ stdenv.lib.optional (!enableIntegerSimple) gmp ++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
toolsForTarget = toolsForTarget = [
if hostPlatform == buildPlatform then pkgsBuildTarget.targetPackages.stdenv.cc
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget; targetCC = builtins.head toolsForTarget;

View File

@ -1,7 +1,8 @@
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin { stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation , perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation
, mailcap, runtimeShell , mailcap, runtimeShell
, buildPackages, targetPackages }: , buildPackages, pkgsTargetTarget
}:
let let
@ -152,16 +153,12 @@ stdenv.mkDerivation rec {
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX # to be different from CC/CXX
CC_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc" "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"
else if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${stdenv.cc.targetPrefix}cc"
else else
null; null;
CXX_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++" "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"
else if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${stdenv.cc.targetPrefix}c++"
else else
null; null;

View File

@ -1,7 +1,8 @@
{ stdenv, fetchurl, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin { stdenv, fetchurl, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation , perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation
, mailcap, runtimeShell , mailcap, runtimeShell
, buildPackages, targetPackages }: , buildPackages, pkgsTargetTarget
}:
let let
@ -154,16 +155,12 @@ stdenv.mkDerivation rec {
# {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
# to be different from CC/CXX # to be different from CC/CXX
CC_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc" "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc"
else if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${stdenv.cc.targetPrefix}cc"
else else
null; null;
CXX_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++" "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++"
else if (stdenv.buildPlatform != stdenv.targetPlatform) then
"${stdenv.cc.targetPrefix}c++"
else else
null; null;

View File

@ -1,4 +1,4 @@
{ stdenv, buildPackages { stdenv, pkgsBuildBuild, buildPackages
, fetchurl, makeWrapper, gawk, pkgconfig , fetchurl, makeWrapper, gawk, pkgconfig
, libtool, readline, gmp , libtool, readline, gmp
}: }:
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
depsBuildBuild = [ buildPackages.stdenv.cc ] depsBuildBuild = [ buildPackages.stdenv.cc ]
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
buildPackages.buildPackages.guile_1_8; pkgsBuildBuild.guile_1_8;
nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
buildInputs = [ readline libtool ]; buildInputs = [ readline libtool ];

View File

@ -1,4 +1,4 @@
{ stdenv, buildPackages { stdenv, pkgsBuildBuild, buildPackages
, fetchpatch, fetchurl, makeWrapper, gawk, pkgconfig , fetchpatch, fetchurl, makeWrapper, gawk, pkgconfig
, libffi, libtool, readline, gmp, boehmgc, libunistring , libffi, libtool, readline, gmp, boehmgc, libunistring
, coverageAnalysis ? null , coverageAnalysis ? null
@ -22,7 +22,7 @@
depsBuildBuild = [ buildPackages.stdenv.cc ] depsBuildBuild = [ buildPackages.stdenv.cc ]
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
buildPackages.buildPackages.guile_2_0; pkgsBuildBuild.guile_2_0;
nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
buildInputs = [ readline libtool libunistring libffi ]; buildInputs = [ readline libtool libunistring libffi ];

View File

@ -1,4 +1,4 @@
{ stdenv, buildPackages { stdenv, pkgsBuildBuild, buildPackages
, fetchurl, makeWrapper, gawk, pkgconfig , fetchurl, makeWrapper, gawk, pkgconfig
, libffi, libtool, readline, gmp, boehmgc, libunistring , libffi, libtool, readline, gmp, boehmgc, libunistring
, coverageAnalysis ? null , coverageAnalysis ? null
@ -23,7 +23,7 @@
depsBuildBuild = [ buildPackages.stdenv.cc ] depsBuildBuild = [ buildPackages.stdenv.cc ]
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
buildPackages.buildPackages.guile; pkgsBuildBuild.guile;
nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
buildInputs = [ readline libtool libunistring libffi ]; buildInputs = [ readline libtool libunistring libffi ];