[Xcircuit-dev] Windows Tcl build using mingw64 gcc

Tomas Forssén tomas.forssen at gmail.com
Thu Mar 29 10:11:35 EDT 2012


Hi again,

I continued yesterdays work by taking the path of building xcircuit 
using a mingw64 gcc compiler.

It is rather untested but works better than my previous build. (Can now 
add more than 30 caps:) I know at least one error: Can't import a 
background ps-picture.

I will try out some tutorials and then come back with some info. At 
least this build process is far simpler then the one using the Windows SDK.

Perhaps the 64-bit target is a too big step to take at the moment. 
Perhaps the mingw32 environment is simpler. I have spotted a potential 
issue with casting (void*) into (int). This is ok when (void*) is 
32-bits but...

Patch to 3.7.37 is attached.

BR
/Tomas

-------------- next part --------------
>From 99aaceeb2ea8f932b586f988d17e940af236c914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20Forss=E9n?= <tomas.forssen at gmail.com>
Date: Thu, 29 Mar 2012 14:40:34 +0100
Subject: [PATCH 1/4] Add include stdlib.h. To define the malloc function.

---
 pp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/pp.c b/pp.c
index f17156a..354464d 100644
--- a/pp.c
+++ b/pp.c
@@ -15,6 +15,7 @@
 /*--------------------------------------------------------------*/
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 typedef struct _pattern {
-- 
1.7.4


>From 36f0f281642857af5fdc4f5ed76e32b67457ed8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20Forss=E9n?= <tomas.forssen at gmail.com>
Date: Thu, 29 Mar 2012 14:45:45 +0100
Subject: [PATCH 2/4] Change related to 32/64 bit platform issue.

This problem may occure where a 64-bit pointer is cast to a 32 bit datatype.
Im not sure about the propper solution. But the suggestion in xcircuit.h will
not do the trick since (unsigned long) is defined as 32bit integer.

Further, the pointer are cased to int in e.g event.c. So this may require some
work to resolve. On the other hand. If the ponters are positive and less
than MAX_INT then there is no trouble at all.
---
 events.c   |    1 +
 xcircuit.h |   24 ++++++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/events.c b/events.c
index 50bb849..fe1c809 100644
--- a/events.c
+++ b/events.c
@@ -1501,6 +1501,7 @@ void makepress(ClientData clientdata)
 void makepress(XtPointer clientdata, xcIntervalId *id) 
 #endif
 {
+   //TODO: If clientdata < 0 | clientdata > MAX_INT we are in trouble...
    int keywstate = (int)((pointertype)clientdata);
 
    /* Button/Key was pressed long enough to make a "press", not a "tap" */
diff --git a/xcircuit.h b/xcircuit.h
index 371d777..82d0a46 100644
--- a/xcircuit.h
+++ b/xcircuit.h
@@ -8,10 +8,11 @@
 /*----------------------------------------------------------------------*/
 
 #ifndef HAVE_U_CHAR
-typedef unsigned char	u_char;
-typedef unsigned short	u_short;
-typedef unsigned int	u_int;
-typedef unsigned long	u_long;
+typedef unsigned char       u_char;
+typedef unsigned short      u_short;
+typedef unsigned int        u_int;
+typedef unsigned long       u_long;
+typedef unsigned long long  u_long_long;
 #endif
 
 #ifdef XC_WIN32
@@ -78,6 +79,18 @@ typedef unsigned long	u_long;
 /*----------------------------------------------------------------------*/
 /* Deal with 32/64 bit processors based on autoconf results.		*/
 /*----------------------------------------------------------------------*/
+#ifndef SIZEOF_VOID_P
+#error "SIZEOF_VOID_P undefined!"
+#endif
+#ifndef SIZEOF_UNSIGNED_INT
+#error "SIZEOF_UNSIGNED_INT undefined!"
+#endif
+#ifndef SIZEOF_UNSIGNED_LONG
+#error "SIZEOF_UNSIGNED_LONG undefined!"
+#endif
+#ifndef SIZEOF_UNSIGNED_LONG_LONG
+#error "SIZEOF_UNSIGNED_LONG_LONG undefined!"
+#endif
 
 #if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT
 #define Number(a)		(void *)((u_int) a)
@@ -85,6 +98,9 @@ typedef u_int pointertype;
 #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG
 #define Number(a)		(void *)((u_long) a)
 typedef u_long pointertype;
+#elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG_LONG
+#define Number(a)		(void *)((u_long_long) a)
+typedef u_long_long pointertype;
 #else
 ERROR: Cannot compile without knowing the size of a pointer.  See xcircuit.h.
 #endif
-- 
1.7.4


>From 4797d88ae1877546d3469e8ebf3447b2627ab187 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20Forss=E9n?= <tomas.forssen at gmail.com>
Date: Thu, 29 Mar 2012 14:49:38 +0100
Subject: [PATCH 3/4] Add a Makefile.mingw64 to build a tcl version of
 xcircuit.

See Makefile.mingw64 for prerequisites.
---
 Makefile.mingw64 |  433 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 433 insertions(+), 0 deletions(-)
 create mode 100644 Makefile.mingw64

diff --git a/Makefile.mingw64 b/Makefile.mingw64
new file mode 100644
index 0000000..780622e
--- /dev/null
+++ b/Makefile.mingw64
@@ -0,0 +1,433 @@
+# Makefile for MinGW gcc64 compiler (modified from Makefile.win32)
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+###########################
+# Configuration variables #
+###########################
+
+INSTALLDIR = C:\app\xcircuit-tcl
+TEMPDIR    = D:\Temp
+
+GSDIR      = C:\app\gs\gs9.02x64
+GMDIR      = C:\app\graphicsmagick-1.3.14
+
+# Possible values: tcl, win32 (win32 may not work...)
+BUILD_TYPE = tcl
+
+# Additional settings for win32 build
+USE_WIN32_COM    = 0
+USE_WIN32_DOTNET = 0
+XCCOMDIR         = xccom2
+
+# Additional settings for tcl build
+TCLDIR     = C:\app\tclx64
+TCLVERSION = 85
+
+####################################################################
+# End of configuration. DO NOT CHANGE ANYTHING AFTER THIS POINT!!! #
+####################################################################
+
+SOURCES = menudep.c $(xcircuit_SOURCES)
+
+MK = $(MAKE) -f Makefile.mingw64
+
+srcdir = .
+top_srcdir = .
+top_builddir = .
+mkinstalldirs = mkdir
+
+menudep_SOURCES = menudep.c
+menudep_OBJECTS = menudep.$(OBJEXT)
+menudep_LDADD = $(LDADD)
+xcircuit_OBJECTS = elements.$(OBJEXT) events.$(OBJEXT) \
+	filelist.$(OBJEXT) files.$(OBJEXT) flate.$(OBJEXT) \
+	fontfile.$(OBJEXT) formats.$(OBJEXT) functions.$(OBJEXT) \
+	graphic.$(OBJEXT) help.$(OBJEXT) keybindings.$(OBJEXT) \
+	libraries.$(OBJEXT) menucalls.$(OBJEXT) netlist.$(OBJEXT) \
+	ngspice.$(OBJEXT) opengl.$(OBJEXT) parameter.$(OBJEXT) \
+	python.$(OBJEXT) rcfile.$(OBJEXT) render.$(OBJEXT) \
+	svg.$(OBJEXT) \
+	schema.$(OBJEXT) selection.$(OBJEXT) text.$(OBJEXT) \
+	undo.$(OBJEXT) xcircuit.$(OBJEXT) $(WIN32_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(CPPFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -Fe$@ #Not in use
+SOURCES = menudep.c $(xcircuit_SOURCES)
+DIST_SOURCES = menudep.c $(xcircuit_SOURCES)
+man1dir = $(mandir)
+MANS = $(man_MANS)
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+DIST_ARCHIVES = $(distdir).zip
+
+XC_CFLAGS   =
+XC_LIBS     =
+XC_OBJECT   =
+XC_INCLUDES =
+
+ifeq ($(BUILD_TYPE),win32)
+  WIN32_OBJECTS = xcwin32.$(OBJEXT) xtfuncs.$(OBJEXT) xtgui.$(OBJEXT) resources.res
+  BUILTINS_DIR  = WinBuiltinsDir()
+  STARTUP_FILE  = startup.script
+  XC_CFLAGS     = -DHAVE_XPM
+  ifneq ($(USE_WIN32_COM),0)
+    XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_COM
+    XC_DEPEND = $(XCCOMDIR)\XCCom.lib
+    XC_LIBS = $(XCCOMDIR)\XCCom.lib ole32.lib oleaut32.lib
+    ifneq ($(USE_WIN32_DOTNET),0)
+      XC_CFLAGS = $(XC_CFLAGS) -DUSE_WIN32_DOTNET
+    endif
+  endif
+else #!win32
+  WIN32_OBJECTS = tclxcircuit.$(OBJEXT) tkSimple.$(OBJEXT) w32x11.$(OBJEXT)
+  BUILTINS_DIR  = \"$(subst \,/,$(librarydir))\"
+  SCRIPTS_DIR  = \"$(subst \,/,$(scriptsdir))\"
+  STARTUP_FILE  = xcstartup.tcl
+  XC_CFLAGS     = -DTCL_WRAPPER -D_CRT_SECURE_NO_DEPRECATE
+  XC_INCLUDES   = -I$(TCLDIR)\include
+  XC_LIBS       = $(TCLDIR)\lib\tcl$(TCLVERSION).lib $(TCLDIR)\lib\tk$(TCLVERSION).lib
+endif
+
+
+# Override standard "make" target when compiling under TCL
+ALL_TARGET = all-recursive
+INSTALL_TARGET = install
+
+CC = c:\app\gcc64\bin\gcc.exe
+CFLAGS = -g -DSPICE_EXEC=\"$(subst \,/,$(SPICE_EXEC))\" -DHAVE_PUTENV -DGS_EXEC=\"$(subst \,/,$(GS_EXEC))\" -DGM_EXEC=\"$(subst \,/,$(GM_EXEC))\" -DXC_WIN32 -DDOUBLEBUFFER $(XC_CFLAGS)
+CPP = _not_in_use_
+CPPFLAGS =
+RM = del /S /Q
+RMDIR = rmdir /S /Q
+
+# Main compiler arguments
+DEFS = $(PATHNAMES)
+ECHO_C = echo
+ECHO_N = echo
+ECHO_T = echo
+EGREP = egrep
+EXEEXT = .exe
+EXTRA_LIB_SPECS =
+GS_EXEC = $(GSDIR)\bin\gswin64c.exe
+GM_EXEC = $(GMDIR)\gm.exe
+INC_SPECS = -I. $(XC_INCLUDES)
+INSTALL_DATA = copy /y
+INSTALL_PROGRAM = copy /y
+INSTALL_SCRIPT = copy /y
+INSTALL_STRIP_PROGRAM = copy /y
+INTERP_PATH = tcl
+LD = link _not_in_use_
+LDDL_FLAGS =
+LDFLAGS =
+LIBS = $(XC_LIBS)
+# LIBS = 	ws2_32.lib gdi32.lib user32.lib kernel32.lib comdlg32.lib comctl32.lib $(XC_LIBS)
+#	imm32.lib shell32.lib comctl32.lib advapi32.lib
+
+LIB_SPECS =
+PP = pp.exe
+
+# Man page
+MAKEINFO = makeinfo
+OBJEXT = o
+PACKAGE = xcircuit
+PACKAGE_NAME = xcircuit
+PATH_SEPARATOR = \\
+VERSION = 3.7
+REVISION = 37
+SHDLIB_EXT = .dll
+SHLIB_CFLAGS = --shared
+SHLIB_LIB_SPECS =
+SPICE_EXEC = ngspice.exe
+SUBDIRS =
+TCL_LIB_DIR = $(TCLDIR)\lib
+WISH_EXE = $(TCLDIR)\bin\wish$(TCLVERSION).exe
+WRAPPER_SCRIPT =
+XCIRCUIT_TARGET = $(BUILD_TYPE)
+X_EXTRA_LIBS =
+prefix = $(INSTALLDIR)
+bindir = $(prefix)\bin
+datadir = $(prefix)
+exec_prefix = $(prefix)\bin
+includedir = $(prefix)\include
+libdir = $(prefix)\lib
+libexecdir = $(prefix)\bin
+mandir = $(prefix)\doc
+mkdir_p = mkdir
+
+# Temporary directory (if not overridden by environment variable TMPDIR)
+tmpdir = $(TEMPDIR)
+
+# Directories for app-defaults file and manual page
+PATHNAMES = -DPROG_VERSION=$(VERSION) \
+	-DPROG_REVISION=$(REVISION) \
+	-DCAD_DIR=\"$(subst \,/,$(prefix))\" \
+	-DTEMP_DIR=\"$(subst \,/,$(tmpdir))\" \
+	-DSCRIPTS_DIR=\"$(scriptsdir)\" \
+	-DBUILTINS_DIR=$(BUILTINS_DIR) \
+	-DBUILTINS_FILE=\"$(BUILTINS_FILE)\" \
+	-DUSER_RC_FILE=\"$(USER_RC_FILE)\" \
+	-DPROLOGUE_DIR=$(BUILTINS_DIR) \
+	-DPROLOGUE_FILE=\"$(PROLOGUE_FILE)\" \
+	-DSTARTUP_FILE=\"$(STARTUP_FILE)\" \
+	-DLGF_LIB=\"$(LGF_LIB)\"
+
+xcircuit_SOURCES = elements.c events.c filelist.c files.c \
+	flate.c fontfile.c formats.c functions.c graphic.c \
+	help.c keybindings.c libraries.c menucalls.c \
+	netlist.c ngspice.c opengl.c parameter.c python.c \
+	rcfile.c render.c schema.c selection.c \
+	svg.c \
+	text.c undo.c \
+	tclxcircuit.c tkSimple.c xcircuit.c w32x11.c
+
+xcircuit_DEPEND = $(XC_DEPEND)
+xcircuit_LDADD =
+man_MANS = lib/xcircuit.1
+INCLUDES = $(INC_SPECS)
+
+# Library directory and files
+librarydir = $(datadir)\$(PACKAGE)-$(VERSION)
+scriptsdir = $(datadir)\$(PACKAGE)-$(VERSION)
+USER_RC_FILE = .xcircuitrc
+PROLOGUE_FILE = xcircps2.pro
+LGF_LIB = lgf.lps
+SIGNAL_LIB = signal.lps
+MUSIC_LIB = musiclib.lps
+FONTS_LPS = courier courieriso2 courieriso5 helvetica helveticaiso2 \
+	helveticaiso5 myfont symbol times_roman times_romaniso2 \
+	times_romaniso5
+
+FONTS_XFE = courier courieriso courieriso2 courieriso5 helvetica \
+	helveticaiso helveticaiso2 helveticaiso5 myfont symbol \
+	times_roman times_romaniso times_romaniso2 times_romaniso5
+
+SCRIPTS_PY = spice gettext pagebbox
+WRAPPER_INIT = xcircuit.tcl
+WRAPPER_OBJ = xcircuit$(SHDLIB_EXT)
+WRAPPER_SO = xcircuit.dll
+WRAPPER_SH = xcircuit.bat
+CONSOLE = tkcon.tcl
+CONSOLE_SCRIPT = console.tcl
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj .rc .res
+
+.c.o:
+	$(COMPILE) -c $<
+
+.c.obj:
+	$(COMPILE) -c "$<"
+
+.rc.res:
+	rc -fo$@ $(XC_CFLAGS) /i$(XCCOMDIR) $<
+
+##################
+# Building rules #
+##################
+
+menudep$(EXEEXT): menudep.$(OBJEXT)
+	$(CC) -o $@ menudep.$(OBJEXT)
+
+menudep.h: menudep$(EXEEXT) menus.h
+	.\menudep$(EXEEXT)
+
+xcwrap.obj: xcwrap.c menudep.h
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
+		xcwrap.c -c -o xcwrap.$(OBJEXT)
+
+lib\tcl\xcircuit$(SHDLIB_EXT): xcwrap.$(OBJEXT) $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
+	-$(RM) lib\xcircuit$(SHDLIB_EXT)
+	$(CC) $(CFLAGS) $(SHLIB_CFLAGS) -o $@ $(LDDL_FLAGS) xcwrap.$(OBJEXT) \
+		$(xcircuit_OBJECTS) $(xcircuit_LDADD) $(LDFLAGS) \
+		$(X_EXTRA_LIBS) $(EXTRA_LIBS) $(LIBS) $(EXTRA_LIB_SPECS) \
+		$(SHLIB_LIB_SPECS)
+
+xcircuit$(EXEEXT): $(xcircuit_OBJECTS) $(xcircuit_DEPEND)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(INCLUDES) $(xcircuit_OBJECTS) \
+		-o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib \
+		/link /SUBSYSTEM:CONSOLE
+
+xcircexec$(EXEEXT): xcircexec.$(OBJEXT)
+	-$(RM) .\xcircexec$(EXEEXT)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PATHNAMES) $(INCLUDES) \
+		xcircexec.c -o $@ $(LDFLAGS) \
+		$(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS)
+
+xcircuit-win32$(EXEEXT): xcircuit-win32.c resources.res
+	$(CC) $(CFLAGS) $(CPPFLAGS) \
+		-DWISH_EXE=L\"$(subst \,/,$(WISH_EXE))\" \
+		-DBUILTINS_DIR=L$(BUILTINS_DIR) \
+		$(INCLUDES) xcircuit-win32.c resources.res \
+		-o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib advapi32.lib
+
+tcl:
+	@echo Making tcl library object
+	$(MK) lib\tcl\xcircuit$(SHDLIB_EXT)
+	$(MK) lib\$(INTERP_PATH)\$(WRAPPER_SH)
+	$(MK) lib\$(INTERP_PATH)\$(WRAPPER_INIT)
+	$(MK) xcircexec$(EXEEXT)
+	$(MK) xcircuit-win32$(EXEEXT)
+
+win32:
+	@echo Making win32
+ifneq ($(USE_WIN32_COM),0)
+	cd $(XCCOMDIR) && $(MK) && cd ..
+endif
+	$(MK) xcircuit$(EXEEXT)
+
+help.c: menudep.h
+menucalls.c: menudep.h
+rcfile.c: menudep.h
+schema.c: menudep.h
+xcircuit.c: menudep.h
+parameter.c: menudep.h
+python.c: menudep.h
+tclxcircuit.c: menudep.h
+resources.rc: lib/pixmaps/xcircuit.ico
+
+$(PP): pp.c
+	$(CC) -g pp.c
+
+lib\$(INTERP_PATH)\$(WRAPPER_SH): $(PP) lib\$(INTERP_PATH)\$(WRAPPER_SH).in
+	$(PP) $(PATHNAMES) -DXCLIBDIR=\"$(subst \,/,$(librarydir))\" \
+		-DWRAPPER_INIT=\"$(WRAPPER_INIT)\" -DCONSOLE=\"$(CONSOLE)\" \
+		-DCONSOLE_SCRIPT=\"$(CONSOLE_SCRIPT)\" \
+		-DTCLLIBDIR=\"$(subst \,/,$(TCL_LIB_DIR))\" \
+		-DWISH_EXE=\"$(subst \,/,$(WISH_EXE))\" \
+		lib/$(INTERP_PATH)/$(WRAPPER_SH).in > $@
+
+lib\$(INTERP_PATH)\$(WRAPPER_INIT): $(PP) lib\$(INTERP_PATH)\$(WRAPPER_INIT).in
+	$(PP) $(PATHNAMES) -DLIBDIR=\"$(subst \,/,$(librarydir))\" \
+		lib/$(INTERP_PATH)/$(WRAPPER_INIT).in > $@
+
+lib\xcircuit.1: $(PP) lib\xcircuit.1.in
+	$(PP) -DLIBDIR=\"$(libdir)\" \
+		-DSCRIPTSDIR=\"$(scriptsdir)\" \
+		-DLGF=1 -DPYTHON=0 -DTCL=1 -DNOINTERP=0 \
+		lib\xcircuit.1.in > $@
+
+install-data-local: lib\xcircuit.1
+	@echo "Installing library files"
+	$(mkinstalldirs) $(DESTDIR)$(librarydir)
+	$(INSTALL_DATA) lib\$(PROLOGUE_FILE) $(DESTDIR)$(librarydir)
+	$(INSTALL_DATA) lib\*.lps $(DESTDIR)$(librarydir)
+	$(INSTALL_DATA) lib\$(INTERP_PATH)\$(STARTUP_FILE) $(DESTDIR)$(librarydir)
+	@echo "Installing .lps font files"
+	$(mkinstalldirs) $(DESTDIR)$(librarydir)\fonts
+	$(foreach f,$(FONTS_LPS), $(INSTALL_DATA) lib\fonts\$(f).lps $(DESTDIR)$(librarydir)\fonts &)
+	@echo "Installing .xfe font files"
+	$(foreach f,$(FONTS_XFE), $(INSTALL_DATA) lib\fonts\$(f).xfe $(DESTDIR)$(librarydir)\fonts &)
+	@echo "Installing scripts (if option enabled)"
+
+# Note that MacOS/Fink uses SHDLIB_EXT = .dylib but Tcl expects .so anyway.
+# So we make a symbolic link if SHDLIB_EXT != .so
+
+install-tcl: xcircexec$(EXEEXT) lib\$(INTERP_PATH)\$(WRAPPER_OBJ) lib\$(INTERP_PATH)\$(WRAPPER_SH) lib\$(INTERP_PATH)\$(WRAPPER_INIT) xcircuit-win32$(EXEEXT)
+	if exist $(prefix) $(RMDIR) $(prefix)
+	@echo "Installing standard XCircuit library files"
+	$(MK) $(AM_MAKEFLAGS) install-data-local
+	@echo "Installing Tcl files"
+	$(INSTALL_DATA) lib\$(INTERP_PATH)\$(WRAPPER_OBJ) $(DESTDIR)$(librarydir)
+	$(INSTALL_DATA) lib\$(INTERP_PATH)\*.tcl $(DESTDIR)$(librarydir)
+	$(INSTALL_DATA) xcircexec$(EXEEXT) $(DESTDIR)$(librarydir)
+	@echo "Installing pixmap images"
+	$(mkinstalldirs) $(DESTDIR)$(librarydir)\pixmaps
+	$(INSTALL_DATA) lib\pixmaps\*.gif $(DESTDIR)$(librarydir)\pixmaps
+	$(INSTALL_DATA) lib\pixmaps\*.xbm $(DESTDIR)$(librarydir)\pixmaps
+	@echo "Installing shell script as xcircuit executable"
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	$(INSTALL_DATA) lib\$(INTERP_PATH)\$(WRAPPER_SH) $(DESTDIR)$(bindir)
+	$(INSTALL_DATA) xcircuit-win32$(EXEEXT) $(DESTDIR)$(bindir)
+
+install-win32: xcircuit$(EXEEXT)
+	if exist $(prefix) $(RMDIR) $(prefix)
+	$(MK) $(AM_MAKEFLAGS) install-data-local "librarydir=$(prefix)"
+	$(INSTALL_DATA) xcircuit$(EXEEXT) $(DESTDIR)$(prefix)
+
+clean:
+	-$(RM) lib\$(INTERP_PATH)\$(WRAPPER_OBJ) lib\$(INTERP_PATH)\$(WRAPPER_SH)
+	-for %%e in (ilk exp pdb lib) do @if exist lib\$(INTERP_PATH)\xcircuit.%%e $(RM) lib\$(INTERP_PATH)\xcircuit.%%e
+	-$(RM) lib\$(INTERP_PATH)\$(WRAPPER_INIT)
+	-for %%f in (*.$(OBJEXT) xcircexec$(EXEEXT) lib\xcircuit.1 xcircuit$(EXEEXT) xcircuit.suo) do $(RM) %%f
+	-for %%e in (aps res) do $(RM) resources.%%e
+	-for %%e in (ilk exp pdb lib) do @if exist xcircexec.%%e $(RM) xcircexec.%%e
+	-for %%e in (ilk exp pdb lib) do @if exist xcircuit.%%e $(RM) xcircuit.%%e
+	-for %%e in (ilk exp pdb lib) do @if exist pp.%%e $(RM) pp.%%e
+	-for %%e in (ilk exp pdb lib exe) do @if exist xcircuit-win32.%%e $(RM) xcircuit-win32.%%e
+	-$(RM) menudep$(EXEEXT) menudep.h
+	-$(RM) pp$(EXEEXT)
+	-$(RM) *.pdb
+	-$(RM) *~
+ifeq ($(BUILD_TYPE),win32)
+  ifneq ($(USE_WIN32_COM),0)
+	cd $(XCCOMDIR) && $(MK) clean && cd ..
+  endif
+endif
+
+$(ALL_TARGET):
+	$(MK) $(XCIRCUIT_TARGET)
+
+$(INSTALL_TARGET):
+	$(MK) install-tcl
+
+examples: all
+ifeq ($(BUILD_TYPE),win32)
+  ifneq ($(USE_WIN32_COM),0)
+	cd $(XCCOMDIR) && $(MK) examples && cd ..
+  endif
+endif
+
+ifeq ($(BUILD_TYPE),win32)
+xcircuit.h: xcwin32.h
+xcwin32.c: xcircuit.h
+else
+xcircuit.h: tkwin32.h
+endif
+elements.c: xcircuit.h
+events.c: xcircuit.h
+filelist.c: xcircuit.h
+files.c: xcircuit.h
+flate.c: xcircuit.h
+fontfile.c: xcircuit.h
+formats.c: xcircuit.h
+functions.c: xcircuit.h
+graphic.c: xcircuit.h
+help.c: xcircuit.h
+keybindings.c: xcircuit.h
+libraries.c: xcircuit.h
+menucalls.c: xcircuit.h
+netlist.c: xcircuit.h
+ngspice.c: xcircuit.h
+opengl.c: xcircuit.h
+parameter.c: xcircuit.h
+python.c: xcircuit.h
+rcfile.c: xcircuit.h
+render.c: xcircuit.h
+schema.c: xcircuit.h
+selection.c: xcircuit.h
+text.c: xcircuit.h
+undo.c: xcircuit.h
+xcircuit.c: xcircuit.h
+xtgui.c: xcircuit.h
+xtfuncs.c: xcircuit.h
+ifeq ($(BUILD_TYPE),win32)
+  ifneq ($(USE_WIN32_COM),0)
+resources.rc: $(XCCOMDIR)/XCCom.tlb
+  endif
+endif
-- 
1.7.4


>From 20aa734f435e1cf0e9deecae167110e8ea2c6b42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20Forss=E9n?= <tomas.forssen at gmail.com>
Date: Thu, 29 Mar 2012 14:52:11 +0100
Subject: [PATCH 4/4] Added some link libraries.

---
 Makefile.mingw64 |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/Makefile.mingw64 b/Makefile.mingw64
index 780622e..1324c03 100644
--- a/Makefile.mingw64
+++ b/Makefile.mingw64
@@ -11,17 +11,26 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+# Prerequisites: - mingw x64 gcc compiler
+#                - make (often supplied with the gcc compiler)
+#                - Tcl x64 ver 8.5
+#                - gs9.02x64
+#                - graphicsmagick-1.3.14
+#
+# Note: This Makefile support only the tcl build.
+
 ###########################
 # Configuration variables #
 ###########################
-
 INSTALLDIR = C:\app\xcircuit-tcl
 TEMPDIR    = D:\Temp
 
+
+CC_EXEC    = C:\app\gcc64\bin\gcc.exe
 GSDIR      = C:\app\gs\gs9.02x64
 GMDIR      = C:\app\graphicsmagick-1.3.14
 
-# Possible values: tcl, win32 (win32 may not work...)
+# Possible values: tcl, win32
 BUILD_TYPE = tcl
 
 # Additional settings for win32 build
@@ -33,6 +42,12 @@ XCCOMDIR         = xccom2
 TCLDIR     = C:\app\tclx64
 TCLVERSION = 85
 
+# Some defines:
+SIZEOF_VOID_P := 8
+SIZEOF_UNSIGNED_INT := 4
+SIZEOF_UNSIGNED_LONG := 4
+SIZEOF_UNSIGNED_LONG_LONG := 8
+
 ####################################################################
 # End of configuration. DO NOT CHANGE ANYTHING AFTER THIS POINT!!! #
 ####################################################################
@@ -97,7 +112,7 @@ else #!win32
   BUILTINS_DIR  = \"$(subst \,/,$(librarydir))\"
   SCRIPTS_DIR  = \"$(subst \,/,$(scriptsdir))\"
   STARTUP_FILE  = xcstartup.tcl
-  XC_CFLAGS     = -DTCL_WRAPPER -D_CRT_SECURE_NO_DEPRECATE
+  XC_CFLAGS     = -DTCL_WRAPPER
   XC_INCLUDES   = -I$(TCLDIR)\include
   XC_LIBS       = $(TCLDIR)\lib\tcl$(TCLVERSION).lib $(TCLDIR)\lib\tk$(TCLVERSION).lib
 endif
@@ -107,8 +122,8 @@ endif
 ALL_TARGET = all-recursive
 INSTALL_TARGET = install
 
-CC = c:\app\gcc64\bin\gcc.exe
-CFLAGS = -g -DSPICE_EXEC=\"$(subst \,/,$(SPICE_EXEC))\" -DHAVE_PUTENV -DGS_EXEC=\"$(subst \,/,$(GS_EXEC))\" -DGM_EXEC=\"$(subst \,/,$(GM_EXEC))\" -DXC_WIN32 -DDOUBLEBUFFER $(XC_CFLAGS)
+CC = $(CC_EXEC)
+CFLAGS = -g -DSPICE_EXEC=\"$(subst \,/,$(SPICE_EXEC))\" -DHAVE_PUTENV -DGS_EXEC=\"$(subst \,/,$(GS_EXEC))\" -DGM_EXEC=\"$(subst \,/,$(GM_EXEC))\" -DXC_WIN32 -DDOUBLEBUFFER $(XC_CFLAGS) -DSIZEOF_VOID_P=($(SIZEOF_VOID_P)) -DSIZEOF_UNSIGNED_INT=($(SIZEOF_UNSIGNED_INT)) -DSIZEOF_UNSIGNED_LONG=($(SIZEOF_UNSIGNED_LONG)) -DSIZEOF_UNSIGNED_LONG_LONG=($(SIZEOF_UNSIGNED_LONG_LONG)) -D_MSC_VER
 CPP = _not_in_use_
 CPPFLAGS =
 RM = del /S /Q
@@ -133,7 +148,7 @@ INTERP_PATH = tcl
 LD = link _not_in_use_
 LDDL_FLAGS =
 LDFLAGS =
-LIBS = $(XC_LIBS)
+LIBS = -lws2_32 -lgdi32 $(XC_LIBS)
 # LIBS = 	ws2_32.lib gdi32.lib user32.lib kernel32.lib comdlg32.lib comctl32.lib $(XC_LIBS)
 #	imm32.lib shell32.lib comctl32.lib advapi32.lib
 
@@ -235,7 +250,8 @@ all: all-recursive
 	$(COMPILE) -c "$<"
 
 .rc.res:
-	rc -fo$@ $(XC_CFLAGS) /i$(XCCOMDIR) $<
+	windres -o $@ -O coff $(XC_CFLAGS) -I $(XCCOMDIR) $<
+
 
 ##################
 # Building rules #
@@ -274,7 +290,7 @@ xcircuit-win32$(EXEEXT): xcircuit-win32.c resources.res
 		-DWISH_EXE=L\"$(subst \,/,$(WISH_EXE))\" \
 		-DBUILTINS_DIR=L$(BUILTINS_DIR) \
 		$(INCLUDES) xcircuit-win32.c resources.res \
-		-o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) shell32.lib advapi32.lib
+		-o $@ $(LDFLAGS) $(LIBS) $(LIB_SPECS) $(EXTRA_LIB_SPECS) -lshell32 -ladvapi32
 
 tcl:
 	@echo Making tcl library object
@@ -302,7 +318,7 @@ tclxcircuit.c: menudep.h
 resources.rc: lib/pixmaps/xcircuit.ico
 
 $(PP): pp.c
-	$(CC) -g pp.c
+	$(CC) -g -o $@ pp.c
 
 lib\$(INTERP_PATH)\$(WRAPPER_SH): $(PP) lib\$(INTERP_PATH)\$(WRAPPER_SH).in
 	$(PP) $(PATHNAMES) -DXCLIBDIR=\"$(subst \,/,$(librarydir))\" \
-- 
1.7.4



More information about the Xcircuit-dev mailing list