emscripten: node_modules fix, cache location fix (#419893)

This commit is contained in:
Will Cohen
2025-06-26 11:19:27 -04:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
@@ -114,15 +114,22 @@ stdenv.mkDerivation rec {
cp -r . $appdir
chmod -R +w $appdir
mkdir -p $appdir/node_modules
mkdir -p $appdir/node_modules/.bin
cp -r ${nodeModules}/* $appdir/node_modules
cp -r ${nodeModules}/* $appdir/node_modules/.bin
cp ${./locate_cache.sh} $appdir/locate_cache.sh
chmod +x $appdir/locate_cache.sh
export EM_CACHE=$out/share/emscripten/cache
mkdir -p $out/bin
for b in em++ em-config emar embuilder.py emcc emcmake emconfigure emmake emranlib emrun emscons emsize; do
makeWrapper $appdir/$b $out/bin/$b \
--set NODE_PATH ${nodeModules} \
--set EM_EXCLUSIVE_CACHE_ACCESS 1 \
--set PYTHON ${python3}/bin/python
--set PYTHON ${python3}/bin/python \
--run "source $appdir/locate_cache.sh"
done
# precompile libc (etc.) in all variants:
@@ -0,0 +1 @@
export EM_CACHE=${EM_CACHE:-"/tmp/$(basename $(realpath $(dirname $(which emcc))/..))_cache"}