Skip to content

Commit 1da67f1

Browse files
committed
Fix wasm and ghcjs TH code
1 parent 6b3b2b2 commit 1da67f1

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

compiler/ghc/default.nix

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,20 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
589589
configurePlatforms = [ "build" "host" ] ++ lib.optional (!targetPlatform.isGhcjs) "target";
590590

591591
enableParallelBuilding = true;
592-
postPatch = "patchShebangs .";
592+
postPatch = lib.optional (targetPlatform.isWasm) ''
593+
substituteInPlace utils/jsffi/dyld.mjs \
594+
--replace-fail \
595+
"node --disable-warning=ExperimentalWarning --experimental-wasm-type-reflection --no-turbo-fast-api-calls --wasm-lazy-validation" \
596+
"${buildPackages.writeShellScriptBin "node" ''
597+
exec ${buildPackages.nodejs_24}/bin/node \
598+
--disable-warning=ExperimentalWarning \
599+
--experimental-wasm-type-reflection \
600+
--no-turbo-fast-api-calls \
601+
--wasm-lazy-validation \
602+
"$@"
603+
''
604+
}"
605+
'' + "patchShebangs .";
593606

594607
outputs = [ "out" "doc" "generated" ];
595608

@@ -603,7 +616,8 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec {
603616
perl autoconf automake m4 python3 sphinx
604617
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
605618
] ++ lib.optional (patches != []) autoreconfHook
606-
++ lib.optional useLdLld llvmPackages.bintools;
619+
++ lib.optional useLdLld llvmPackages.bintools
620+
++ lib.optional (targetPlatform.isWasm) buildPackages.nodejs_24;
607621

608622
# For building runtime libs
609623
depsBuildTarget = toolsForTarget;

modules/install-plan/non-reinstallable.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"ghc-bignum"]
55
++ lib.optionals (builtins.compareVersions config.compiler.version "9.9" >= 0) [
66
"ghc-internal"]
7-
++ lib.optionals (pkgs.stdenv.hostPlatform.isGhcjs) ([
7+
++ lib.optionals (pkgs.stdenv.hostPlatform.isGhcjs || pkgs.stdenv.hostPlatform.isWasm) ([
88
# ghci and its dependencies
9-
"ghci" "binary" "bytestring" "containers" "template-haskell" "array" "deepseq" "file-io" "filepath" "ghc-boot" "ghc-boot-th" "ghc-heap" "transformers" "unix" "directory" "time" "ghc-platform" "os-string"]
9+
"ghci" "binary" "bytestring" "containers" "template-haskell" "array" "deepseq" "file-io" "filepath" "ghc-boot" "ghc-boot-th" "ghc-heap" "transformers" "unix" "directory" "time" "ghc-platform" "os-string" "exceptions" "stm" "ghc-experimental"]
1010
++ lib.optionals (builtins.compareVersions config.compiler.version "8.11" < 0) [
1111
"ghcjs-prim" "ghcjs-th"]);
1212
}

test/js-template-haskell/js-template-haskell.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ library
1212
exposed-modules: MyLib
1313
build-depends: base
1414
, uri-bytestring
15+
, th-orphans
1516
hs-source-dirs: src
1617
default-language: Haskell2010
1718

0 commit comments

Comments
 (0)