From: Clifford Wolf Date: Wed, 17 May 2017 18:46:22 +0000 (+0200) Subject: Enable readline and tcl in mxe builds X-Git-Tag: yosys-0.8~430 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=662a04781504c95f77e76e0026247806ac410cfc;p=yosys.git Enable readline and tcl in mxe builds --- diff --git a/CodingReadme b/CodingReadme index 9e85add28..5800e30c3 100644 --- a/CodingReadme +++ b/CodingReadme @@ -411,6 +411,32 @@ Updating the website: git commit -am update make push + + +Cross-Building for Windows with MXE +=================================== + +Check http://mxe.cc/#requirements and install all missing requirements. + +As root (or other user with write access to /usr/local/src): + + cd /usr/local/src + git clone https://github.com/mxe/mxe.git + cd mxe + + make -j$(nproc) MXE_PLUGIN_DIRS="plugins/tcl.tk" \ + MXE_TARGETS="i686-w64-mingw32.static" \ + gcc tcl readline + +Then as regular user in some directory where you build stuff: + + git clone https://github.com/cliffordwolf/yosys.git yosys-win32 + cd yosys-win32 + make config-mxe + make -j$(nproc) mxebin + + + How to add unit test ==================== diff --git a/Makefile b/Makefile index 71bd8cb55..d9eccf1dd 100644 --- a/Makefile +++ b/Makefile @@ -176,9 +176,10 @@ yosys.html: misc/yosys.html $(P) cp misc/yosys.html yosys.html else ifeq ($(CONFIG),mxe) +PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc LD = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc -CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE +CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_MXE_HACKS -Wno-attributes CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS)) LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s LDLIBS := $(filter-out -lrt,$(LDLIBS)) @@ -213,7 +214,7 @@ LDLIBS += -lcurses ABCMKARGS += "ABC_READLINE_LIBRARIES=-lcurses -lreadline" endif ifeq ($(CONFIG),mxe) -LDLIBS += -lpdcurses +LDLIBS += -ltermcap endif endif @@ -226,9 +227,14 @@ ifeq ($(ENABLE_TCL),1) TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')") TCL_INCLUDE ?= /usr/include/$(TCL_VERSION) +ifeq ($(CONFIG),mxe) +CXXFLAGS += -DYOSYS_ENABLE_TCL +LDLIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 +else CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION)) endif +endif ifeq ($(ENABLE_GPROF),1) CXXFLAGS += -pg @@ -557,9 +563,7 @@ config-emcc: clean config-mxe: clean echo 'CONFIG := mxe' > Makefile.conf - echo 'ENABLE_TCL := 0' >> Makefile.conf echo 'ENABLE_PLUGINS := 0' >> Makefile.conf - echo 'ENABLE_READLINE := 0' >> Makefile.conf config-msys2: clean echo 'CONFIG := msys2' > Makefile.conf diff --git a/kernel/yosys.h b/kernel/yosys.h index ae73146b8..1076fb215 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -74,6 +74,16 @@ #ifdef YOSYS_ENABLE_TCL # include +# ifdef YOSYS_MXE_HACKS +extern Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); +extern Tcl_Interp *Tcl_CreateInterp(void); +extern void Tcl_DeleteInterp(Tcl_Interp *interp); +extern int Tcl_Eval(Tcl_Interp *interp, const char *script); +extern int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName); +extern void Tcl_Finalize(void); +extern int Tcl_GetCommandInfo(Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr); +extern const char *Tcl_GetStringResult(Tcl_Interp *interp); +# endif #endif #ifdef _WIN32