File tree-sitter-cflags.patch of Package nodejs-vscode-tree-sitter-wasm
--- vendor/tree-sitter/xtask/src/build_wasm.rs.orig 2025-02-18 03:54:23.000000000 +0100
+++ vendor/tree-sitter/xtask/src/build_wasm.rs 2025-04-06 14:49:06.426407440 +0200
@@ -36,7 +36,10 @@ const EXPORTED_RUNTIME_METHODS: [&str; 8
];
pub fn run_wasm(args: &BuildWasm) -> Result<()> {
- let mut emscripten_flags = vec!["-O3", "--minify", "0"];
+ let mut emscripten_flags:Vec<&str> = std::env::var("CFLAGS").ok().and_then(
+ |c| Some(Box::leak(c.into_boxed_str()).split_whitespace().collect())).unwrap_or_default();
+ emscripten_flags.extend::<Vec<&str>>(std::env::var("LDFLAGS").ok().and_then(
+ |c| Some(Box::leak(c.into_boxed_str()).split_whitespace().collect())).unwrap_or_default());
if args.debug {
emscripten_flags.extend(["-s", "ASSERTIONS=1", "-s", "SAFE_HEAP=1", "-O0", "-g"]);
@@ -150,7 +153,6 @@ pub fn run_wasm(args: &BuildWasm) -> Res
#[rustfmt::skip]
emscripten_flags.extend([
- "-gsource-map",
"--source-map-base", ".",
"-fno-exceptions",
"-std=c11",
@@ -158,7 +160,6 @@ pub fn run_wasm(args: &BuildWasm) -> Res
"-s", "MODULARIZE=1",
"-s", "INITIAL_MEMORY=33554432",
"-s", "ALLOW_MEMORY_GROWTH=1",
- "-s", "SUPPORT_BIG_ENDIAN=1",
"-s", "MAIN_MODULE=2",
"-s", "FILESYSTEM=0",
"-s", "NODEJS_CATCH_EXIT=0",