Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/github-actions-macos-bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
bazelisk build \
--disk_cache=~/.cache/bazel-disk-cache \
--experimental_disk_cache_gc_max_size=5G \
--//:platform=gui //:openroad
//:openroad

# 2. SAVE: Only executes if this is a push/merge directly to the master branch
- name: Save Bazel Disk Cache
Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports_files([

string_flag(
name = "platform",
build_setting_default = "cli",
build_setting_default = "gui",
values = [
"cli",
"gui",
Expand Down
15 changes: 15 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ bazel_dep(name = "qt-bazel")
git_override(
module_name = "qt-bazel",
commit = "886104974c2fd72439f2c33b5deebf0fe4649df7",
# Build xcb-util-cursor from source so the Qt xcb platform plugin
# doesn't depend on the host having libxcb-cursor0 installed.
# qt-bazel upstream ships it as system_provided = True; we replace
# that with a static cc_library compiled from xcb-util-cursor 0.1.5.
patch_cmds = [
# Retry + --fail so transient xorg.freedesktop.org hiccups don't
# feed a truncated/HTML response into tar (seen in CI as "xz:
# File format not recognized"). Stage to a file first for a
# clearer error if extraction fails.
"curl -sSfL --retry 5 --retry-all-errors --retry-delay 5 -o xcb-util-cursor-0.1.5.tar.xz https://xorg.freedesktop.org/archive/individual/lib/xcb-util-cursor-0.1.5.tar.xz && tar xJf xcb-util-cursor-0.1.5.tar.xz --strip-components=1 -C interface_libs/xcb xcb-util-cursor-0.1.5/cursor && rm xcb-util-cursor-0.1.5.tar.xz",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The curl command downloads an external dependency without verifying its integrity. This poses a security risk and can lead to non-reproducible builds if the remote file changes or is compromised. It is recommended to verify the SHA256 checksum of the downloaded tarball before extraction.

Suggested change
"curl -sSfL --retry 5 --retry-all-errors --retry-delay 5 -o xcb-util-cursor-0.1.5.tar.xz https://xorg.freedesktop.org/archive/individual/lib/xcb-util-cursor-0.1.5.tar.xz && tar xJf xcb-util-cursor-0.1.5.tar.xz --strip-components=1 -C interface_libs/xcb xcb-util-cursor-0.1.5/cursor && rm xcb-util-cursor-0.1.5.tar.xz",
"curl -sSfL --retry 5 --retry-all-errors --retry-delay 5 -o xcb-util-cursor-0.1.5.tar.xz https://xorg.freedesktop.org/archive/individual/lib/xcb-util-cursor-0.1.5.tar.xz && echo \"28a899f10ada37f1d035605a1ce877a7b5bb03045934197316270cafcca3a987 xcb-util-cursor-0.1.5.tar.xz\" | sha256sum -c && tar xJf xcb-util-cursor-0.1.5.tar.xz --strip-components=1 -C interface_libs/xcb xcb-util-cursor-0.1.5/cursor && rm xcb-util-cursor-0.1.5.tar.xz",

],
patch_strip = 1,
patches = [
"//bazel:qt-bazel-xcb-cursor-from-source.patch",
],
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
)

Expand Down
14 changes: 14 additions & 0 deletions bazel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ RUN apt-get -y update \
docker-buildx-plugin \
docker-ce \
docker-ce-cli \
libdbus-1-3 \
libfontconfig1 \
libsm6 \
libx11-xcb1 \
libxcb-icccm4 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-shape0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xkb1 \
libxcb1-dev \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This list appears to be intended for runtime dependencies required to execute the GUI-enabled binary during tests. libxcb1-dev is a development package; the runtime package libxcb1 should be used instead to keep the image size minimal.

      libxcb1 \

libxkbcommon-x11-0 \
libxkbcommon0 \
openjdk-21-jre-headless \
python3 \
python3-yaml \
Expand Down
59 changes: 59 additions & 0 deletions bazel/qt-bazel-xcb-cursor-from-source.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
diff --git a/interface_libs/xcb/BUILD.bazel b/interface_libs/xcb/BUILD.bazel
index c1c5b6b6..3a659170 100644
--- a/interface_libs/xcb/BUILD.bazel
+++ b/interface_libs/xcb/BUILD.bazel
@@ -67,10 +67,41 @@ cc_import(
system_provided = True,
)

-cc_import(
- name = "xcb_cursor_ifso",
- interface_library = "libxcb-cursor.ifso",
- system_provided = True,
+# Headers-only target for xcb utility headers. Used by :xcb_cursor to
+# get xcb_renderutil.h, xcb_image.h, render.h etc. without depending on
+# the full :xcb target (which would create a circular dependency).
+cc_library(
+ name = "xcb_hdrs",
+ hdrs = glob(["xcb/*.h"]),
+ includes = ["."],
+ strip_include_prefix = ".",
+)
+
+# Build xcb-util-cursor from source instead of relying on a system-provided
+# shared library. The source is downloaded into cursor/ by patch_cmds in
+# the consumer's MODULE.bazel. This makes the Qt xcb platform plugin
+# self-contained — no host libxcb-cursor0 package required.
+cc_library(
+ name = "xcb_cursor",
+ srcs = [
+ "cursor/cursor.c",
+ "cursor/cursor.h",
+ "cursor/load_cursor.c",
+ "cursor/parse_cursor_file.c",
+ "cursor/shape_to_id.c",
+ ],
+ hdrs = ["cursor/xcb_cursor.h"],
+ copts = [
+ # asprintf() is a GNU extension; glibc gates it behind _GNU_SOURCE.
+ "-D_GNU_SOURCE",
+ "-DXCURSORPATH='\"~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"'",
+ ],
+ include_prefix = "xcb",
+ strip_include_prefix = "cursor",
+ deps = [
+ ":xcb_hdrs",
+ "@libxcb",
+ ],
)

cc_import(
@@ -94,7 +125,7 @@ cc_library(
deps = select({
"@platforms//cpu:aarch64": [],
"//conditions:default": [
- ":xcb_cursor_ifso",
+ ":xcb_cursor",
":xcb_icccm_ifso",
":xcb_ifso",
":xcb_image_ifso",
10 changes: 5 additions & 5 deletions docs/user/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ There are three methods for building OpenROAD (in order of recommendation): preb

## Build and install with Bazel

Build OpenROAD with GUI support and install into ../install/OpenROAD/bin
Build OpenROAD and install into ../install/OpenROAD/bin

bazelisk run --//:platform=gui //:install
bazelisk run //:install

To install to a custom location, e.g. /tmp/myinstall

bazelisk run --//:platform=gui //:install -- /tmp/myinstall
bazelisk run //:install -- /tmp/myinstall

To produce an openroad.tar file with install files

bazelisk build --//:platform=gui //:tarfile
bazelisk build //:tarfile

The tarfile is located at bazel-bin/packaging/openroad.tar.

To embed the real git version string, add `--config=release`:

bazelisk run --config=release --//:platform=gui //:install
bazelisk run --config=release //:install

The install process will install the binary "openroad" and the runfile directory
"openroad.runfiles" which contains runtime data needed by the binary.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ timing groups display the internal clock latency inline:
To view this, run the MockArray example and look at reg2reg paths:

```
bazelisk run --//:platform=gui //test/orfs/mock-array:MockArray_4x4_base_synth gui_synth
bazelisk run //test/orfs/mock-array:MockArray_4x4_base_synth gui_synth
```

## License
Expand Down
Loading