summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-18 12:58:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-18 12:58:55 (GMT)
commit37e202ac7dc66bdb08a93b1ef9337ca330c4271f (patch)
tree4d45f4996c67621266a7ec0b34fb68d20241676f
parent3ce435c13747183512cc8c2ff023487b9ffec74d (diff)
downloadtcl-37e202ac7dc66bdb08a93b1ef9337ca330c4271f.zip
tcl-37e202ac7dc66bdb08a93b1ef9337ca330c4271f.tar.gz
tcl-37e202ac7dc66bdb08a93b1ef9337ca330c4271f.tar.bz2
Update makefile.vc and rules.vc for using libtommath.dll/zlib1.dll in stead of statically linking libtommath, whenever possible.
-rw-r--r--.travis.yml2
-rw-r--r--generic/tclTestObj.c6
-rw-r--r--generic/tclTomMathDecls.h2
-rw-r--r--libtommath/tommath_private.h2
-rw-r--r--win/makefile.vc34
-rw-r--r--win/rules.vc28
-rw-r--r--win/tclWinPort.h3
7 files changed, 68 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml
index 0a4a0c6..85007a8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -332,7 +332,7 @@ matrix:
- BUILD_DIR=win
- CFGOPT="--enable-64bit"
before_install: &makepreinst
- - choco install make
+ - choco install -y make zip
- cd ${BUILD_DIR}
- name: "Windows/GCC/Shared: UTF_MAX=6"
os: windows
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index a692bce..892aee5 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -18,7 +18,11 @@
# define USE_TCL_STUBS
#endif
#include "tclInt.h"
-#include "tclTomMath.h"
+#ifdef TCL_WITH_EXTERNAL_TOMMATH
+# include "tommath.h"
+#else
+# include "tclTommath.h"
+#endif
#include "tclStringRep.h"
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 20c082f..b2294be 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -140,7 +140,7 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define mp_init_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_u64(a,(unsigned int)(b)))
#define mp_set_int(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_u64((a),((unsigned int)(b))),MP_OKAY))
#define mp_set_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ul") (TclBN_mp_set_u64((a),(long)(b)),MP_OKAY))
-#define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_ull") (TclBN_mp_set_u64((a),(b)),MP_OKAY))
+#define mp_set_long_long(a,b) (MP_DEPRECATED_PRAGMA("replaced by mp_set_u64") (TclBN_mp_set_u64((a),(b)),MP_OKAY))
#define mp_unsigned_bin_size(mp) (MP_DEPRECATED_PRAGMA("replaced by mp_ubin_size") (int)TclBN_mp_ubin_size(mp))
#undef TCL_STORAGE_CLASS
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h
index a0a7a42..aa4348b 100644
--- a/libtommath/tommath_private.h
+++ b/libtommath/tommath_private.h
@@ -158,8 +158,10 @@ extern void MP_FREE(void *mem, size_t size);
#define MP_HAS(x) (sizeof(MP_STRINGIZE(BN_##x##_C)) == 1u)
/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
+#if !defined(MP_64BIT) || defined(__GNUC__)
#undef mp_word
typedef private_mp_word mp_word;
+#endif
#define MP_MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MP_MAX(x, y) (((x) > (y)) ? (x) : (y))
diff --git a/win/makefile.vc b/win/makefile.vc
index 9b58fb2..e22f5f9 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -210,6 +210,7 @@ TCLTESTOBJS = \
$(TMP_DIR)\tclWinReg.obj \
$(TMP_DIR)\tclWinDde.obj \
!endif
+ $(OUT_DIR)\tommath.lib \
!endif
$(TMP_DIR)\testMain.obj
@@ -303,6 +304,7 @@ COREOBJS = \
$(TMP_DIR)\tclZipfs.obj \
$(TMP_DIR)\tclZlib.obj
+!if $(STATIC_BUILD)
ZLIBOBJS = \
$(TMP_DIR)\adler32.obj \
$(TMP_DIR)\compress.obj \
@@ -315,7 +317,11 @@ ZLIBOBJS = \
$(TMP_DIR)\trees.obj \
$(TMP_DIR)\uncompr.obj \
$(TMP_DIR)\zutil.obj
+!else
+ZLIBOBJS = $(OUT_DIR)\zdll.lib
+!endif
+!if $(STATIC_BUILD)
TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_add.obj \
$(TMP_DIR)\bn_mp_add_d.obj \
@@ -383,6 +389,9 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_s_mp_sub.obj \
$(TMP_DIR)\bn_s_mp_toom_sqr.obj \
$(TMP_DIR)\bn_s_mp_toom_mul.obj
+!else
+TOMMATHOBJS = $(OUT_DIR)\tommath.lib
+!endif
PLATFORMOBJS = \
$(TMP_DIR)\tclWin32Dll.obj \
@@ -443,7 +452,7 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
release: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
core: setup $(TCLLIB) $(TCLSTUBLIB)
shell: setup $(TCLSH)
-dlls: setup $(TCLREGLIB) $(TCLDDELIB)
+dlls: setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll $(OUT_DIR)\libtommath.dll
all: setup $(TCLSH) $(TCLSTUBLIB) dlls pkgs
tcltest: setup $(TCLTEST) dlls
install: install-binaries install-libraries install-docs install-pkgs
@@ -516,6 +525,27 @@ $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB)
$(_VC_MANIFEST_EMBED_DLL)
!endif
+!if "$(MACHINE)" == "AMD64"
+$(OUT_DIR)\zlib1.dll: $(COMPATDIR)\zlib\win64\zlib1.dll
+ $(COPY) $(COMPATDIR)\zlib\win64\zlib1.dll $(OUT_DIR)\zlib1.dll
+$(OUT_DIR)\zdll.lib: $(COMPATDIR)\zlib\win64\zdll.lib
+ $(COPY) $(COMPATDIR)\zlib\win64\zdll.lib $(OUT_DIR)\zdll.lib
+$(OUT_DIR)\libtommath.dll: $(TOMMATHDIR)\win64\libtommath.dll
+ $(COPY) $(TOMMATHDIR)\win64\libtommath.dll $(OUT_DIR)\libtommath.dll
+$(OUT_DIR)\tommath.lib: $(TOMMATHDIR)\win64\tommath.lib
+ $(COPY) $(TOMMATHDIR)\win64\tommath.lib $(OUT_DIR)\tommath.lib
+!else
+$(OUT_DIR)\zlib1.dll: $(COMPATDIR)\zlib\win32\zlib1.dll
+ $(COPY) $(COMPATDIR)\zlib\win32\zlib1.dll $(OUT_DIR)\zlib1.dll
+$(OUT_DIR)\zdll.lib: $(COMPATDIR)\zlib\win32\zdll.lib
+ $(COPY) $(COMPATDIR)\zlib\win32\zdll.lib $(OUT_DIR)\zdll.lib
+$(OUT_DIR)\libtommath.dll: $(TOMMATHDIR)\win32\libtommath.dll
+ $(COPY) $(TOMMATHDIR)\win32\libtommath.dll $(OUT_DIR)\libtommath.dll
+$(OUT_DIR)\tommath.lib: $(TOMMATHDIR)\win32\tommath.lib
+ $(COPY) $(TOMMATHDIR)\win32\tommath.lib $(OUT_DIR)\tommath.lib
+!endif
+
+
pkgs:
@for /d %d in ($(PKGSDIR)\*) do \
@if exist "%~fd\win\makefile.vc" ( \
@@ -853,6 +883,8 @@ install-binaries:
@$(CPY) "$(TCLLIB)" "$(BIN_INSTALL_DIR)\"
!endif
@$(CPY) "$(TCLIMPLIB)" "$(LIB_INSTALL_DIR)\"
+ @$(CPY) "$(OUT_DIR)\zlib1.dll" "$(BIN_INSTALL_DIR)\"
+ @$(CPY) "$(OUT_DIR)\libtommath.dll" "$(BIN_INSTALL_DIR)\"
!if exist($(TCLSH))
@echo Installing $(TCLSHNAME)
@$(CPY) "$(TCLSH)" "$(BIN_INSTALL_DIR)\"
diff --git a/win/rules.vc b/win/rules.vc
index cd3b035..c325ffe 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -746,6 +746,15 @@ TCL_USE_STATIC_PACKAGES = 1
TCL_USE_STATIC_PACKAGES = 0
!endif
+!if [nmakehlp -f $(OPTS) "nothreads"]
+!message *** Compile explicitly for non-threaded tcl
+TCL_THREADS = 0
+USE_THREAD_ALLOC= 0
+!else
+TCL_THREADS = 1
+USE_THREAD_ALLOC= 1
+!endif
+
!if [nmakehlp -f $(OPTS) "time64bit"]
!message *** Force 64-bit time_t
_USE_64BIT_TIME_T = 1
@@ -793,6 +802,12 @@ PGO = 0
!message *** Warning: ignoring option "loimpact" - deprecated on modern Windows.
!endif
+# TBD - should get rid of this option
+!if [nmakehlp -f $(OPTS) "thrdalloc"]
+!message *** Doing thrdalloc
+USE_THREAD_ALLOC = 1
+!endif
+
!if [nmakehlp -f $(OPTS) "tclalloc"]
USE_THREAD_ALLOC = 0
!endif
@@ -1190,8 +1205,8 @@ tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
!endif # $(DOING_TK) || $(NEED_TK)
# Various output paths
-PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX:t=).lib
-PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX:t=).$(EXT)
+PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
+PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
@@ -1284,6 +1299,11 @@ OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1
!endif
!if $(STATIC_BUILD)
OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD
+!elseif $(TCL_VERSION) > 86
+OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH
+!if "$(MACHINE)" == "AMD64"
+OPTDEFINES = $(OPTDEFINES) /DMP_64BIT
+!endif
!endif
!if $(TCL_NO_DEPRECATED)
OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED
@@ -1324,7 +1344,7 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=6
!endif
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
-COMPILERFLAGS = /D_ATL_XP_TARGETING=1 /DMP_32BIT=1
+COMPILERFLAGS = /D_ATL_XP_TARGETING
# Like the TEA system only set this non empty for non-Tk extensions
# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
@@ -1493,7 +1513,7 @@ RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
/DCOMMAVERSION=$(DOTVERSION:.=,),0 \
/DDOTVERSION=\"$(DOTVERSION)\" \
/DVERSION=\"$(VERSION)\" \
- /DSUFX=\"$(SUFX:t=)\" \
+ /DSUFX=\"$(SUFX)\" \
/DPROJECT=\"$(PROJECT)\" \
/DPRJLIBNAME=\"$(PRJLIBNAME)\"
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index b43316a..bae48b9 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -19,7 +19,8 @@
/* See [Bug 3354324]: file mtime sets wrong time */
# define __MINGW_USE_VC2005_COMPAT
#endif
-#if defined(_MSC_VER) && defined(_WIN64) && !defined(MP_32BIT) && !defined(STATIC_BUILD)
+#if defined(_MSC_VER) && defined(_WIN64) && !defined(STATIC_BUILD) \
+ && !defined(MP_32BIT) && !defined(MP_64BIT)
# define MP_64BIT
#endif