tree-sitter: embed path to `emcc` so `tree-sitter build --wasm` works

This commit is contained in:
Philip Taron 2024-04-03 12:36:20 -07:00
parent 234e847ba2
commit 4852095139
No known key found for this signature in database
2 changed files with 21 additions and 0 deletions

View File

@ -9,6 +9,7 @@
, Security
, callPackage
, linkFarm
, substitute
, CoreServices
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? stdenv.hostPlatform.isStatic
@ -117,6 +118,13 @@ rustPlatform.buildRustPackage {
[ which ]
++ lib.optionals webUISupport [ emscripten ];
patches = lib.optionals webUISupport [
(substitute {
src = ./fix-paths.patch;
substitutions = [ "--subst-var-by" "emcc" "${emscripten}/bin/emcc" ];
})
];
postPatch = lib.optionalString (!webUISupport) ''
# remove web interface
sed -e '/pub mod playground/d' \

View File

@ -0,0 +1,13 @@
diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs
index 9c1d8dfc..a5cfc74c 100644
--- a/cli/loader/src/lib.rs
+++ b/cli/loader/src/lib.rs
@@ -747,7 +747,7 @@ impl Loader {
Podman,
}
- let emcc_name = if cfg!(windows) { "emcc.bat" } else { "emcc" };
+ let emcc_name = if cfg!(windows) { "emcc.bat" } else { "@emcc@" };
// Order of preference: emscripten > docker > podman > error
let source = if !force_docker && Command::new(emcc_name).output().is_ok() {