diff --git a/MODULE.bazel b/MODULE.bazel index 3b1b342b45967..2c9ef1d9e28af 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,7 +10,6 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "googletest", version = "1.14.0.bcr.1") bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "rules_cc", version = "0.0.14") -bazel_dep(name = "rules_foreign_cc", version = "0.9.0") bazel_dep(name = "rules_fuzzing", version = "0.5.2") bazel_dep(name = "rules_pkg", version = "1.0.1") @@ -35,6 +34,8 @@ include("//third_party/rust:rust.MODULE.bazel") include("//third_party/python:python.MODULE.bazel") +include("//third_party/foreign_cc:foreign_cc.MODULE.bazel") + # Repository rules: bitstreams_repo = use_repo_rule("//rules:bitstreams.bzl", "bitstreams_repo") diff --git a/third_party/foreign_cc/BUILD b/third_party/foreign_cc/BUILD new file mode 100644 index 0000000000000..c85882e64fe2c --- /dev/null +++ b/third_party/foreign_cc/BUILD @@ -0,0 +1,5 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +package(default_visibility = ["//visibility:public"]) diff --git a/third_party/foreign_cc/foreign_cc.MODULE.bazel b/third_party/foreign_cc/foreign_cc.MODULE.bazel new file mode 100644 index 0000000000000..2915c2ed54c54 --- /dev/null +++ b/third_party/foreign_cc/foreign_cc.MODULE.bazel @@ -0,0 +1,15 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +# Dependencies: +bazel_dep(name = "rules_foreign_cc", version = "0.9.0") + +# Overrides and patches: +single_version_override( + module_name = "rules_foreign_cc", + patches = [ + "//third_party/foreign_cc/patches:rules_foreign_cc.remove_log_output.patch", + ], + version = "0.9.0", +) diff --git a/third_party/foreign_cc/patches/BUILD b/third_party/foreign_cc/patches/BUILD new file mode 100644 index 0000000000000..c85882e64fe2c --- /dev/null +++ b/third_party/foreign_cc/patches/BUILD @@ -0,0 +1,5 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +package(default_visibility = ["//visibility:public"]) diff --git a/third_party/foreign_cc/patches/rules_foreign_cc.remove_log_output.patch b/third_party/foreign_cc/patches/rules_foreign_cc.remove_log_output.patch new file mode 100644 index 0000000000000..f7ef020d62ae6 --- /dev/null +++ b/third_party/foreign_cc/patches/rules_foreign_cc.remove_log_output.patch @@ -0,0 +1,13 @@ +diff --git foreign_cc/private/framework.bzl foreign_cc/private/framework.bzl +index c84c217..f43da2c 100644 +--- foreign_cc/private/framework.bzl ++++ foreign_cc/private/framework.bzl +@@ -561,7 +561,7 @@ def wrap_outputs(ctx, lib_name, configure_name, script_text, build_script_file = + cleanup_on_success_function = create_function( + ctx, + "cleanup_on_success", +- "rm -rf $BUILD_TMPDIR $EXT_BUILD_DEPS", ++ "rm -rf $BUILD_TMPDIR $EXT_BUILD_DEPS && echo > $BUILD_LOG", + ) + cleanup_on_failure_function = create_function( + ctx,