[3.11] gh-95853: Add script to automate WASM build (GH-95828, GH-95985, GH-96045, GH-96389, GH-96744) (GH-96749)

Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.
This commit is contained in:
Christian Heimes 2022-09-13 12:06:39 +02:00 committed by GitHub
parent 390123b412
commit 4958820032
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 1237 additions and 41 deletions

168
configure generated vendored
View file

@ -888,6 +888,7 @@ AR
LINK_PYTHON_OBJS
LINK_PYTHON_DEPS
LIBRARY_DEPS
NODE
HOSTRUNNER
STATIC_LIBPYTHON
GNULD
@ -4038,6 +4039,16 @@ if test -z "$CFLAGS"; then
CFLAGS=
fi
case $host in #(
wasm64-*-emscripten) :
as_fn_append CFLAGS " -sMEMORY64=1"
as_fn_append LDFLAGS " -sMEMORY64=1"
;; #(
*) :
;;
esac
if test "$ac_sys_system" = "Darwin"
then
# Compiler selection on MacOSX is more complicated than
@ -6158,7 +6169,7 @@ cat > conftest.c <<EOF
# error unknown wasm32 platform
# endif
#elif defined(__wasm64__)
# if defined(__EMSCRIPTEN)
# if defined(__EMSCRIPTEN__)
wasm64-emscripten
# elif defined(__wasi__)
wasm64-wasi
@ -6778,19 +6789,162 @@ if test "$cross_compiling" = yes; then
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking HOSTRUNNER" >&5
$as_echo_n "checking HOSTRUNNER... " >&6; }
if test -z "$HOSTRUNNER"
then
case $ac_sys_system/$ac_sys_emscripten_target in #(
Emscripten/node*) :
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}node", so it can be a program name with args.
set dummy ${ac_tool_prefix}node; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_NODE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $NODE in
[\\/]* | ?:[\\/]*)
ac_cv_path_NODE="$NODE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_NODE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
NODE=$ac_cv_path_NODE
if test -n "$NODE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NODE" >&5
$as_echo "$NODE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_NODE"; then
ac_pt_NODE=$NODE
# Extract the first word of "node", so it can be a program name with args.
set dummy node; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_NODE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_NODE in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_NODE="$ac_pt_NODE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_NODE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_NODE=$ac_cv_path_ac_pt_NODE
if test -n "$ac_pt_NODE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_NODE" >&5
$as_echo "$ac_pt_NODE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_NODE" = x; then
NODE="node"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
NODE=$ac_pt_NODE
fi
else
NODE="$ac_cv_path_NODE"
fi
HOSTRUNNER="$NODE"
# bigint for ctypes c_longlong, c_longdouble
HOSTRUNNER="node --experimental-wasm-bigint"
# no longer available in Node 16
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for node --experimental-wasm-bigint" >&5
$as_echo_n "checking for node --experimental-wasm-bigint... " >&6; }
if ${ac_cv_tool_node_wasm_bigint+:} false; then :
$as_echo_n "(cached) " >&6
else
if $NODE -v --experimental-wasm-bigint > /dev/null 2>&1; then
ac_cv_tool_node_wasm_bigint=yes
else
ac_cv_tool_node_wasm_bigint=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tool_node_wasm_bigint" >&5
$as_echo "$ac_cv_tool_node_wasm_bigint" >&6; }
if test "x$ac_cv_tool_node_wasm_bigint" = xyes; then :
as_fn_append HOSTRUNNER " --experimental-wasm-bigint"
fi
if test "x$enable_wasm_pthreads" = xyes; then :
HOSTRUNNER="$HOSTRUNNER --experimental-wasm-threads --experimental-wasm-bulk-memory"
as_fn_append HOSTRUNNER " --experimental-wasm-threads"
# no longer available in Node 16
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for node --experimental-wasm-bulk-memory" >&5
$as_echo_n "checking for node --experimental-wasm-bulk-memory... " >&6; }
if ${ac_cv_tool_node_wasm_bulk_memory+:} false; then :
$as_echo_n "(cached) " >&6
else
if $NODE -v --experimental-wasm-bulk-memory > /dev/null 2>&1; then
ac_cv_tool_node_wasm_bulk_memory=yes
else
ac_cv_tool_node_wasm_bulk_memory=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tool_node_wasm_bulk_memory" >&5
$as_echo "$ac_cv_tool_node_wasm_bulk_memory" >&6; }
if test "x$ac_cv_tool_node_wasm_bulk_memory" = xyes; then :
as_fn_append HOSTRUNNER " --experimental-wasm-bulk-memory"
fi
fi
if test "x$host_cpu" = xwasm64; then :
as_fn_append HOSTRUNNER " --experimental-wasm-memory64"
fi
;; #(
WASI/*) :
@ -6801,6 +6955,8 @@ fi
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking HOSTRUNNER" >&5
$as_echo_n "checking HOSTRUNNER... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTRUNNER" >&5
$as_echo "$HOSTRUNNER" >&6; }
@ -6814,7 +6970,7 @@ $as_echo "$LDLIBRARY" >&6; }
# LIBRARY_DEPS, LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variable
case $ac_sys_system/$ac_sys_emscripten_target in #(
Emscripten/browser*) :
LIBRARY_DEPS='$(PY3LIBRARY) $(WASM_STDLIB)' ;; #(
LIBRARY_DEPS='$(PY3LIBRARY) $(WASM_STDLIB) python.html python.worker.js' ;; #(
*) :
LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)'
;;