diff --git a/.bazelrc b/.bazelrc index 19f93ca..b687aca 100644 --- a/.bazelrc +++ b/.bazelrc @@ -64,4 +64,8 @@ build:rbe --jobs=32 # BuildBuddy remote exec build:rbe --remote_executor=grpcs://remote.buildbuddy.io +# Disable bazelmod +common --noenable_bzlmod + + try-import %workspace%/.bazelrc.user diff --git a/.bazelversion b/.bazelversion index f22d756..a8907c0 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.5.0 +7.0.2 diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl index 46d1fb0..7b1e052 100644 --- a/toolchain/defs.bzl +++ b/toolchain/defs.bzl @@ -157,60 +157,61 @@ gcc_toolchain = repository_rule( def _render_tool_paths(rctx, repository_name, toolchain_files_repository_name, binary_prefix): relative_tool_paths = { - "ar": "external/{repository_name}/bin/{binary_prefix}-linux-ar".format( + "ar": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-ar".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "as": "external/{repository_name}/bin/{binary_prefix}-linux-as".format( + "as": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-as".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "cpp": "external/{repository_name}/bin/{binary_prefix}-linux-cpp".format( + "cpp": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-cpp".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "g++": "external/{repository_name}/bin/{binary_prefix}-linux-g++".format( + "g++": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-g++".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "gcc": "external/{repository_name}/bin/{binary_prefix}-linux-gcc".format( + "gcc": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gcc".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "gcov": "external/{repository_name}/bin/{binary_prefix}-linux-gcov".format( + "gcov": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gcov".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "gfortran": "external/{repository_name}/bin/{binary_prefix}-linux-gfortran".format( + "gfortran": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gfortran".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "ld": "external/{repository_name}/bin/{binary_prefix}-linux-ld".format( + "ld": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-ld".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "nm": "external/{repository_name}/bin/{binary_prefix}-linux-nm".format( + "nm": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-nm".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "objcopy": "external/{repository_name}/bin/{binary_prefix}-linux-objcopy".format( + "objcopy": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-objcopy".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "objdump": "external/{repository_name}/bin/{binary_prefix}-linux-objdump".format( + "objdump": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-objdump".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), - "strip": "external/{repository_name}/bin/{binary_prefix}-linux-strip".format( + "strip": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-strip".format( repository_name = toolchain_files_repository_name, binary_prefix = binary_prefix, ), } path_env = ":".join([ - "${{EXECROOT}}/external/{}/bin".format(repository) + "${{EXECROOT}}/bazel-working-directory/gcc_toolchain/external/{}/bin".format(repository) for repository in [repository_name, toolchain_files_repository_name] ]) + print(path_env) tool_paths = {} for name, tool_path in relative_tool_paths.items(): diff --git a/toolchain/wrapper.sh.tpl b/toolchain/wrapper.sh.tpl index b9627e9..0220940 100644 --- a/toolchain/wrapper.sh.tpl +++ b/toolchain/wrapper.sh.tpl @@ -23,7 +23,20 @@ set -o errexit -o nounset -o pipefail # symlinks of the BASH_SOURCE[0] is more reliable than navigating to the # execroot from $PWD. This is due to the fact that the Bazel C++ toolchain can # be called from different working directories (e.g. rules_foreign_cc rules). +# EXECROOT="${EXECROOT:-"$(realpath "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../")"}" EXECROOT="${EXECROOT:-"$(realpath "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../../..")"}" + +echo "EXECROOT: ${EXECROOT}" +# ls -lh "${EXECROOT}" +# ls -lh "${EXECROOT}/bazel-execroot/gcc_toolchain" +# ls -lh "${EXECROOT}/bazel-source-roots" +# ls -lh "${EXECROOT}/bazel-working-directory/gcc_toolchain/external" +# ls -lh "${EXECROOT}/bazel-working-directory/gcc-toolchain" +# echo "BINARY: __binary__" +# echo "Running: ${EXECROOT}/__binary__ ${args[@]}" +echo "PATH = __PATH__" +# ls -lh /tmp/external/ + export EXECROOT export PATH="__PATH__" args=("$@") @@ -44,4 +57,5 @@ for i in "${!args[@]}"; do fi done + exec "${EXECROOT}/__binary__" "${args[@]}"