Add support for cross compiling to js-ghcjs

This platform doesn't have a C compiler, and so relies and the changes
in the previous commit to work.
This commit is contained in:
John Ericson 2019-11-24 23:07:20 +00:00
parent 63bd851e95
commit c739c420db
3 changed files with 15 additions and 4 deletions

View file

@ -27,6 +27,8 @@ let
"riscv32-linux" "riscv64-linux"
"aarch64-none" "avr-none" "arm-none" "i686-none" "x86_64-none" "powerpc-none" "msp430-none" "riscv64-none" "riscv32-none"
"js-ghcjs"
];
allParsed = map parse.mkSystemFromString all;

View file

@ -121,9 +121,12 @@ stageFuns: let
postStage = buildPackages: {
__raw = true;
stdenv.cc =
if buildPackages.stdenv.cc.isClang or false
then buildPackages.clang
else buildPackages.gcc;
if buildPackages.stdenv.hasCC
then
if buildPackages.stdenv.cc.isClang or false
then buildPackages.clang
else buildPackages.gcc
else buildPackages.stdenv.cc;
};
in dfold folder postStage (_: {}) withAllowCustomOverrides

View file

@ -51,12 +51,18 @@ in lib.init bootStages ++ [
extraBuildInputs = [ ]; # Old ones run on wrong platform
allowedRequisites = null;
hasCC = !targetPlatform.isGhcjs;
cc = if crossSystem.useiOSPrebuilt or false
then buildPackages.darwin.iosSdkPkgs.clang
else if crossSystem.useAndroidPrebuilt or false
then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".clang
else if targetPlatform.isGhcjs
then null
# Need to use `throw` so tryEval for splicing works, ugh. Using
# `null` or skipping the attribute would cause an eval failure
# `tryEval` wouldn't catch, wrecking accessing previous stages
# when there is a C compiler and everything should be fine.
then throw "no C compile provided for this platform"
else if crossSystem.useLLVM or false
then buildPackages.llvmPackages_8.lldClang
else buildPackages.gcc;