From 330ad8bcd888be8b9fa9af0a6848eefa62d6efd9 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 25 Apr 2022 15:38:21 -0700 Subject: [PATCH 1/6] Add HOSTRUNNER for program to run Python executable --- Makefile.pre.in | 20 +++++++++++--------- configure | 19 +++++++++++++++++++ configure.ac | 11 +++++++++++ 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index d9f821dd14e172..c9d88b02d2d985 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -285,6 +285,8 @@ LIBOBJS= @LIBOBJS@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) +HOSTRUNNER= @HOSTRUNNER@ + PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ @@ -1348,7 +1350,7 @@ regen-keyword: $(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new .PHONY: regen-stdlib-module-names -regen-stdlib-module-names: build_all Programs/_testembed +regen-stdlib-module-names: all Programs/_testembed # Regenerate Python/stdlib_module_names.h # using Tools/scripts/generate_stdlib_module_names.py $(RUNSHARED) ./$(BUILDPYTHON) \ @@ -1645,7 +1647,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) ###################################################################### TESTOPTS= $(EXTRATESTOPTS) -TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS) +TESTPYTHON= $(RUNSHARED) $(PYTHON_FOR_BUILD) $(TESTPYTHONOPTS) TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py TESTTIMEOUT= 1200 @@ -1653,7 +1655,7 @@ TESTTIMEOUT= 1200 # Remove "test_python_*" directories of previous failed test jobs. # Pass TESTOPTS options because it can contain --tempdir option. -cleantest: build_all +cleantest: all $(TESTRUNNER) $(TESTOPTS) --cleanup # Run a basic set of regression tests. @@ -1688,14 +1690,14 @@ testuniversal: @DEF_MAKE_RULE@ platform # Like testall, but with only one pass and without multiple processes. # Run an optional script to include information about the build environment. -buildbottest: build_all platform +buildbottest: all platform -@if which pybuildbot.identify >/dev/null 2>&1; then \ pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \ fi $(TESTRUNNER) -j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS) -pythoninfo: build_all - $(RUNSHARED) ./$(BUILDPYTHON) -m test.pythoninfo +pythoninfo: all + $(RUNSHARED) $(HOSTRUNNER) ./$(BUILDPYTHON) -m test.pythoninfo QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ test_multibytecodec test_urllib2_localnet test_itertools \ @@ -1708,10 +1710,10 @@ quicktest: @DEF_MAKE_RULE@ platform # SSL tests .PHONY: multisslcompile multissltest -multisslcompile: build_all +multisslcompile: all $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py --steps=modules -multissltest: build_all +multissltest: all $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/ssl/multissltests.py install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@ @@ -1983,7 +1985,7 @@ TESTSUBDIRS= ctypes/test \ unittest/test unittest/test/testmock TEST_MODULES=@TEST_MODULES@ -libinstall: build_all $(srcdir)/Modules/xxmodule.c +libinstall: all $(srcdir)/Modules/xxmodule.c @for i in $(SCRIPTDIR) $(LIBDEST); \ do \ if test ! -d $(DESTDIR)$$i; then \ diff --git a/configure b/configure index f161e4ebed94b6..a24b8918347f60 100755 --- a/configure +++ b/configure @@ -888,6 +888,7 @@ AR LINK_PYTHON_OBJS LINK_PYTHON_DEPS LIBRARY_DEPS +HOSTRUNNER STATIC_LIBPYTHON GNULD EXPORTSFROM @@ -1076,6 +1077,7 @@ LDFLAGS LIBS CPPFLAGS CPP +HOSTRUNNER PROFILE_TASK LIBUUID_CFLAGS LIBUUID_LIBS @@ -1878,6 +1880,7 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + HOSTRUNNER Program to run CPython for the host platform PROFILE_TASK Python args for PGO generation task LIBUUID_CFLAGS @@ -6671,6 +6674,22 @@ if test "$cross_compiling" = yes; then RUNSHARED= 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*) : + HOSTRUNNER='node' ;; #( + *) : + HOSTRUNNER='' + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTRUNNER" >&5 +$as_echo "$HOSTRUNNER" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDLIBRARY" >&5 $as_echo "$LDLIBRARY" >&6; } diff --git a/configure.ac b/configure.ac index 86839547e26835..c729b9e1fb2f42 100644 --- a/configure.ac +++ b/configure.ac @@ -1412,6 +1412,17 @@ if test "$cross_compiling" = yes; then RUNSHARED= fi +AC_ARG_VAR(HOSTRUNNER, Program to run CPython for the host platform) +AC_MSG_CHECKING(HOSTRUNNER) +if test -z "$HOSTRUNNER" +then + AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], + [Emscripten/node*], [HOSTRUNNER='node'], + [HOSTRUNNER=''] +) +fi +AC_MSG_RESULT($HOSTRUNNER) + AC_MSG_RESULT($LDLIBRARY) # LIBRARY_DEPS, LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variable From b329a8bacd18b77cecf0e887a8e6b9ecbd319a79 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 27 Apr 2022 13:08:41 -0700 Subject: [PATCH 2/6] Use square brackets around arguments Co-authored-by: Christian Heimes --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c729b9e1fb2f42..5f3a13aa9db90d 100644 --- a/configure.ac +++ b/configure.ac @@ -1412,8 +1412,8 @@ if test "$cross_compiling" = yes; then RUNSHARED= fi -AC_ARG_VAR(HOSTRUNNER, Program to run CPython for the host platform) -AC_MSG_CHECKING(HOSTRUNNER) +AC_ARG_VAR([HOSTRUNNER], [Program to run CPython for the host platform]) +AC_MSG_CHECKING([HOSTRUNNER]) if test -z "$HOSTRUNNER" then AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], From 803d6c02985bc002eb14a83cbd7834fb4ec43ea7 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 27 Apr 2022 13:08:51 -0700 Subject: [PATCH 3/6] Fix indentation Co-authored-by: Christian Heimes --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 5f3a13aa9db90d..7eb50ccbdac380 100644 --- a/configure.ac +++ b/configure.ac @@ -1416,10 +1416,10 @@ AC_ARG_VAR([HOSTRUNNER], [Program to run CPython for the host platform]) AC_MSG_CHECKING([HOSTRUNNER]) if test -z "$HOSTRUNNER" then - AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], - [Emscripten/node*], [HOSTRUNNER='node'], - [HOSTRUNNER=''] -) + AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], + [Emscripten/node*], [HOSTRUNNER='node'], + [HOSTRUNNER=''] + ) fi AC_MSG_RESULT($HOSTRUNNER) From 1fbeb00180f2e64338d80bedf90a1b96d4b76fea Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 27 Apr 2022 13:09:04 -0700 Subject: [PATCH 4/6] Use AC_SUBST Co-authored-by: Christian Heimes --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7eb50ccbdac380..fcba05211cf2a6 100644 --- a/configure.ac +++ b/configure.ac @@ -1421,7 +1421,8 @@ then [HOSTRUNNER=''] ) fi -AC_MSG_RESULT($HOSTRUNNER) +AC_SUBST([$HOSTRUNNER]) +AC_MSG_RESULT([$HOSTRUNNER]) AC_MSG_RESULT($LDLIBRARY) From 64bedefe7b56a2f50499af6df2ed717526493be2 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 27 Apr 2022 14:06:58 -0700 Subject: [PATCH 5/6] Add extra flags for threads if enabled Co-authored-by: Christian Heimes --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fcba05211cf2a6..be858ed442d86a 100644 --- a/configure.ac +++ b/configure.ac @@ -1417,7 +1417,13 @@ AC_MSG_CHECKING([HOSTRUNNER]) if test -z "$HOSTRUNNER" then AS_CASE([$ac_sys_system/$ac_sys_emscripten_target], - [Emscripten/node*], [HOSTRUNNER='node'], + [Emscripten/node*], [ + AS_VAR_IF([enable_wasm_pthreads], [yes], [ + HOSTRUNNER='node --experimental-wasm-threads --experimental-wasm-bulk-memory' + ], [ + HOSTRUNNER='node' + ]) + ], [HOSTRUNNER=''] ) fi From 1b3d7e1cf37b5d6c5dce15fb7486a721fc1fea08 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 27 Apr 2022 14:12:27 -0700 Subject: [PATCH 6/6] Fix configure.ac and run autoconf --- configure | 17 ++++++++++++++--- configure.ac | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/configure b/configure index a24b8918347f60..2c47a1e85c1452 100755 --- a/configure +++ b/configure @@ -6679,14 +6679,25 @@ fi $as_echo_n "checking HOSTRUNNER... " >&6; } if test -z "$HOSTRUNNER" then - case $ac_sys_system/$ac_sys_emscripten_target in #( + case $ac_sys_system/$ac_sys_emscripten_target in #( Emscripten/node*) : - HOSTRUNNER='node' ;; #( + + if test "x$enable_wasm_pthreads" = xyes; then : + + HOSTRUNNER='node --experimental-wasm-threads --experimental-wasm-bulk-memory' + +else + + HOSTRUNNER='node' + +fi + ;; #( *) : HOSTRUNNER='' - ;; + ;; esac fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTRUNNER" >&5 $as_echo "$HOSTRUNNER" >&6; } diff --git a/configure.ac b/configure.ac index be858ed442d86a..62da321a98af18 100644 --- a/configure.ac +++ b/configure.ac @@ -1427,7 +1427,7 @@ then [HOSTRUNNER=''] ) fi -AC_SUBST([$HOSTRUNNER]) +AC_SUBST([HOSTRUNNER]) AC_MSG_RESULT([$HOSTRUNNER]) AC_MSG_RESULT($LDLIBRARY)