Hi *,

While working on Qt for WebAssembly on windows, nmake fails to build with emscripten because MS have deemed it necessary to limit the filename extension to three digits.

Attached is a crude patch to change .html to .htm and .wasm to .was, which will allow builds using msvc/nmake to work. I am sure there is a better way to do this, it is just a fast and dirty patch.

I didn't both with .wast

My python foo is not good, so I didn't try to accommodate keeping .html and .wasm extensions as well I didn't see any platform specific code in there.


Thoughts?

Anyway someone would consider fixing this so msvc/nmake can build emscripten apps?

-
Lorn

--
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/emcc.py b/emcc.py
index 5a0e56340..b94abd4e4 100755
--- a/emcc.py
+++ b/emcc.py
@@ -64,13 +64,13 @@ SPECIAL_ENDINGLESS_FILENAMES = ('/dev/null',)
 SOURCE_ENDINGS = C_ENDINGS + CXX_ENDINGS + OBJC_ENDINGS + OBJCXX_ENDINGS + SPECIAL_ENDINGLESS_FILENAMES
 C_ENDINGS = C_ENDINGS + SPECIAL_ENDINGLESS_FILENAMES # consider the special endingless filenames like /dev/null to be C
 
-JS_CONTAINING_ENDINGS = ('.js', '.mjs', '.html')
+JS_CONTAINING_ENDINGS = ('.js', '.mjs', '.html', '.htm')
 BITCODE_ENDINGS = ('.bc', '.o', '.obj', '.lo')
 DYNAMICLIB_ENDINGS = ('.dylib', '.so') # Windows .dll suffix is not included in this list, since those are never linked to directly on the command line.
 STATICLIB_ENDINGS = ('.a',)
 ASSEMBLY_ENDINGS = ('.ll',)
 HEADER_ENDINGS = ('.h', '.hxx', '.hpp', '.hh', '.H', '.HXX', '.HPP', '.HH')
-WASM_ENDINGS = ('.wasm', '.wast')
+WASM_ENDINGS = ('.wasm', '.wast', '.was')
 
 SUPPORTED_LINKER_FLAGS = (
     '--start-group', '--end-group',
@@ -142,7 +142,7 @@ def save_intermediate_with_wasm(name, wasm_binary):
   if not DEBUG:
     return
   save_intermediate(name) # save the js
-  name = os.path.join(shared.get_emscripten_temp_dir(), 'emcc-%d-%s.wasm' % (Intermediate.counter - 1, name))
+  name = os.path.join(shared.get_emscripten_temp_dir(), 'emcc-%d-%s.was' % (Intermediate.counter - 1, name))
   shutil.copyfile(wasm_binary, name)
 
 
@@ -955,9 +955,9 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
 
     asm_target = unsuffixed(js_target) + '.asm.js' # might not be used, but if it is, this is the name
     wasm_text_target = asm_target.replace('.asm.js', '.wast') # ditto, might not be used
-    wasm_binary_target = asm_target.replace('.asm.js', '.wasm') # ditto, might not be used
+    wasm_binary_target = asm_target.replace('.asm.js', '.was') # ditto, might not be used
 
-    if final_suffix == '.html' and not options.separate_asm and 'PRECISE_F32=2' in settings_changes:
+    if final_suffix == '.htm' and not options.separate_asm and 'PRECISE_F32=2' in settings_changes:
       options.separate_asm = True
       logger.warning('forcing separate asm output (--separate-asm), because -s PRECISE_F32=2 was passed.')
     if options.separate_asm:
@@ -1000,7 +1000,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
 
     newargs = shared.COMPILER_OPTS + newargs
 
-    if options.separate_asm and final_suffix != '.html':
+    if options.separate_asm and final_suffix != '.htm':
       shared.WarningManager.warn('SEPARATE_ASM')
 
     # Apply optimization level settings
@@ -1343,7 +1343,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
       if not shared.Settings.WASM:
         options.memory_init_file = True
 
-    if shared.Settings.MODULARIZE and not shared.Settings.MODULARIZE_INSTANCE and shared.Settings.EXPORT_NAME == 'Module' and final_suffix == '.html' and \
+    if shared.Settings.MODULARIZE and not shared.Settings.MODULARIZE_INSTANCE and shared.Settings.EXPORT_NAME == 'Module' and final_suffix == '.htm' and \
        (options.shell_path == shared.path_from_root('src', 'shell.html') or options.shell_path == shared.path_from_root('src', 'shell_minimal.html')):
       exit_with_error('Due to collision in variable name "Module", the shell file "' + options.shell_path + '" is not compatible with build options "-s MODULARIZE=1 -s EXPORT_NAME=Module". Either provide your own shell file, change the name of the export to something else to avoid the name collision. (see https://github.com/emscripten-core/emscripten/issues/7950 for details)')
 
@@ -1689,7 +1689,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
               temp_files[pos] = (temp_files[pos][0], new_temp_file)
 
       # Decide what we will link
-      executable_endings = JS_CONTAINING_ENDINGS + ('.wasm',)
+      executable_endings = JS_CONTAINING_ENDINGS + ('.was',)
       stop_at_bitcode = final_suffix not in executable_endings
 
       if stop_at_bitcode or not shared.Settings.WASM_BACKEND:
@@ -1774,7 +1774,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
     with ToolchainProfiler.profile_block('link'):
       # final will be an array if linking is deferred, otherwise a normal string.
       if shared.Settings.WASM_BACKEND:
-        DEFAULT_FINAL = in_temp(target_basename + '.wasm')
+        DEFAULT_FINAL = in_temp(target_basename + '.was')
       else:
         DEFAULT_FINAL = in_temp(target_basename + '.bc')
 
@@ -1922,7 +1922,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
       if shared.Settings.WASM_BACKEND:
         # we also received wast and wasm at this stage
         temp_basename = unsuffixed(final)
-        wasm_temp = temp_basename + '.wasm'
+        wasm_temp = temp_basename + '.was'
         shutil.move(wasm_temp, wasm_binary_target)
         if use_source_map(options):
           shutil.move(wasm_temp + '.map', wasm_binary_target + '.map')
@@ -2006,7 +2006,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
          (shared.Settings.WASM_BACKEND and shared.Settings.USE_PTHREADS):
         if shared.Settings.MINIMAL_RUNTIME:
           # Independent of whether user is doing -o a.html or -o a.js, generate the mem init file as a.mem (and not as a.html.mem or a.js.mem)
-          memfile = target.replace('.html', '.mem').replace('.js', '.mem')
+          memfile = target.replace('.htm', '.mem').replace('.js', '.mem')
         else:
           memfile = target + '.mem'
 
@@ -2222,7 +2222,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
       generated_text_files_with_native_eols += [js_target]
 
       # If we were asked to also generate HTML, do that
-      if final_suffix == '.html':
+      if final_suffix == '.htm':
         generate_html(target, options, js_target, target_basename,
                       asm_target, wasm_binary_target,
                       memfile, optimizer)

Reply via email to