emscripten: node_modules fix, cache location fix

This commit is contained in:
Gleb Dovzhenko 2025-05-28 16:37:17 +07:00 committed by Will Cohen
parent 262313d520
commit c2618fc5e3
2 changed files with 10 additions and 2 deletions

View File

@ -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:

View File

@ -0,0 +1 @@
export EM_CACHE=${EM_CACHE:-"/tmp/$(basename $(realpath $(dirname $(which emcc))/..))_cache"}