From 12af3ee5c596b0a6798b299c97336fa3f5f063ed Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 3 Jan 2023 22:45:05 +0100 Subject: [PATCH] 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. --- pkgs/development/compilers/emscripten/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/compilers/emscripten/default.nix b/pkgs/development/compilers/emscripten/default.nix index 44ba33247b40..eca67f832102 100644 --- a/pkgs/development/compilers/emscripten/default.nix +++ b/pkgs/development/compilers/emscripten/default.nix @@ -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";