Skip to content

Commit ad6ee6b

Browse files
authored
Merge pull request #4484 from The-OpenROAD-Project-staging/bazel-icu-patch
gui: patch ICU
2 parents 1ff305c + a575972 commit ad6ee6b

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎MODULE.bazel‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,25 @@ git_override(
7979
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
8080
)
8181

82+
# icu is transitive (qt-bazel -> icu). The BCR overlay patches
83+
# u_getDataDirectory() to locate icudt*.dat via
84+
# rules_cc::cc::runfiles::Runfiles::Rlocation(), but Runfiles::Create()
85+
# returns nullptr whenever no runfiles tree is reachable and the overlay
86+
# dereferences it unconditionally. A binary that a bazel/install.sh-style
87+
# step copies out of bazel-bin loses its .runfiles directory, so the first
88+
# locale-aware compare (QCollator, std::locale, ...) anywhere in the process
89+
# segfaults -- e.g. QFileDialog listing a directory, or a sortable Qt list/
90+
# table. Mirrors tools/OpenROAD's fixed-version override (single_version_
91+
# override is root-honored only); drop when tools/OpenROAD drops its copy.
92+
single_version_override(
93+
module_name = "icu",
94+
patch_strip = 1,
95+
patches = [
96+
"//patches/icu:0001-putil-null-check-bazel-runfiles-before-dereference.patch",
97+
],
98+
version = "76.1.bcr.3",
99+
)
100+
82101
# Exception to the dev-only rule above: flow/BUILD has
83102
# load("@bazel-orfs//:openroad.bzl", "orfs_pdk"), so @bazel-orfs must stay
84103
# visible from @orfs even at non-root consumption; a dev-only bazel_dep
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- a/icu4c/source/common/putil.cpp
2+
+++ b/icu4c/source/common/putil.cpp
3+
@@ -1494,9 +1494,19 @@
4+
#endif
5+
6+
#if defined(BAZEL_CURRENT_REPOSITORY) && defined(ICU_DATA_DIR_BAZEL)
7+
+ // Runfiles::Create() returns nullptr when no runfiles tree is reachable,
8+
+ // which is the case for a binary copied out of bazel-bin by an install
9+
+ // step (its .runfiles directory is gone and $RUNFILES_DIR/
10+
+ // $RUNFILES_MANIFEST_FILE are unset). The unconditional dereference below
11+
+ // then segfaults the first time any locale-aware compare (QCollator,
12+
+ // std::locale, ...) reaches this function. Fall through to the ""
13+
+ // default instead.
14+
std::unique_ptr<Runfiles> runfiles(Runfiles::Create("", BAZEL_CURRENT_REPOSITORY));
15+
- std::string dat_path = runfiles->Rlocation(ICU_DATA_DIR_BAZEL);
16+
- path = dat_path.c_str();
17+
+ std::string dat_path = runfiles ? runfiles->Rlocation(ICU_DATA_DIR_BAZEL)
18+
+ : std::string();
19+
+ if (!dat_path.empty()) {
20+
+ path = dat_path.c_str();
21+
+ }
22+
#endif
23+
24+
if(path==nullptr) {

‎patches/icu/BUILD.bazel‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""icu fixes carried as single_version_override patches.
2+
3+
Mirrored from tools/OpenROAD/bazel/icu-patches (overrides are
4+
root-honored only). Drop when tools/OpenROAD drops its copy.
5+
"""
6+
7+
exports_files(glob(["*.patch"]))

0 commit comments

Comments
 (0)