mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
haskell.compiler.ghc*: set stage 0 tools
This is easy in comparison since these tools won't end up in GHC's settings nor need to be available at runtime, so we can use the *_FOR_BUILD environment variables. It is important to add buildCC to depsBuildBuild to engage the stdenv/wrapper script machinery properly. Co-authored-by: sternenseemann <sternenseemann@systemli.org>
This commit is contained in:
parent
08a9878b23
commit
cd31b04413
@ -1,4 +1,4 @@
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, buildPackages, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
@ -134,6 +134,7 @@ let
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
buildCC = buildPackages.stdenv.cc;
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# toolPath calculates the absolute path to the name tool associated with a
|
||||
@ -299,6 +300,10 @@ stdenv.mkDerivation (rec {
|
||||
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
'' + ''
|
||||
# No need for absolute paths since these tools only need to work during the build
|
||||
export CC_STAGE0="$CC_FOR_BUILD"
|
||||
export LD_STAGE0="$LD_FOR_BUILD"
|
||||
export AR_STAGE0="$AR_FOR_BUILD"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
@ -372,6 +377,10 @@ stdenv.mkDerivation (rec {
|
||||
sphinx
|
||||
];
|
||||
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
];
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
, stdenv
|
||||
, pkgsBuildTarget
|
||||
, pkgsHostTarget
|
||||
, buildPackages
|
||||
, targetPackages
|
||||
, fetchpatch
|
||||
|
||||
@ -265,6 +266,7 @@ let
|
||||
else pkgsBuildTarget.targetPackages.stdenv.cc)
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
buildCC = buildPackages.stdenv.cc;
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# toolPath calculates the absolute path to the name tool associated with a
|
||||
@ -346,6 +348,10 @@ stdenv.mkDerivation ({
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
export "''${env#TARGET_}=''${!env}"
|
||||
done
|
||||
# No need for absolute paths since these tools only need to work during the build
|
||||
export CC_STAGE0="$CC_FOR_BUILD"
|
||||
export LD_STAGE0="$LD_FOR_BUILD"
|
||||
export AR_STAGE0="$AR_FOR_BUILD"
|
||||
# GHC is a bit confused on its cross terminology, as these would normally be
|
||||
# the *host* tools.
|
||||
export CC="${toolPath "cc" targetCC}"
|
||||
@ -484,6 +490,10 @@ stdenv.mkDerivation ({
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
];
|
||||
|
||||
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
, url ? "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"
|
||||
}:
|
||||
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
|
||||
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, buildPackages, targetPackages
|
||||
|
||||
# build-tools
|
||||
, bootPkgs
|
||||
@ -134,6 +134,7 @@ let
|
||||
pkgsBuildTarget.targetPackages.stdenv.cc
|
||||
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
|
||||
|
||||
buildCC = buildPackages.stdenv.cc;
|
||||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
# toolPath calculates the absolute path to the name tool associated with a
|
||||
@ -305,6 +306,11 @@ stdenv.mkDerivation (rec {
|
||||
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
|
||||
''
|
||||
+ ''
|
||||
# No need for absolute paths since these tools only need to work during the build
|
||||
export CC_STAGE0="$CC_FOR_BUILD"
|
||||
export LD_STAGE0="$LD_FOR_BUILD"
|
||||
export AR_STAGE0="$AR_FOR_BUILD"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
''
|
||||
+ lib.optionalString (lib.versionOlder version "9.2" || lib.versionAtLeast version "9.4") ''
|
||||
@ -393,6 +399,10 @@ stdenv.mkDerivation (rec {
|
||||
xattr
|
||||
];
|
||||
|
||||
# Used by the STAGE0 compiler to build stage1
|
||||
depsBuildBuild = [
|
||||
buildCC
|
||||
];
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user