mirror of https://github.com/python/cpython
gh-84461: Drop -sWASM, fix building tests for browser (GH-91530)
- drop unnecessary ``=1`` suffix from Emscripten flags - drop unnecessary ``-sWASM`` flag for side modules - rename ``build_platform`` to ``build_wasm``. I introduced the target for WASM builds a couple of months ago. - fix ``--enable-test-modules`` for browser builds
This commit is contained in:
parent
1b035d9699
commit
7acedd71de
|
@ -580,7 +580,7 @@ LIBEXPAT_HEADERS= \
|
||||||
all: @DEF_MAKE_ALL_RULE@
|
all: @DEF_MAKE_ALL_RULE@
|
||||||
build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
|
build_all: check-clean-src $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks \
|
||||||
Programs/_testembed python-config
|
Programs/_testembed python-config
|
||||||
build_platform: check-clean-src $(BUILDPYTHON) platform
|
build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
|
||||||
|
|
||||||
# Check that the source is clean when building out of source.
|
# Check that the source is clean when building out of source.
|
||||||
check-clean-src:
|
check-clean-src:
|
||||||
|
@ -2475,7 +2475,7 @@ update-config:
|
||||||
Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
|
Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
|
||||||
|
|
||||||
# Declare targets that aren't real files
|
# Declare targets that aren't real files
|
||||||
.PHONY: all build_all sharedmods check-clean-src oldsharedmods test quicktest
|
.PHONY: all build_all build_wasm sharedmods check-clean-src oldsharedmods test quicktest
|
||||||
.PHONY: install altinstall oldsharedinstall bininstall altbininstall
|
.PHONY: install altinstall oldsharedinstall bininstall altbininstall
|
||||||
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
|
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
|
||||||
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
|
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
|
||||||
|
|
|
@ -7226,8 +7226,8 @@ fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
elif test "$ac_sys_system" = "Emscripten"; then
|
elif test "$ac_sys_system" = "Emscripten" -o "$ac_sys_system" = "WASI"; then
|
||||||
DEF_MAKE_ALL_RULE="build_platform"
|
DEF_MAKE_ALL_RULE="build_wasm"
|
||||||
REQUIRE_PGO="no"
|
REQUIRE_PGO="no"
|
||||||
DEF_MAKE_RULE="all"
|
DEF_MAKE_RULE="all"
|
||||||
else
|
else
|
||||||
|
@ -7791,17 +7791,17 @@ fi
|
||||||
case $ac_sys_system/$ac_sys_emscripten_target in #(
|
case $ac_sys_system/$ac_sys_emscripten_target in #(
|
||||||
Emscripten/browser*) :
|
Emscripten/browser*) :
|
||||||
|
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH"
|
||||||
LINKFORSHARED="--preload-file=\$(WASM_ASSETS_DIR)"
|
LINKFORSHARED="--preload-file=\$(WASM_ASSETS_DIR)"
|
||||||
if test "x$enable_wasm_dynamic_linking" = xyes; then :
|
if test "x$enable_wasm_dynamic_linking" = xyes; then :
|
||||||
|
|
||||||
as_fn_append LINKFORSHARED " -sMAIN_MODULE=1"
|
as_fn_append LINKFORSHARED " -sMAIN_MODULE"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
WASM_ASSETS_DIR=".\$(prefix)"
|
WASM_ASSETS_DIR=".\$(prefix)"
|
||||||
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
|
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
|
||||||
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "browser-debug"; then
|
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "browser-debug"; then
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS"
|
||||||
LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
|
LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
|
||||||
else
|
else
|
||||||
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
||||||
|
@ -7809,16 +7809,16 @@ fi
|
||||||
;; #(
|
;; #(
|
||||||
Emscripten/node*) :
|
Emscripten/node*) :
|
||||||
|
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sUSE_PTHREADS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH -sNODERAWFS -sUSE_PTHREADS"
|
||||||
LINKFORSHARED="-sPROXY_TO_PTHREAD=1 -sEXIT_RUNTIME=1"
|
LINKFORSHARED="-sPROXY_TO_PTHREAD -sEXIT_RUNTIME"
|
||||||
if test "x$enable_wasm_dynamic_linking" = xyes; then :
|
if test "x$enable_wasm_dynamic_linking" = xyes; then :
|
||||||
|
|
||||||
as_fn_append LINKFORSHARED " -sMAIN_MODULE=1"
|
as_fn_append LINKFORSHARED " -sMAIN_MODULE"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
|
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
|
||||||
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "node-debug"; then
|
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "node-debug"; then
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS"
|
||||||
LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
|
LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
|
||||||
else
|
else
|
||||||
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
||||||
|
@ -10567,7 +10567,7 @@ fi;;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_wasm_dynamic_linking" = "yes" -a "$ac_sys_system" = "Emscripten"; then
|
if test "$enable_wasm_dynamic_linking" = "yes" -a "$ac_sys_system" = "Emscripten"; then
|
||||||
BLDSHARED='$(CC) -shared -sSIDE_MODULE=1 -sWASM=1'
|
BLDSHARED='$(CC) -shared -sSIDE_MODULE=1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDSHARED" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDSHARED" >&5
|
||||||
|
@ -16030,8 +16030,8 @@ $as_echo "yes" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
|
if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
|
||||||
ZLIB_CFLAGS="-sUSE_ZLIB=1"
|
ZLIB_CFLAGS="-sUSE_ZLIB"
|
||||||
ZLIB_LIBS="-sUSE_ZLIB=1"
|
ZLIB_LIBS="-sUSE_ZLIB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$have_zlib" = xyes; then :
|
if test "x$have_zlib" = xyes; then :
|
||||||
|
@ -16264,8 +16264,8 @@ $as_echo "yes" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
|
if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
|
||||||
BZIP2_CFLAGS="-sUSE_BZIP2=1"
|
BZIP2_CFLAGS="-sUSE_BZIP2"
|
||||||
BZIP2_LIBS="-sUSE_BZIP2=1"
|
BZIP2_LIBS="-sUSE_BZIP2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -22341,28 +22341,27 @@ $as_echo_n "checking for --disable-test-modules... " >&6; }
|
||||||
# Check whether --enable-test-modules was given.
|
# Check whether --enable-test-modules was given.
|
||||||
if test "${enable_test_modules+set}" = set; then :
|
if test "${enable_test_modules+set}" = set; then :
|
||||||
enableval=$enable_test_modules;
|
enableval=$enable_test_modules;
|
||||||
|
if test "x$enable_test_modules" = xyes; then :
|
||||||
|
TEST_MODULES=yes
|
||||||
|
else
|
||||||
|
TEST_MODULES=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_test_modules" = no; then
|
|
||||||
TEST_MODULES=no
|
|
||||||
else
|
else
|
||||||
case $ac_sys_system/$ac_sys_emscripten_target in #(
|
|
||||||
|
case $ac_sys_system/$ac_sys_emscripten_target in #(
|
||||||
Emscripten/browser*) :
|
Emscripten/browser*) :
|
||||||
TEST_MODULES=no ;; #(
|
TEST_MODULES=no ;; #(
|
||||||
*) :
|
*) :
|
||||||
TEST_MODULES=yes
|
TEST_MODULES=yes
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
if test "x$TEST_MODULES" = xyes; then :
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
||||||
$as_echo "yes" >&6; }
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEST_MODULES" >&5
|
||||||
|
$as_echo "$TEST_MODULES" >&6; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
57
configure.ac
57
configure.ac
|
@ -1574,10 +1574,10 @@ if test "$Py_OPT" = 'true' ; then
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
elif test "$ac_sys_system" = "Emscripten"; then
|
elif test "$ac_sys_system" = "Emscripten" -o "$ac_sys_system" = "WASI"; then
|
||||||
dnl Emscripten does not support shared extensions yet. Build
|
dnl Emscripten does not support shared extensions yet. Build
|
||||||
dnl "python.[js,html,wasm]", "pybuilddir.txt", and "platform" files.
|
dnl "python.[js,wasm]", "pybuilddir.txt", and "platform" files.
|
||||||
DEF_MAKE_ALL_RULE="build_platform"
|
DEF_MAKE_ALL_RULE="build_wasm"
|
||||||
REQUIRE_PGO="no"
|
REQUIRE_PGO="no"
|
||||||
DEF_MAKE_RULE="all"
|
DEF_MAKE_RULE="all"
|
||||||
else
|
else
|
||||||
|
@ -1911,30 +1911,30 @@ fi
|
||||||
# WASM flags
|
# WASM flags
|
||||||
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
|
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
|
||||||
[Emscripten/browser*], [
|
[Emscripten/browser*], [
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH"
|
||||||
LINKFORSHARED="--preload-file=\$(WASM_ASSETS_DIR)"
|
LINKFORSHARED="--preload-file=\$(WASM_ASSETS_DIR)"
|
||||||
AS_VAR_IF([enable_wasm_dynamic_linking], [yes], [
|
AS_VAR_IF([enable_wasm_dynamic_linking], [yes], [
|
||||||
AS_VAR_APPEND([LINKFORSHARED], [" -sMAIN_MODULE=1"])
|
AS_VAR_APPEND([LINKFORSHARED], [" -sMAIN_MODULE"])
|
||||||
])
|
])
|
||||||
WASM_ASSETS_DIR=".\$(prefix)"
|
WASM_ASSETS_DIR=".\$(prefix)"
|
||||||
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
|
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
|
||||||
dnl separate-dwarf does not seem to work in Chrome DevTools Support.
|
dnl separate-dwarf does not seem to work in Chrome DevTools Support.
|
||||||
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "browser-debug"; then
|
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "browser-debug"; then
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS"
|
||||||
LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
|
LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
|
||||||
else
|
else
|
||||||
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
||||||
fi
|
fi
|
||||||
],
|
],
|
||||||
[Emscripten/node*], [
|
[Emscripten/node*], [
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH=1 -sNODERAWFS=1 -sUSE_PTHREADS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sALLOW_MEMORY_GROWTH -sNODERAWFS -sUSE_PTHREADS"
|
||||||
LINKFORSHARED="-sPROXY_TO_PTHREAD=1 -sEXIT_RUNTIME=1"
|
LINKFORSHARED="-sPROXY_TO_PTHREAD -sEXIT_RUNTIME"
|
||||||
AS_VAR_IF([enable_wasm_dynamic_linking], [yes], [
|
AS_VAR_IF([enable_wasm_dynamic_linking], [yes], [
|
||||||
AS_VAR_APPEND([LINKFORSHARED], [" -sMAIN_MODULE=1"])
|
AS_VAR_APPEND([LINKFORSHARED], [" -sMAIN_MODULE"])
|
||||||
])
|
])
|
||||||
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
|
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
|
||||||
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "node-debug"; then
|
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "node-debug"; then
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS=1"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST -sASSERTIONS"
|
||||||
LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
|
LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
|
||||||
else
|
else
|
||||||
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
|
||||||
|
@ -3009,7 +3009,7 @@ fi
|
||||||
dnl Emscripten's emconfigure sets LDSHARED. Set BLDSHARED outside the
|
dnl Emscripten's emconfigure sets LDSHARED. Set BLDSHARED outside the
|
||||||
dnl test -z $LDSHARED block to configure BLDSHARED for side module support.
|
dnl test -z $LDSHARED block to configure BLDSHARED for side module support.
|
||||||
if test "$enable_wasm_dynamic_linking" = "yes" -a "$ac_sys_system" = "Emscripten"; then
|
if test "$enable_wasm_dynamic_linking" = "yes" -a "$ac_sys_system" = "Emscripten"; then
|
||||||
BLDSHARED='$(CC) -shared -sSIDE_MODULE=1 -sWASM=1'
|
BLDSHARED='$(CC) -shared -sSIDE_MODULE=1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_RESULT($LDSHARED)
|
AC_MSG_RESULT($LDSHARED)
|
||||||
|
@ -4549,8 +4549,8 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
|
||||||
])
|
])
|
||||||
|
|
||||||
if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
|
if test "$have_zlib" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$ZLIB_LIBS" = "-lz"; then
|
||||||
ZLIB_CFLAGS="-sUSE_ZLIB=1"
|
ZLIB_CFLAGS="-sUSE_ZLIB"
|
||||||
ZLIB_LIBS="-sUSE_ZLIB=1"
|
ZLIB_LIBS="-sUSE_ZLIB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl binascii can use zlib for optimized crc32.
|
dnl binascii can use zlib for optimized crc32.
|
||||||
|
@ -4572,8 +4572,8 @@ PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
|
||||||
])
|
])
|
||||||
|
|
||||||
if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
|
if test "$have_bzip2" = "yes" -a "$ac_sys_system" = "Emscripten" -a "$BZIP2_LIBS" = "-lbz2"; then
|
||||||
BZIP2_CFLAGS="-sUSE_BZIP2=1"
|
BZIP2_CFLAGS="-sUSE_BZIP2"
|
||||||
BZIP2_LIBS="-sUSE_BZIP2=1"
|
BZIP2_LIBS="-sUSE_BZIP2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -6557,21 +6557,18 @@ fi],
|
||||||
|
|
||||||
# Check whether to disable test modules. Once set, setup.py will not build
|
# Check whether to disable test modules. Once set, setup.py will not build
|
||||||
# test extension modules and "make install" will not install test suites.
|
# test extension modules and "make install" will not install test suites.
|
||||||
AC_MSG_CHECKING(for --disable-test-modules)
|
AC_MSG_CHECKING([for --disable-test-modules])
|
||||||
AC_ARG_ENABLE(test-modules,
|
AC_ARG_ENABLE([test-modules],
|
||||||
AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules]))
|
[AS_HELP_STRING([--disable-test-modules], [don't build nor install test modules])], [
|
||||||
if test "$enable_test_modules" = no; then
|
AS_VAR_IF([enable_test_modules], [yes], [TEST_MODULES=yes], [TEST_MODULES=no])
|
||||||
TEST_MODULES=no
|
], [
|
||||||
else
|
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
|
||||||
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
|
[Emscripten/browser*], [TEST_MODULES=no],
|
||||||
[Emscripten/browser*], [TEST_MODULES=no],
|
[TEST_MODULES=yes]
|
||||||
[TEST_MODULES=yes]
|
)
|
||||||
)
|
])
|
||||||
fi
|
AC_MSG_RESULT([$TEST_MODULES])
|
||||||
AS_VAR_IF([TEST_MODULES], [yes],
|
AC_SUBST([TEST_MODULES])
|
||||||
[AC_MSG_RESULT(no)], [AC_MSG_RESULT(yes)]
|
|
||||||
)
|
|
||||||
AC_SUBST(TEST_MODULES)
|
|
||||||
|
|
||||||
AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
|
AC_DEFUN([PY_STDLIB_MOD_SET_NA], [
|
||||||
m4_foreach([mod], [$@], [
|
m4_foreach([mod], [$@], [
|
||||||
|
|
Loading…
Reference in New Issue