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 # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # 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) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
# Use standard target names # Use standard target names
cmake_policy(SET CMP0078 NEW) 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 cmake 3.24.2 3.29.2
clang 15.0.0 clang 15.0.0
gcc 11.4.0 gcc 11.4.0
tcl 8.6 8.6.6 tcl 8.6 8.6.16
swig 4.1.0 4.1.1 swig 4.1.0 4.1.1
bison 3.8.2 3.8.2 bison 3.8.2 3.8.2
flex 2.6.4 2.6.4 flex 2.6.4 2.6.4
@ -103,13 +103,22 @@ are illegal in c++17.
External library dependencies: External library dependencies:
``` ```
Ubuntu Macos license Ubuntu Darwin License
eigen 3.4.0 3.4.0 MPL2 required eigen 3.4.0 3.4.0 MPL2 required
cudd 3.0.0 3.0.0 BSD required cudd 3.0.0 3.0.0 BSD required
tclreadline 2.3.8 2.3.8 BSD optional tclreadline 2.3.8 2.3.8 BSD optional
zLib 1.2.5 1.2.8 zlib 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) The [TCL readline library](https://tclreadline.sourceforge.net/tclreadline.html)
links the GNU readline library to the TCL interpreter for command line editing 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 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 # because there doesn't appear to be a way to override
# searching OSX system directories before unix directories. # searching OSX system directories before unix directories.
set(TCL_POSSIBLE_NAMES tcl87 tcl8.7 set(TCL_POSSIBLE_NAMES
tcl87 tcl8.7
tcl86 tcl8.6 tcl86 tcl8.6
tcl85 tcl8.5 tcl85 tcl8.5
) )
@ -30,7 +31,7 @@ set(TCL_POSSIBLE_NAMES tcl87 tcl8.7
# tcl lib path guesses. # tcl lib path guesses.
if (NOT TCL_LIB_PATHS) if (NOT TCL_LIB_PATHS)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") 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) set(TCL_NO_DEFAULT_PATH TRUE)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TCL_LIB_PATHS /usr/lib /usr/lib64 /usr/local/lib) set(TCL_LIB_PATHS /usr/lib /usr/lib64 /usr/local/lib)

View File

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

View File

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