Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-95853: Improve WASM build script (GH-96389) #96389

Merged
merged 3 commits into from
Aug 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename func to parse_emconfig, comment, black
  • Loading branch information
tiran committed Aug 30, 2022
commit f4be1636a32dcb46aa75a5b7b847708f4bc5c5b1
15 changes: 9 additions & 6 deletions Tools/wasm/wasm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import warnings

# for Python 3.8
from typing import Any, Dict, Callable, Iterable, List, Optional, Union
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union

SRCDIR = pathlib.Path(__file__).parent.parent.parent.absolute()
WASMTOOLS = SRCDIR / "Tools" / "wasm"
Expand Down Expand Up @@ -87,9 +87,9 @@
"""


def get_emscripten_root(
def parse_emconfig(
emconfig: pathlib.Path = EM_CONFIG,
) -> Iterable[pathlib.PurePath]:
) -> Tuple[pathlib.PurePath, pathlib.PurePath]:
"""Parse EM_CONFIG file and lookup EMSCRIPTEN_ROOT and NODE_JS.

The ".emscripten" config file is a Python snippet that uses "EM_CONFIG"
Expand All @@ -108,7 +108,7 @@ def get_emscripten_root(
return emscripten_root, node_js


EMSCRIPTEN_ROOT, NODE_JS = get_emscripten_root()
EMSCRIPTEN_ROOT, NODE_JS = parse_emconfig()


def read_python_version(configure: pathlib.Path = CONFIGURE) -> str:
Expand Down Expand Up @@ -224,8 +224,10 @@ def _check_emscripten():
if broken is not None:
raise ConditionError(
os.fspath(version_txt),
(f"Emscripten SDK {version} in '{EMSCRIPTEN_ROOT}' has known "
f"bugs, see {broken}."),
(
f"Emscripten SDK {version} in '{EMSCRIPTEN_ROOT}' has known "
f"bugs, see {broken}."
),
)
if os.environ.get("PKG_CONFIG_PATH"):
warnings.warn(
Expand Down Expand Up @@ -571,6 +573,7 @@ def build_emports(self, force: bool = False):
if self.pthreads:
# Trigger multi-threaded build.
ports_cmd.append("-sUSE_PTHREADS")
# https://github.com/emscripten-core/emscripten/pull/17729
# embuilder_cmd.append("--pthreads")
tiran marked this conversation as resolved.
Show resolved Hide resolved

# Pre-build libbz2, libsqlite3, libz, and some system libs.
Expand Down