@@ -65,7 +65,7 @@ COMMON = arglist(
6565false = False
6666true = True
6767
68- TOGGLED_SHARED = PY_MODULE = IS_SHARED = false
68+ PY_MODULE = IS_SHARED = false
6969SHARED_TARGET = SHARED = ""
7070
7171MVP = env ("MVP" , true )
@@ -261,6 +261,9 @@ else:
261261
262262 elif not STATIC :
263263 if arg .endswith (".so" ):
264+ if not IS_SHARED :
265+ LINKING = True
266+
264267 if arg .startswith ("/usr/lib" ):
265268 arg = f"-l{ arg .rsplit ('/' ,1 )[- 1 ][3 :- 3 ]} "
266269 if arg in ("-lportmidi" , "-lporttime" ):
@@ -269,7 +272,6 @@ else:
269272 if arg .find ("wasm32-emscripten.so" ) > 0 or arg .find ("abi3.so" ) > 0 :
270273 PY_MODULE = True
271274 SHARED_TARGET = arg
272- IS_SHARED = True
273275
274276 # FIX linking .so when it should have been .a for final exe without MAIN_MODULE set
275277 # should be "LINKING" state
@@ -288,7 +290,6 @@ else:
288290 IS_SHARED = True
289291 continue
290292
291-
292293 # duplicates can happen on cmake/rustc but they are expected to be here for a reason so skip them
293294 if not (CMAKE or NINJA or RUSTC ):
294295 # prevent duplicates objects/archives files on cmdline when linking
@@ -409,11 +410,8 @@ else:
409410 if SIZEOPT and ("-sENVIRONMENT=web" not in out ):
410411 final .append ("-sENVIRONMENT=web" )
411412
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"
417415
418416 # maybe not pass all WASM opts when -c + -o but always PIC and opt level
419417 final .extend (arglist ("-fPIC" , SHARED , COPTS ))
0 commit comments