emscripten: node_modules fix, cache location fix

Changed files
+10 -2
pkgs
development
compilers
+9 -2
pkgs/development/compilers/emscripten/default.nix
···
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:
+1
pkgs/development/compilers/emscripten/locate_cache.sh
···
+
export EM_CACHE=${EM_CACHE:-"/tmp/$(basename $(realpath $(dirname $(which emcc))/..))_cache"}