@@ -245,21 +245,41 @@ if CONFIGURE and len(out) == 1:
245
245
if SKIP :
246
246
final .extend (sys .argv )
247
247
else :
248
- if EXE .endswith (".cjs" ) or EXE .endswith (".js" ):
249
-
250
- def make_exe (* argv , ** kw ):
251
- global CONFIGURE
252
- if os .path .isfile (EXE ) and not CONFIGURE :
253
- with open (EXE , "r" ) as file :
254
- bin = file .read ()
255
- with open (EXE , "w" ) as file :
256
- file .write ("#!/usr/bin/env node\n " )
257
- file .write (bin )
258
- os .chmod (EXE , 0o766 )
248
+ # should not happen
249
+ if EXE :
250
+ if EXE .endswith ('.o' ) and '-c' not in out :
251
+ final .append ('-c' )
252
+ EXE = False
253
+ MAIN_MODULE = False
254
+
255
+ if EXE :
256
+ if EXE .endswith (".cjs" ) or EXE .endswith (".js" ):
257
+ def make_exe (* argv , ** kw ):
258
+ global CONFIGURE
259
+ if os .path .isfile (EXE ) and not CONFIGURE :
260
+ with open (EXE , "r" ) as file :
261
+ bin = file .read ()
262
+ with open (EXE , "w" ) as file :
263
+ file .write ("#!/usr/bin/env node\n " )
264
+ file .write (bin )
265
+ os .chmod (EXE , 0o766 )
266
+ # the build system is old and exe has no suffix from cmake or configure
267
+ else :
268
+ def make_exe (* argv , ** kw ):
269
+ global CONFIGURE
270
+ if os .path .isfile (EXE ) and os .path .isfile (EXE + '.wasm' ) and not CONFIGURE :
271
+ os .rename (EXE , EXE + ".cjs" )
272
+ with open (EXE , "w" ) as file :
273
+ file .write ("#!/usr/bin/env bash\n " )
274
+ file .write ('node $0.cjs "$@"\n ' )
275
+ os .chmod (EXE , 0o766 )
259
276
260
277
final .append ("-sENVIRONMENT=node" )
278
+ final .append ("-sEXIT_RUNTIME" )
261
279
if USE_RAWFS :
280
+ #final.append("-sASYNCIFY")
262
281
final .append ("-sNODERAWFS" )
282
+
263
283
__import__ ("atexit" ).register (make_exe )
264
284
265
285
# do not pass WASM opts when -c/-o but always PIC and opt level
0 commit comments