https://github.com/python/cpython/commit/dc2552d429c91310b0c410c3e856728d8866b05f
commit: dc2552d429c91310b0c410c3e856728d8866b05f
branch: main
author: Hood Chatham <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2024-10-29T06:28:54Z
summary:

gh-124928: Emscripten node support: Clean up old node <= 16 flags (#124929)

Clean up configure flags for old node versions

These flags are only needed for node <= 16. Node 16 has been end of life since
October of 2023.

files:
A Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst
A Tools/wasm/emscripten/node_pre.js
M configure
M configure.ac

diff --git 
a/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst 
b/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst
new file mode 100644
index 00000000000000..291bf336ef225e
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2024-10-04-17-29-23.gh-issue-124928.FsGffe.rst
@@ -0,0 +1 @@
+Emscripten builds now require node >= 18.
diff --git a/Tools/wasm/emscripten/node_pre.js 
b/Tools/wasm/emscripten/node_pre.js
new file mode 100644
index 00000000000000..3490d3ca591ef6
--- /dev/null
+++ b/Tools/wasm/emscripten/node_pre.js
@@ -0,0 +1,9 @@
+// If process is undefined, we're not running in the node runtime let it go I
+// guess?
+if (typeof process !== "undefined") {
+    const nodeVersion = Number(process.versions.node.split('.',1)[0]);
+    if (nodeVersion < 18) {
+        process.stderr.write(`Node version must be >= 18, got version 
${process.version}\n`);
+        process.exit(1);
+    }
+}
diff --git a/configure b/configure
index 97113f1fd967fe..13c7d8a734ccf5 100755
--- a/configure
+++ b/configure
@@ -7758,61 +7758,6 @@ else
 fi
 
       HOSTRUNNER="$NODE"
-      # bigint for ctypes c_longlong, c_longdouble
-      # no longer available in Node 16
-      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for node 
--experimental-wasm-bigint" >&5
-printf %s "checking for node --experimental-wasm-bigint... " >&6; }
-if test ${ac_cv_tool_node_wasm_bigint+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-
-        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
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_tool_node_wasm_bigint" >&5
-printf "%s\n" "$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 :
-
-        as_fn_append HOSTRUNNER " --experimental-wasm-threads"
-        # no longer available in Node 16
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for node 
--experimental-wasm-bulk-memory" >&5
-printf %s "checking for node --experimental-wasm-bulk-memory... " >&6; }
-if test ${ac_cv_tool_node_wasm_bulk_memory+y}
-then :
-  printf %s "(cached) " >&6
-else $as_nop
-
-          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
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_tool_node_wasm_bulk_memory" >&5
-printf "%s\n" "$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"
@@ -9578,6 +9523,7 @@ fi
 then :
   wasm_debug=yes
 fi
+        as_fn_append LDFLAGS_NODIST " 
--pre-js=\$(srcdir)/Tools/wasm/emscripten/node_pre.js"
         as_fn_append LDFLAGS_NODIST " -sALLOW_MEMORY_GROWTH -sNODERAWFS"
         as_fn_append LINKFORSHARED " -sEXIT_RUNTIME"
         WASM_LINKFORSHARED_DEBUG="-gseparate-dwarf --emit-symbol-map"
diff --git a/configure.ac b/configure.ac
index 1534144bab3400..a470fd425880c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1622,34 +1622,6 @@ then
     [Emscripten/node*], [
       AC_PATH_TOOL([NODE], [node], [node])
       HOSTRUNNER="$NODE"
-      # bigint for ctypes c_longlong, c_longdouble
-      # no longer available in Node 16
-      AC_CACHE_CHECK([for node --experimental-wasm-bigint], 
[ac_cv_tool_node_wasm_bigint], [
-        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
-      ])
-      AS_VAR_IF([ac_cv_tool_node_wasm_bigint], [yes], [
-        AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bigint"])
-      ])
-
-      AS_VAR_IF([enable_wasm_pthreads], [yes], [
-        AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-threads"])
-        # no longer available in Node 16
-        AC_CACHE_CHECK([for node --experimental-wasm-bulk-memory], 
[ac_cv_tool_node_wasm_bulk_memory], [
-          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
-        ])
-        AS_VAR_IF([ac_cv_tool_node_wasm_bulk_memory], [yes], [
-          AS_VAR_APPEND([HOSTRUNNER], [" --experimental-wasm-bulk-memory"])
-        ])
-      ])
-
       AS_VAR_IF([host_cpu], [wasm64], [AS_VAR_APPEND([HOSTRUNNER], [" 
--experimental-wasm-memory64"])])
     ],
     dnl TODO: support other WASI runtimes
@@ -2424,6 +2396,7 @@ AS_CASE([$ac_sys_system],
       ],
       [node*], [
         AS_VAR_IF([ac_sys_emscripten_target], [node-debug], [wasm_debug=yes])
+        AS_VAR_APPEND([LDFLAGS_NODIST], [" 
--pre-js=\$(srcdir)/Tools/wasm/emscripten/node_pre.js"])
         AS_VAR_APPEND([LDFLAGS_NODIST], [" -sALLOW_MEMORY_GROWTH -sNODERAWFS"])
         AS_VAR_APPEND([LINKFORSHARED], [" -sEXIT_RUNTIME"])
         WASM_LINKFORSHARED_DEBUG="-gseparate-dwarf --emit-symbol-map"

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to