On bazel: use readline set-up provided by OpenROAD

The bazel compile always happens as submodule in OpenROAD, so
we can use the same mechanism provided there to set up the
readline library.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
This commit is contained in:
Henner Zeller 2026-04-07 18:30:48 +02:00
parent defec0bda3
commit 8b18c8c276
2 changed files with 10 additions and 5 deletions

1
BUILD
View File

@ -296,6 +296,7 @@ cc_binary(
visibility = ["//visibility:public"],
deps = [
":opensta_lib",
"//:tcl_readline_setup",
"//bazel:tcl_library_init",
"@rules_cc//cc/runfiles",
"@tcl_lang//:tcl",

View File

@ -33,6 +33,7 @@
#ifdef BAZEL_CURRENT_REPOSITORY
#include "bazel/tcl_library_init.h"
#include "src/tcl_readline_setup.h"
#endif
#if TCL_READLINE
@ -124,12 +125,18 @@ staTclAppInit(int argc,
if (Tcl_Init(interp) == TCL_ERROR)
return TCL_ERROR;
bool has_readline = false;
#ifdef BAZEL_CURRENT_REPOSITORY
has_readline = (ord::SetupTclReadlineLibrary(interp) == TCL_OK);
#endif
#if TCL_READLINE
if (Tclreadline_Init(interp) == TCL_ERROR)
return TCL_ERROR;
Tcl_StaticPackage(interp, "tclreadline", Tclreadline_Init, Tclreadline_SafeInit);
if (Tcl_EvalFile(interp, TCLRL_LIBRARY "/tclreadlineInit.tcl") != TCL_OK)
printf("Failed to load tclreadline.tcl\n");
else
has_readline = true;
#endif
initStaApp(argc, argv, interp);
@ -167,11 +174,8 @@ staTclAppInit(int argc,
}
}
}
#if TCL_READLINE
return Tcl_Eval(interp, "::tclreadline::Loop");
#else
return TCL_OK;
#endif
return has_readline ? Tcl_Eval(interp, "::tclreadline::Loop") : TCL_OK;
}
static void