Build emscripten caches in sandbox
This makes it so that we actually build the various standard
library-like things built within the sandbox rather than being some
random files that I generate ad-hoc and copy into the correct folder.
This requires patching emcc so that it adds the necessary -isystem flags
when building those libraries.
Change-Id: I7b71b36cbbafd511df5d7a8396794aeee2403a05
diff --git a/tools/cpp/emscripten/emcc.sh b/tools/cpp/emscripten/emcc.sh
index 52ed893..814cd04 100755
--- a/tools/cpp/emscripten/emcc.sh
+++ b/tools/cpp/emscripten/emcc.sh
@@ -25,15 +25,17 @@
# Prepare the cache content so emscripten doesn't try to rebuild it all the time
cache_source=tools/cpp/emscripten/emscripten_cache
-if [ -d toolchain/emscripten_cache ]; then
- cache_source=toolchain/emscripten_cache
+# TODO(james): How do I avoid hardcoding this path? This is needed to make
+# gencache.sh work properly and to have it put the files in the correct spot.
+if [ -d bazel-out/host/bin/tools/cpp/emscripten/emscripten_cache ]; then
+ cache_source=bazel-out/host/bin/tools/cpp/emscripten/emscripten_cache
elif [ -d external/rules_emscripten/toolchain/emscripten_cache ]; then
cache_source=external/rules_emscripten/toolchain/emscripten_cache
fi
(
cd tmp/emscripten_cache;
for n in "../../$cache_source"/*;do
- ln -s "$n"
+ ln -f -s "$n"
done
)