emscripten: fake cc-wrapper-esque passthru attrs for GHC

For the GHC JavaScript backend, we'll use emscripten in place of
targetCC. To avoid having too much special logic for this, we'll make
the emscripten derivation look like the result of wrapCC as far as GHC
is concerned, i.e. we need targetPrefix and bintools.

For bintools, we'll just reexpose emscripten, as it has emar, the only
relevant bintools. That the other ones are missing doesn't matter in
practice, as the GHC build system won't attempt to use them.

targetPrefix can immediately be (ab)used to make sure GHC will correctly
call emcc etc. instead of plain cc.
This commit is contained in:
sternenseemann
2023-01-03 22:45:05 +01:00
parent a05354790b
commit 12af3ee5c5
@@ -3,6 +3,7 @@
, llvmPackages
, symlinkJoin, makeWrapper, substituteAll
, mkYarnModules
, emscripten
}:
stdenv.mkDerivation rec {
@@ -116,6 +117,13 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
passthru = {
# HACK: Make emscripten look more like a cc-wrapper to GHC
# when building the javascript backend.
targetPrefix = "em";
bintools = emscripten;
};
meta = with lib; {
homepage = "https://github.com/emscripten-core/emscripten";
description = "An LLVM-to-JavaScript Compiler";