|
128 | 128 | targetPackages.buildPackages.llvmPackages.llvm |
129 | 129 | targetPackages.buildPackages.binaryen |
130 | 130 | ]; |
131 | | - outputs = ["dev" "out"]; |
| 131 | + outputs = ["out" "dev"]; |
132 | 132 | NIX_NO_SELF_RPATH = true; |
133 | 133 | } '' |
134 | 134 | mkdir cbits |
|
147 | 147 | wasm-opt --low-memory-unused --converge --debuginfo --flatten --rereloop --gufa -O4 -Oz libffi.so -o $out/lib/libffi.so |
148 | 148 | ''; |
149 | 149 |
|
| 150 | + lib-wasm = buildPackages.symlinkJoin { |
| 151 | + name = "lib-wasm"; |
| 152 | + paths = [ targetPackages.wasilibc libffi-wasm ]; |
| 153 | + }; |
| 154 | + |
150 | 155 | # TODO check if this possible fix for segfaults works or not. |
151 | 156 | targetLibffi = |
152 | 157 | # on native platforms targetPlatform.{libffi, gmp} do not exist; thus fall back |
@@ -589,21 +594,27 @@ haskell-nix.haskellLib.makeCompilerDeps (stdenv.mkDerivation (rec { |
589 | 594 | configurePlatforms = [ "build" "host" ] ++ lib.optional (!targetPlatform.isGhcjs) "target"; |
590 | 595 |
|
591 | 596 | enableParallelBuilding = true; |
592 | | - postPatch = lib.optionalString (targetPlatform.isWasm) '' |
| 597 | + postPatch = '' |
| 598 | + patchShebangs . |
| 599 | + '' + lib.optionalString (targetPlatform.isWasm) '' |
593 | 600 | substituteInPlace utils/jsffi/dyld.mjs \ |
594 | 601 | --replace-fail \ |
595 | | - "node --disable-warning=ExperimentalWarning --experimental-wasm-type-reflection --no-turbo-fast-api-calls --wasm-lazy-validation" \ |
| 602 | + "${buildPackages.nodejs-with-lto}/bin/node --disable-warning=ExperimentalWarning --experimental-wasm-type-reflection --no-turbo-fast-api-calls --wasm-lazy-validation" \ |
596 | 603 | "${buildPackages.writeShellScriptBin "node" '' |
| 604 | + SCRIPT=$1 |
| 605 | + shift |
| 606 | + LIB_WASM=$1 |
| 607 | + shift |
597 | 608 | exec ${buildPackages.nodejs-with-lto}/bin/node \ |
598 | 609 | --disable-warning=ExperimentalWarning \ |
599 | 610 | --experimental-wasm-type-reflection \ |
600 | 611 | --no-turbo-fast-api-calls \ |
601 | 612 | --wasm-lazy-validation \ |
| 613 | + "$SCRIPT" \ |
| 614 | + "${lib-wasm}/lib" \ |
602 | 615 | "$@" |
603 | 616 | '' |
604 | | - }" |
605 | | - '' + '' |
606 | | - patchShebangs . |
| 617 | + }/bin/node" |
607 | 618 | ''; |
608 | 619 |
|
609 | 620 | outputs = [ "out" "doc" "generated" ]; |
|
0 commit comments