Use prebuilt cache contents (#282)

See WebAssembly/waterfall#542

The builds now contain lib/wasm-obj/ or lib/asmjs/ which have some cache contents. This places those in the cache so the user doesn't need to build them on first run, which for libc at least can be quite slow.

The mechanism here is to run emcc a first time in the emsdk. That clears the cache (since the emsdk just updated the .emscripten file). We can then safely place the files in the cache.

Note that FROZEN_CACHE is not used, since we do want to leave the user the option to build other things to the cache - we'll never ship all possible system and ports builds in the emsdk downloads, probably.

This contains a test, which passes on tot-upstream. The last tagged release doesn't have this yet.
This commit is contained in:
Alon Zakai
2019-06-25 12:41:28 -07:00
committed by GitHub
parent dffb280b35
commit 3e6d8b395f
3 changed files with 56 additions and 3 deletions

View File

@@ -34,6 +34,8 @@ open('hello_world.cpp', 'w').write('int main() {}')
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
LIBC = os.path.expanduser('~/.emscripten_cache/wasm-obj/libc.a')
# Tests
print('update')
@@ -54,9 +56,15 @@ assert 'fastcomp' not in open(os.path.expanduser('~/.emscripten')).read()
print('verify version')
checked_call_with_output('upstream/emscripten/emcc -v', TAGS['latest'], stderr=subprocess.STDOUT)
print('clear cache')
check_call('upstream/emscripten/emcc --clear-cache')
assert not os.path.exists(LIBC)
print('test tot-upstream')
check_call('./emsdk install tot-upstream')
assert not os.path.exists(LIBC)
check_call('./emsdk activate tot-upstream')
assert os.path.exists(LIBC), 'activation supplies prebuilt libc' # TODO; test on latest as well
check_call('upstream/emscripten/emcc hello_world.cpp')
print('test tot-fastcomp')