aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-25 14:21:22 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-25 14:21:22 -0500
commite26971d4efce418fa303499c11eb6b216f54a60f (patch)
treecdb9af5710c31799d8249b8a5f01b66953598314
parentdce4bc033cf7ae8ce4630991a7661446ecf5434e (diff)
EMCC_FORCE_STDLIBS option
-rwxr-xr-xemcc10
-rwxr-xr-xtests/runner.py8
2 files changed, 14 insertions, 4 deletions
diff --git a/emcc b/emcc
index 39c4282b..2f4bad2b 100755
--- a/emcc
+++ b/emcc
@@ -1054,8 +1054,10 @@ try:
libcxxabi_symbols = filter(lambda symbol: symbol not in libc_symbols, libcxxabi_symbols)
libcxxabi_symbols = set(libcxxabi_symbols)
- force = False # If we have libcxx, we must force inclusion of libc, since libcxx uses new internally. Note: this is kind of hacky
-
+ # If we have libcxx, we must force inclusion of libc, since libcxx uses new internally. Note: this is kind of hacky
+ # Settings this in the environment will avoid checking dependencies and make building big projects a little faster
+ force = os.environ.get('EMCC_FORCE_STDLIBS')
+ has = need = None
for name, create, fix, library_symbols in [('libcxx', create_libcxx, fix_libcxx, libcxx_symbols),
('libcxxabi', create_libcxxabi, fix_libcxxabi, libcxxabi_symbols),
('libc', create_libc, fix_libc, libc_symbols)]:
@@ -1077,7 +1079,7 @@ try:
# We need to build and link the library in
if DEBUG: print >> sys.stderr, 'emcc: including %s' % name
libfile = shared.Cache.get(name, create)
- if len(has) > 0:
+ if has and len(has) > 0:
# remove the symbols we do not need
fixed = in_temp(uniquename(libfile)) + '.bc'
shutil.copyfile(libfile, fixed)
@@ -1087,7 +1089,7 @@ try:
libfile = fixed
extra_files_to_link.append(libfile)
force = True
- if fix:
+ if fix and need:
fix(need)
# First, combine the bitcode files if there are several. We must also link if we have a singleton .a
diff --git a/tests/runner.py b/tests/runner.py
index 8410f888..46d040e1 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -7130,6 +7130,14 @@ def process(filename):
self.assertIdentical(clean(open('release.js').read()), clean(open('debug%d.js' % debug).read())) # EMCC_DEBUG=1 mode must not generate different code!
print >> sys.stderr, 'debug check %d passed too' % debug
+ try:
+ os.environ['EMCC_FORCE_STDLIBS'] = '1'
+ print 'EMCC_FORCE_STDLIBS'
+ do_test()
+ finally:
+ del os.environ['EMCC_FORCE_STDLIBS']
+ print >> sys.stderr, 'EMCC_FORCE_STDLIBS ok'
+
try_delete(CANONICAL_TEMP_DIR)
else:
print >> sys.stderr, 'not doing debug check'