Subject: [PATCH bazel-zig-cc] fix windows include root path

From: Fabian Hahn <[email-masked]>
Date: Sun, 11 Dec 2022 14:53:37 +0000

---
When trying to test the patch
https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/37457 I noticed that
the current main branch is broken on Windows. I ran a bisection and the
offending bad commit is 88e7e47ed20ca7b2f9509dfe09089b812d7d94eb, which
makes changes to the zig_include_root. Here's a small patch that
resolves this and fixes Windows host support again on main. The issue
here is that while paths on Windows do indeed use \ instead of /, the
variable `d` here is used as a bazel target name for a filegroup rule,
which must not contain backslashes. And bazel accepts forward slashes
within glob() just fine on Windows, so no special handling needed here.

 toolchain/defs.bzl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 3d08abd..aa2e4e6 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -318,6 +318,6 @@ def declare_files(os):
 
     for target_config in target_structs():
         for d in _DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
-            d = "lib" + ("\\" if os == "windows" else "/") + d
+            d = "lib/" + d
             if d not in lazy_filegroups:
                 lazy_filegroups[d] = filegroup(name = d, srcs = native.glob([d + "/**"]))
-- 
2.25.1

---

From: "builds.sr.ht" <[email-masked]>
Date: Sun, 11 Dec 2022 15:11:30 +0000

bazel-zig-cc/patches/.build.yml: SUCCESS in 17m38s

[fix windows include root path][0] from [Fabian Hahn][1]

[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/37465
[1]: mailto:[email-masked]

✓ #902966 SUCCESS bazel-zig-cc/patches/.build.yml https://builds.sr.ht/~motiejus/job/902966