@@ -255,248 +255,9 @@ unset _EMCC_CCACHE
255255unset _PYTHON_SYSCONFIGDATA_NAME
256256unset PYTHONHOME
257257unset PYTHONPATH
258- # if \$ {PYDK_CC:-false}
259- if true
260- then
261- $EMSDK_PYTHON -E $SDKROOT /emsdk-cc \$ 0.py "\$ @"
262- exit \$ ?
263- fi
264-
265-
266- # -Wwarn-absolute-paths
267- # --valid-abspath ${SDKROOT}
268-
269- # COMMON="-Wno-unsupported-floating-point-opt"
270- COMMON="-Wno-limited-postlink-optimizations -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function"
271- SHARED=""
272- IS_SHARED=false
273- PY_MODULE=false
274- MVP=\$ {MVP:true}
275- WASM_PURE=\$ {WASM_PURE:true}
276-
277-
278- if \$ MVP
279- then
280-
281- # turn of wasm ex (https://github.com/emscripten-core/emscripten/pull/20536)
282- # -fno-wasm-exceptions -sEMSCRIPTEN_LONGJMP=0
283-
284-
285- # -mcpu=generic would activate those https://reviews.llvm.org/D125728
286- # https://github.com/emscripten-core/emscripten/pull/17689
287-
288- # -fPIC not allowed with -mno-mutable-globals
289- # -mno-sign-ext not allowed with pthread
290-
291- #WASMOPTS="-fno-wasm-exceptions -sSUPPORT_LONGJMP=emscripten"
292- #CPU="-mnontrapping-fptoint -mno-reference-types -mno-sign-ext -m32"
293-
294- # -mno-bulk-memory <= this is problematic 2024-10-26
295-
296- CPU="-D_FILE_OFFSET_BITS=64 -sSUPPORT_LONGJMP=emscripten -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -m32"
297-
298- else
299- CPU="-D_FILE_OFFSET_BITS=64 -mcpu=bleeding-edge -m64"
300- fi
301-
302- # try to keep 32 but with 64 iface (bitint)
303- WASMEXTRA="$WASM_EXTRA \$ WASMOPTS"
304-
305-
306- LINKING=\$ {LINKING:-false}
307-
308- if echo "\$ @ "|grep -q "\\ .so "
309- then
310- LINKING=true
311- fi
312-
313-
314- declare -A seen=( )
315-
316- for arg do
317- shift
318-
319- if [ "\$ arg" = "-v" ]
320- then
321- $EMSDK_PYTHON -E \$ 0.py -v
322- exit 0
323- fi
324-
325- if [ "\$ arg" = "--version" ]
326- then
327- $EMSDK_PYTHON -E \$ 0.py --version
328- exit 0
329- fi
330-
331- if \$ LINKING
332- then
333- # prevent duplicates objects/archives files on cmdline when linking shared
334- if echo \$ arg|grep -q \\\\ .o\$
335- then
336- [[ \$ {seen[\$ arg]} ]] && continue
337- fi
338- if echo \$ arg|grep -q \\\\ .a\$
339- then
340- [[ \$ {seen[\$ arg]} ]] && continue
341- fi
342- if echo \$ arg|grep -q ^-l
343- then
344- [[ \$ {seen[\$ arg]} ]] && continue
345- fi
346- seen[\$ arg]=1
347- fi
348-
349- arg_is_bad=false
350-
351- for badarg in "-Wl,--as-needed" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-Wl,-znow" "-Wl,-zrelro" "-Wl,-zrelro,-znow"
352- do
353- if [ "\$ arg" = "\$ badarg" ]
354- then
355- arg_is_bad=true
356- break
357- fi
358- done
359-
360- if \$ arg_is_bad
361- then
362- continue
363- fi
364-
365- if [ "\$ arg" = "-c" ]
366- then
367- CPU_EXTRA=\$ WASM_EXTRA
368- fi
369-
370- if [ "\$ arg" = "-o" ]
371- then
372- CPU_EXTRA=\$ WASM_EXTRA
373- fi
374-
375- if [ "\$ arg" = "-fallow-argument-mismatch" ]
376- then
377- continue
378- fi
379-
380- if [ "\$ arg" = "-lutil" ]
381- then
382- continue
383- fi
384-
385- if [ "\$ arg" = "-O3" ]
386- then
387- continue
388- fi
389-
390- if [ "\$ arg" = "-g" ]
391- then
392- continue
393- fi
394-
395- if [ "\$ arg" = "-lgcc" ]
396- then
397- continue
398- fi
399-
400- if [ "\$ arg" = "-lgcc_s" ]
401- then
402- continue
403- fi
404-
405- if [ "\$ arg" = "-nomvp" ]
406- then
407- MVP=false
408- continue
409- fi
410-
411- if [ "\$ arg" = "-pthread" ]
412- then
413- if echo \$ CPU|grep -q mno-sign-ext
414- then
415- continue
416- fi
417- fi
418-
419-
420- # that is for some very bad setup.py behaviour regarding cross compiling.
421- # should not be needed ..
422- [ "\$ arg" = "-I/usr/include" ] && continue
423- [ "\$ arg" = "-I/usr/include/SDL2" ] && continue
424- [ "\$ arg" = "-L/usr/lib64" ] && continue
425- [ "\$ arg" = "-L/usr/lib" ] && continue
426- [ "\$ arg" = "-latomic" ] && continue
427-
428- if [ "\$ arg" = "-shared" ]
429- then
430- IS_SHARED=true
431- SHARED="\$ SHARED -sSIDE_MODULE"
432- fi
433-
434- if echo "\$ arg"|grep -q wasm32-emscripten.so\$
435- then
436- PY_MODULE=true
437- SHARED_TARGET=\$ arg
438- else
439- if echo "\$ arg"|grep -q abi3.so\$
440- then
441- PY_MODULE=true
442- SHARED_TARGET=\$ arg
443- fi
444- fi
445-
446- if \$ PY_MODULE
447- then
448- if \$ IS_SHARED
449- then
450- true
451- else
452- IS_SHARED=true
453- SHARED="\$ SHARED -shared -sSIDE_MODULE"
454- fi
455- else
456- if \$ IS_SHARED
457- then
458- if echo "\$ arg"|grep \\\\ .so\$
459- then
460- PY_MODULE=true
461- SHARED_TARGET=\$ arg
462- SHARED="-sSIDE_MODULE"
463- fi
464- fi
465- fi
466-
467- set -- "\$ @" "\$ arg"
468- done
469-
470- if \$ IS_SHARED
471- then
472- # always pass CPU opts when linking
473- $EMSDK_PYTHON -E \$ 0.py \$ SHARED $COPTS \$ CPU \$ WASM_EXTRA \$ LDFLAGS -sSIDE_MODULE -gsource-map --source-map-base / "\$ @" \$ COMMON
474- if \$ MVP
475- then
476- if \$ WASM_PURE
477- then
478- SOTMP=\$ (mktemp).so
479- mv \$ SHARED_TARGET \$ SOTMP
480- # --memory64-lowering --signext-lowering
481- $SDKROOT /emsdk/upstream/bin/wasm-emscripten-finalize -mvp \$ SOTMP -o \$ SHARED_TARGET
482- [ -f \$ SHARED_TARGET.map ] && rm \$ SHARED_TARGET.map
483- rm \$ SOTMP
484- fi
485- fi
486- else
487- # do not pass WASM opts when -c/-o but always PIC
488- if echo $@ |grep -q MAIN_MODULE
489- then
490- $EMSDK_PYTHON -E \$ 0.py $COPTS \$ CPU \$ CPU_EXTRA \$ CPPFLAGS -DBUILD_STATIC "\$ @" \$ COMMON
491- else
492- $EMSDK_PYTHON -E \$ 0.py $COPTS \$ CPU_EXTRA \$ CPPFLAGS -DBUILD_STATIC "\$ @" \$ COMMON
493- fi
494- fi
495- #else
496- # unset _EMCC_CCACHE
497- # exec ccache "\$ 0" "\$ @"
498- #fi
499258
259+ $EMSDK_PYTHON -E $SDKROOT /emsdk-cc \$ 0.py "\$ @"
260+ exit \$ ?
500261END
501262
502263 rm emsdk/upstream/emscripten/em++
0 commit comments