Fix precompiled library support + testing (#444)
Support multiple libraries for precompiled things, as we use a
different one for LTO, etc.
diff --git a/emsdk.py b/emsdk.py
index 19b733c..9e363fb 100755
--- a/emsdk.py
+++ b/emsdk.py
@@ -268,6 +268,8 @@
# Removes a directory tree even if it was readonly, and doesn't throw exception on failure.
def remove_tree(d):
debug_print('remove_tree(' + str(d) + ')')
+ if not os.path.exists(d):
+ return
try:
def remove_readonly_and_try_again(func, path, exc_info):
if not (os.stat(path).st_mode & stat.S_IWRITE):
@@ -2478,17 +2480,20 @@
def copy_pregenerated_cache(tools_to_activate):
for tool in tools_to_activate:
pregenerated_cache = getattr(tool, 'pregenerated_cache', None)
- if pregenerated_cache:
+ if not pregenerated_cache:
+ continue
+ for cache_dir in pregenerated_cache:
# Finish the install of an emscripten-releases build.
install_path = to_native_path(sdk_path(tool.expand_vars(tool.install_path)))
- in_cache = os.path.join(install_path, 'lib', pregenerated_cache)
- if os.path.exists(in_cache):
- out_cache = os.path.join(emscripten_cache_directory(), pregenerated_cache)
- os.makedirs(out_cache)
- for filename in os.listdir(in_cache):
- debug_print('Copying ' + filename + ' to cache dir')
- shutil.copy2(os.path.join(in_cache, filename),
- os.path.join(out_cache, filename))
+ in_cache = os.path.join(install_path, 'lib', cache_dir)
+ if not os.path.exists(in_cache):
+ continue
+ out_cache = os.path.join(emscripten_cache_directory(), cache_dir)
+ os.makedirs(out_cache)
+ for filename in os.listdir(in_cache):
+ debug_print('Copying %s to cache: %s' % (filename, out_cache))
+ shutil.copy2(os.path.join(in_cache, filename),
+ os.path.join(out_cache, filename))
# Reconfigure .emscripten to choose the currently activated toolset, set PATH
diff --git a/emsdk_manifest.json b/emsdk_manifest.json
index 39218d5..7b48344 100644
--- a/emsdk_manifest.json
+++ b/emsdk_manifest.json
@@ -114,7 +114,7 @@
"activated_path": "%installation_dir%/emscripten",
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
"emscripten_releases_hash": "%releases-tag%",
- "pregenerated_cache": "wasm-obj"
+ "pregenerated_cache": ["wasm", "wasm-obj", "wasm-bc"]
},
{
"id": "releases",
@@ -129,7 +129,7 @@
"activated_path": "%installation_dir%/emscripten",
"activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/bin/optimizer%.exe%'",
"emscripten_releases_hash": "%releases-tag%",
- "pregenerated_cache": "asmjs"
+ "pregenerated_cache": ["asmjs"]
},
{
diff --git a/test.py b/test.py
index ca7b13f..9a5cc35 100755
--- a/test.py
+++ b/test.py
@@ -56,7 +56,7 @@
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
-LIBC = os.path.expanduser('~/.emscripten_cache/wasm-obj/libc.a')
+LIBC = os.path.expanduser('~/.emscripten_cache/wasm/libc.a')
# Tests