survive tcl9 damage infliced by homebrew/OpenROAD DependencyInstaller

commit b08f24685f52d242985c1c1f48c5b3821728d355
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Jan 2 15:18:46 2025 -0800

    tcl9 conditional support

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit bc0ebaa856196d09ea95cbd4e12e4d88b8a8d13e
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Jan 2 11:33:46 2025 -0800

    tcl9 partial support

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-01-02 15:20:41 -08:00
parent a139d6b6ed
commit d1d0e097f9
5 changed files with 80 additions and 46 deletions

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required (VERSION 3.9)
cmake_minimum_required (VERSION 3.10)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
# Use standard target names
cmake_policy(SET CMP0078 NEW)

View File

@ -92,7 +92,7 @@ work, but these are the versions used for development.
cmake 3.24.2 3.29.2
clang 15.0.0
gcc 11.4.0
tcl 8.6 8.6.6
tcl 8.6 8.6.16
swig 4.1.0 4.1.1
bison 3.8.2 3.8.2
flex 2.6.4 2.6.4
@ -103,13 +103,22 @@ are illegal in c++17.
External library dependencies:
```
Ubuntu Macos license
Ubuntu Darwin License
eigen 3.4.0 3.4.0 MPL2 required
cudd 3.0.0 3.0.0 BSD required
tclreadline 2.3.8 2.3.8 BSD optional
zLib 1.2.5 1.2.8 zlib optional
```
On Darwin/MacOS the Xcode supplied versions of Tcl, Flex and Bison are
problematic. Use homebrew to install them instead.
brew install cmake bison flex swig tcl-tk@8 eigen zlib
Note that the most recent versions of homebrew install Tcl9, which is
not supported because swig does not support it yet. Install tcl8 as
shown above.
The [TCL readline library](https://tclreadline.sourceforge.net/tclreadline.html)
links the GNU readline library to the TCL interpreter for command line editing
On OSX, Homebrew does not support tclreadline, but the macports system does

View File

@ -22,7 +22,8 @@
# because there doesn't appear to be a way to override
# searching OSX system directories before unix directories.
set(TCL_POSSIBLE_NAMES tcl87 tcl8.7
set(TCL_POSSIBLE_NAMES
tcl87 tcl8.7
tcl86 tcl8.6
tcl85 tcl8.5
)
@ -30,7 +31,7 @@ set(TCL_POSSIBLE_NAMES tcl87 tcl8.7
# tcl lib path guesses.
if (NOT TCL_LIB_PATHS)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(TCL_LIB_PATHS /usr/local/lib /opt/homebrew/opt/tcl-tk/lib)
set(TCL_LIB_PATHS /opt/homebrew/Cellar/tcl-tk@8/8.6.16/lib /opt/homebrew/opt/tcl-tk/lib /usr/local/lib)
set(TCL_NO_DEFAULT_PATH TRUE)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TCL_LIB_PATHS /usr/lib /usr/lib64 /usr/local/lib)

View File

@ -48,13 +48,17 @@ namespace sta {
typedef MinPulseWidthCheckSeq::Iterator MinPulseWidthCheckSeqIterator;
typedef MinMaxAll MinMaxAllNull;
#if TCL_MAJOR_VERSION < 9
typedef int Tcl_Size;
#endif
template <class TYPE>
Vector<TYPE> *
tclListSeqPtr(Tcl_Obj *const source,
swig_type_info *swig_type,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK
@ -78,7 +82,7 @@ tclListSeq(Tcl_Obj *const source,
swig_type_info *swig_type,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
std::vector<TYPE> seq;
@ -100,7 +104,7 @@ tclListSetPtr(Tcl_Obj *const source,
swig_type_info *swig_type,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK
&& argc > 0) {
@ -123,7 +127,7 @@ tclListSet(Tcl_Obj *const source,
swig_type_info *swig_type,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK
&& argc > 0) {
@ -147,7 +151,7 @@ tclListNetworkSet(Tcl_Obj *const source,
Tcl_Interp *interp,
const Network *network)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK
&& argc > 0) {
@ -171,7 +175,7 @@ tclListNetworkSet1(Tcl_Obj *const source,
Tcl_Interp *interp,
const Network *network)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
SET_TYPE set(network);
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK
@ -190,7 +194,7 @@ static StringSet *
tclListSetConstChar(Tcl_Obj *const source,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
@ -210,7 +214,7 @@ static StringSeq *
tclListSeqConstChar(Tcl_Obj *const source,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
@ -230,7 +234,7 @@ static StdStringSet *
tclListSetStdString(Tcl_Obj *const source,
Tcl_Interp *interp)
{
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
@ -909,7 +913,7 @@ using namespace sta;
}
%typemap(in) FloatSeq* {
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
FloatSeq *floats = nullptr;
@ -954,7 +958,7 @@ using namespace sta;
}
%typemap(in) IntSeq* {
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
IntSeq *ints = nullptr;
@ -1582,7 +1586,7 @@ using namespace sta;
%typemap(in) ArcDcalcArgSeq {
Tcl_Obj *const source = $input;
int argc;
Tcl_Size argc;
Tcl_Obj **argv;
Sta *sta = Sta::sta();

View File

@ -31,14 +31,16 @@ using ::Tcl_GetChannelType;
extern "C" {
#if TCL_MAJOR_VERSION >= 9
#define CONST84 const
#endif
static int
encapOutputProc(ClientData instanceData,
CONST84 char *buf,
int toWrite,
int *errorCodePtr);
static int
encapCloseProc(ClientData instanceData, Tcl_Interp *interp);
static int
encapSetOptionProc(ClientData instanceData,
Tcl_Interp *interp,
CONST84 char *optionName,
@ -53,11 +55,6 @@ encapInputProc(ClientData instanceData,
char *buf,
int bufSize,
int *errorCodePtr);
static int
encapSeekProc(ClientData instanceData,
long offset,
int seekMode,
int *errorCodePtr);
static void
encapWatchProc(ClientData instanceData, int mask);
static int
@ -66,15 +63,34 @@ encapGetHandleProc(ClientData instanceData,
ClientData *handlePtr);
static int
encapBlockModeProc(ClientData instanceData, int mode);
#if TCL_MAJOR_VERSION < 9
static int
encapCloseProc(ClientData instanceData, Tcl_Interp *interp);
static int
encapSeekProc(ClientData instanceData,
long offset,
int seekMode,
int *errorCodePtr);
#endif
} // extern "C"
Tcl_ChannelType tcl_encap_type_stdout = {
const_cast<char *>("file"),
TCL_CHANNEL_VERSION_4,
"file",
TCL_CHANNEL_VERSION_5,
#if TCL_MAJOR_VERSION < 9
encapCloseProc,
#else
nullptr, // closeProc unused
#endif
encapInputProc,
encapOutputProc,
#if TCL_MAJOR_VERSION < 9
encapSeekProc,
#else
nullptr, // close2Proc
#endif
encapSetOptionProc,
encapGetOptionProc,
encapWatchProc,
@ -228,17 +244,6 @@ encapInputProc(ClientData,
return -1;
}
static int
encapCloseProc(ClientData instanceData,
Tcl_Interp *)
{
ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData);
report->logEnd();
report->redirectFileEnd();
report->redirectStringEnd();
return 0;
}
static int
encapSetOptionProc(ClientData,
Tcl_Interp *,
@ -257,15 +262,6 @@ encapGetOptionProc(ClientData,
return 0;
}
static int
encapSeekProc(ClientData,
long,
int,
int *)
{
return -1;
}
static void
encapWatchProc(ClientData, int)
{
@ -286,4 +282,28 @@ encapBlockModeProc(ClientData,
return 0;
}
#if TCL_MAJOR_VERSION < 9
static int
encapCloseProc(ClientData instanceData,
Tcl_Interp *)
{
ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData);
report->logEnd();
report->redirectFileEnd();
report->redirectStringEnd();
return 0;
}
static int
encapSeekProc(ClientData,
long,
int,
int *)
{
return -1;
}
#endif
} // namespace sta