Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stdbuf and ruby errors #139

Merged
merged 3 commits into from
Sep 6, 2024
Merged
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
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module(

orfs = use_extension("//:extension.bzl", "orfs_repositories")
orfs.default(
image = "docker.io/openroad/orfs:v3.0-1266-ge623a237",
sha256 = "d9492e65906d5e459bdc9d033915bc8fc15c37ab7b6337196f2e95c0e00a287e",
image = "docker.io/openroad/orfs:v3.0-1305-g0aa3fe5d",
sha256 = "b817260720e3575771aea5b0e609946308b3c7f11d8a7023b2688947a704d899",
)
use_repo(orfs, "com_github_nixos_patchelf_download")
use_repo(orfs, "docker_orfs")
Expand Down
13 changes: 8 additions & 5 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions docker.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ filegroup(
srcs = ["lib64/ld-linux-x86-64.so.2"],
)

filegroup(
name = "libstdbuf.so",
srcs = ["usr/libexec/coreutils/libstdbuf.so"],
visibility = ["//visibility:public"],
)

filegroup(
name = "openroad",
data = [
Expand Down Expand Up @@ -87,7 +81,6 @@ filegroup(
name = "klayout",
data = [
":ld.so",
":libstdbuf.so",
],
srcs = ["usr/bin/klayout"],
visibility = ["//visibility:public"],
Expand Down
3 changes: 3 additions & 0 deletions extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def _orfs_repositories_impl(module_ctx):
sha256 = default.sha256,
build_file = ":docker.BUILD.bazel",
timeout = 3600,
patch_cmds = [
"find . -name BUILD.bazel -delete",
],
)

orfs_repositories = module_extension(
Expand Down
3 changes: 3 additions & 0 deletions make.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ if [ -z "$FLOW_HOME" ]; then
export YOSYS_EXE="${YOSYS_PATH}"
export OPENROAD_EXE="${OPENROAD_PATH}"
export KLAYOUT_CMD="${KLAYOUT_PATH}"
export STDBUF_CMD="${STDBUF_PATH}"
export FLOW_HOME="${FLOW_HOME}"
export RUBYLIB="${RUBY_PATH}:${DLN_LIBRARY_PATH}"
export DLN_LIBRARY_PATH="${DLN_LIBRARY_PATH}"
export TCL_LIBRARY="${TCL_LIBRARY}"
export QT_PLUGIN_PATH="${QT_PLUGIN_PATH}"
export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}"
Expand Down
33 changes: 3 additions & 30 deletions openroad.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -238,31 +238,6 @@ def commonpath(files):
path, _, _ = prefix.rpartition("/")
return path

def preloadwrap(command, library):
"""
Return `command` wrapped in an `LD_PRELOAD` statement.

Args:
command: The command to be wrapped.
library: The library to be preloaded.

Returns:
The wrapped command.
"""
return "LD_PRELOAD=" + library + " " + command

def envwrap(command):
"""
Return `command` argument wrapped in an `env -S` statement.

Args:
command: The command to be wrapped.

Returns:
The wrapped command.
"""
return "env -S " + command

def flow_substitutions(ctx):
return {
"${MAKE_PATH}": ctx.executable._make.path,
Expand All @@ -276,6 +251,7 @@ def openroad_substitutions(ctx):
"${YOSYS_PATH}": "",
"${OPENROAD_PATH}": ctx.executable._openroad.path,
"${KLAYOUT_PATH}": ctx.executable._klayout.path,
"${STDBUF_PATH}": "",
"${RUBY_PATH}": commonpath(ctx.files._ruby),
"${DLN_LIBRARY_PATH}": commonpath(ctx.files._ruby_dynamic),
"${TCL_LIBRARY}": commonpath(ctx.files._tcl),
Expand Down Expand Up @@ -333,10 +309,6 @@ def flow_attrs():
default = ":make.tpl",
allow_single_file = True,
),
"_libstdbuf": attr.label(
allow_single_file = ["libstdbuf.so"],
default = Label("@docker_orfs//:libstdbuf.so"),
),
}

def yosys_only_attrs():
Expand Down Expand Up @@ -787,7 +759,8 @@ def _make_impl(ctx, stage, steps, forwarded_names = [], result_names = [], objec
"DESIGN_CONFIG": config.path,
"FLOW_HOME": ctx.file._makefile.dirname,
"OPENROAD_EXE": ctx.executable._openroad.path,
"KLAYOUT_CMD": envwrap(preloadwrap(ctx.executable._klayout.path, ctx.file._libstdbuf.path)),
"KLAYOUT_CMD": ctx.executable._klayout.path,
"STDBUF_CMD": "",
"RUBYLIB": ":".join([commonpath(ctx.files._ruby), commonpath(ctx.files._ruby_dynamic)]),
"DLN_LIBRARY_PATH": commonpath(ctx.files._ruby_dynamic),
"TCL_LIBRARY": commonpath(ctx.files._tcl),
Expand Down