aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch')
-rw-r--r--recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch b/recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch
new file mode 100644
index 0000000..7d73eb7
--- /dev/null
+++ b/recipes-devtools/bazel/files/0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch
@@ -0,0 +1,39 @@
+From 34c4dc1a10140addf75d3503d4b9f427303fe212 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 14 Dec 2020 16:45:31 +0800
+Subject: [PATCH] add Yocto native sysroot dir to the default Bazel toolchain
+
+While using the default Bazel C++ toolchain to build Yocto native tools
+(bazel build --host_crosstool_top=@bazel_tools//tools/cpp:toolchain),
+it failed `bazel references a path outside of the execution root',
+
+Add Yocto native sysroot dir (YOCTO_NATIVE_SYSROOT) to
+builtin_include_directories could fix the issue
+
+If not set YOCTO_NATIVE_SYSROOT, use NOT_SET_YOCTO_NATIVE_SYSROOT
+to replace as a warning
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ tools/cpp/unix_cc_configure.bzl | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
+index d48485b..0d297bf 100755
+--- a/tools/cpp/unix_cc_configure.bzl
++++ b/tools/cpp/unix_cc_configure.bzl
+@@ -443,6 +443,9 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
+ paths["@bazel_tools//tools/cpp:generate_system_module_map.sh"],
+ ))
+
++ # Customize for Yocto
++ builtin_include_directories.append(get_env_var(repository_ctx,"YOCTO_NATIVE_SYSROOT", "NOT_SET_YOCTO_NATIVE_SYSROOT"))
++
+ write_builtin_include_directory_paths(repository_ctx, cc, builtin_include_directories)
+ repository_ctx.template(
+ "BUILD",
+--
+2.18.2
+