[bazel] Repair clang_headers_gen when run on macOS.
authorJames Knight <jyknight@google.com>
Mon, 12 Jun 2023 20:05:35 +0000 (16:05 -0400)
committerJames Knight <jyknight@google.com>
Mon, 12 Jun 2023 20:30:45 +0000 (16:30 -0400)
commitc5f6a287499a816cba5585708999e2c8b134290f
treead0504b8b12c02a105655b5ad037160897d9e8fb
parenta84994071c8e59e30933cf1482031856ca4c77d4
[bazel] Repair clang_headers_gen when run on macOS.

The antique version of bash (3.2.57, from 2007) which is available on
macOS cannot deal with quoted slashes in a `${x/...}`
substitution. Since only prefix-removal is required here, switch to a
`${x#...}` substitution instead.

(E.g. `src="foo/bar/baz.h"; echo ${src/"foo/bar"}` echos `bar/bar/baz.h`
instead of `/baz.h` on old bash versions).

Originally broken by 459420c33a2c80525bc73ad1ff89fdf4dd079d6c.
Fixes #63222
utils/bazel/llvm-project-overlay/clang/BUILD.bazel