kripken/emscripten — pull request #352 by SiggyBar (2012-04-04 18:16:24+00:00)
Title: Make it easier to use emscripten from a build system.

- Allow the configuration to be specified directly in the EM_CONFIG
environment variable instead of in a config file. The config file
approach has some shortcomings when using emscripten from a build
system (e.g. it uses a single global config file so it is hard to
configure emscripten in different ways from different build trees).
The presence of newlines in the EM_CONFIG string variable is used
to decide if the configuration is stored directly in the environment
variable or it is used to specify the config file (is this too much
of a hack?).

- Add EM_CACHE environment variable that can be used to control
where emscripten should store built libraries.

- Skip check_sanity() and check_engine() based on the presence of the
config file. When running from a build system, it is the build
system's responsibility that everything is set up correctly. Maybe
a new environment variable EM_CHECKS or something like that might
be better to decide whether or not to run these checks?

- Do not assume that the SPIDERMONKEY_ENGINE environment variable
is set.

- Fix link() to work with read-only llvm-stub file (this can be the
case if llvm is under source control, e.g. in Perforce). Also make
sure that the llvm-stub ends up in the temp directory (for Windows
emscripten used to leave an "a.exe" in the directory from where it
was invoked). This fix might be better to do in llvm-ld.cpp in
llvm itself, but fixing it in Emscripten was much faster (should
we file a bug request to llvm about this?).