[bazel] fix: rules_foreign_cc cmake builds (#1690)
EMSDK_PYTHON must be absolute path, so emcc can be executed from any
current directory (not only execution root).
Change fixes rules_foreign_cc cmake builds that otherwise are failed
during startup steps as described in
https://github.com/emscripten-core/emsdk/issues/1689
diff --git a/bazel/emscripten_toolchain/env.bat b/bazel/emscripten_toolchain/env.bat
index c791ff7..a2a1610 100644
--- a/bazel/emscripten_toolchain/env.bat
+++ b/bazel/emscripten_toolchain/env.bat
@@ -4,3 +4,4 @@
if "%ROOT_DIR%"=="" set ROOT_DIR=%CD%
set EMSCRIPTEN=%ROOT_DIR%\%EM_BIN_PATH%\emscripten
set EM_CONFIG=%ROOT_DIR%\%EM_CONFIG_PATH%
+set EMSDK_PYTHON=%ROOT_DIR%\%BAZEL_PYTHON_RELPATH%
diff --git a/bazel/emscripten_toolchain/env.sh b/bazel/emscripten_toolchain/env.sh
index b2a6bd6..e4e6a12 100755
--- a/bazel/emscripten_toolchain/env.sh
+++ b/bazel/emscripten_toolchain/env.sh
@@ -3,3 +3,4 @@
export ROOT_DIR=${EXT_BUILD_ROOT:-$(pwd -P)}
export EMSCRIPTEN=$ROOT_DIR/$EM_BIN_PATH/emscripten
export EM_CONFIG=$ROOT_DIR/$EM_CONFIG_PATH
+export EMSDK_PYTHON=$ROOT_DIR/$BAZEL_PYTHON_RELPATH
diff --git a/bazel/emscripten_toolchain/toolchain.bzl b/bazel/emscripten_toolchain/toolchain.bzl
index d7f2a7a..aafa0ba 100644
--- a/bazel/emscripten_toolchain/toolchain.bzl
+++ b/bazel/emscripten_toolchain/toolchain.bzl
@@ -1088,7 +1088,7 @@
value = nodejs_path,
),
env_entry(
- key = "EMSDK_PYTHON",
+ key = "BAZEL_PYTHON_RELPATH",
value = python_exec_runtime.interpreter.path,
),
],