diff options
author | sternenseemann <sternenseemann@systemli.org> | 2021-11-30 23:06:44 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2021-11-30 23:06:44 +0100 |
commit | c23e14e33f207dd38b6cc50401493d640a4745db (patch) | |
tree | d59aa6b956b485847b3d133b884509b17478484b /pkgs/development/compilers/ghc | |
parent | 19fc2292942cfcb7c07dade739989a64545d812f (diff) |
haskell.compiler.*: assert that host->target == build->target tools
CC, CXX, LD, AR, …, LLC, OPT and CLANG will be invoked by GHC's build system at build time in the build->target role. However, since we are passing absolute paths, they will get saved in GHC's settings file and later invoked at runtime, when they should be host->target. This means that the build->target and host->target tools need to be the same for our built GHC to work properly which is what we guard using these new asserts. Being able to drop these asserts would be a step towards cross-compiling GHC (as opposed to building a GHC cross-compiler which still works).
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r-- | pkgs/development/compilers/ghc/8.10.7.nix | 10 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/8.8.4.nix | 10 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.0.1.nix | 10 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.2.1.nix | 10 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/head.nix | 10 |
5 files changed, 45 insertions, 5 deletions
diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 49fe3417a4424..3f64b4fef53e7 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildTarget, targetPackages +{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages # build-tools , bootPkgs @@ -143,6 +143,14 @@ let ]; in + +# C compiler, bintools and LLVM are used at build time, but will also leak into +# the resulting GHC's settings file and used at runtime. This means that we are +# currently only able to build GHC if hostPlatform == buildPlatform. +assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; +assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; + stdenv.mkDerivation (rec { version = "8.10.7"; pname = "${targetPrefix}ghc${variantSuffix}"; diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 9232eac0ce185..438e47f4a5098 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildTarget, targetPackages +{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages # build-tools , bootPkgs @@ -151,6 +151,14 @@ let ]; in + +# C compiler, bintools and LLVM are used at build time, but will also leak into +# the resulting GHC's settings file and used at runtime. This means that we are +# currently only able to build GHC if hostPlatform == buildPlatform. +assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; +assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; + stdenv.mkDerivation (rec { version = "8.8.4"; pname = "${targetPrefix}ghc${variantSuffix}"; diff --git a/pkgs/development/compilers/ghc/9.0.1.nix b/pkgs/development/compilers/ghc/9.0.1.nix index fda5de7c25318..aea65aa479ef7 100644 --- a/pkgs/development/compilers/ghc/9.0.1.nix +++ b/pkgs/development/compilers/ghc/9.0.1.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildTarget, targetPackages +{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages # build-tools , bootPkgs @@ -138,6 +138,14 @@ let ]; in + +# C compiler, bintools and LLVM are used at build time, but will also leak into +# the resulting GHC's settings file and used at runtime. This means that we are +# currently only able to build GHC if hostPlatform == buildPlatform. +assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; +assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; + stdenv.mkDerivation (rec { version = "9.0.1"; pname = "${targetPrefix}ghc${variantSuffix}"; diff --git a/pkgs/development/compilers/ghc/9.2.1.nix b/pkgs/development/compilers/ghc/9.2.1.nix index 16543ce49bcd4..ad5cd4bbb8078 100644 --- a/pkgs/development/compilers/ghc/9.2.1.nix +++ b/pkgs/development/compilers/ghc/9.2.1.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildTarget, targetPackages +{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages # build-tools , bootPkgs @@ -139,6 +139,14 @@ let ]; in + +# C compiler, bintools and LLVM are used at build time, but will also leak into +# the resulting GHC's settings file and used at runtime. This means that we are +# currently only able to build GHC if hostPlatform == buildPlatform. +assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; +assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; + stdenv.mkDerivation (rec { version = "9.2.1"; pname = "${targetPrefix}ghc${variantSuffix}"; diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 35e52befe200d..79c72de63f268 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildTarget, targetPackages +{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages # build-tools , bootPkgs @@ -152,6 +152,14 @@ let ]; in + +# C compiler, bintools and LLVM are used at build time, but will also leak into +# the resulting GHC's settings file and used at runtime. This means that we are +# currently only able to build GHC if hostPlatform == buildPlatform. +assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; +assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; + stdenv.mkDerivation (rec { inherit version; inherit (src) rev; |