@@ -65,7 +65,7 @@ COMMON = arglist(
65
65
false = False
66
66
true = True
67
67
68
- TOGGLED_SHARED = PY_MODULE = IS_SHARED = false
68
+ PY_MODULE = IS_SHARED = false
69
69
SHARED_TARGET = SHARED = ""
70
70
71
71
MVP = env ("MVP" , true )
@@ -261,6 +261,9 @@ else:
261
261
262
262
elif not STATIC :
263
263
if arg .endswith (".so" ):
264
+ if not IS_SHARED :
265
+ LINKING = True
266
+
264
267
if arg .startswith ("/usr/lib" ):
265
268
arg = f"-l{ arg .rsplit ('/' ,1 )[- 1 ][3 :- 3 ]} "
266
269
if arg in ("-lportmidi" , "-lporttime" ):
@@ -269,7 +272,6 @@ else:
269
272
if arg .find ("wasm32-emscripten.so" ) > 0 or arg .find ("abi3.so" ) > 0 :
270
273
PY_MODULE = True
271
274
SHARED_TARGET = arg
272
- IS_SHARED = True
273
275
274
276
# FIX linking .so when it should have been .a for final exe without MAIN_MODULE set
275
277
# should be "LINKING" state
@@ -288,7 +290,6 @@ else:
288
290
IS_SHARED = True
289
291
continue
290
292
291
-
292
293
# duplicates can happen on cmake/rustc but they are expected to be here for a reason so skip them
293
294
if not (CMAKE or NINJA or RUSTC ):
294
295
# prevent duplicates objects/archives files on cmdline when linking
@@ -409,11 +410,8 @@ else:
409
410
if SIZEOPT and ("-sENVIRONMENT=web" not in out ):
410
411
final .append ("-sENVIRONMENT=web" )
411
412
412
-
413
- if IS_SHARED and not TOGGLED_SHARED :
414
- TOGGLED_SHARED = True
415
- SHARED = f"-shared -sASSERTIONS=0 -sSIDE_MODULE=1 -L{ PREFIX } /lib"
416
-
413
+ if IS_SHARED or (LINKING and PYMODULE ):
414
+ SHARED = f"-shared -sASSERTIONS=0 -sSIDE_MODULE=1"
417
415
418
416
# maybe not pass all WASM opts when -c + -o but always PIC and opt level
419
417
final .extend (arglist ("-fPIC" , SHARED , COPTS ))
0 commit comments