diff options
author | Oscar Campbell <oscar@campbell.nu> | 2015-06-10 19:06:46 +0200 |
---|---|---|
committer | Oscar Campbell <oscar@campbell.nu> | 2015-06-10 19:06:46 +0200 |
commit | d892887c937a1e07418afb620098d4cd98275b2a (patch) | |
tree | 8f52707d6856c0caa1ad6117010b02f1434a7a28 /compiler/extccomp.nim | |
parent | 858cdd0b05df4846fb40a3263f05e54438995e99 (diff) | |
parent | 6c256ddcaef0c92b94d1a3e61f4e56cf7d017b50 (diff) | |
download | Nim-d892887c937a1e07418afb620098d4cd98275b2a.tar.gz |
Merge remote-tracking branch 'upstream/devel' into devel
Diffstat (limited to 'compiler/extccomp.nim')
-rw-r--r-- | compiler/extccomp.nim | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 186a3884d..38427b367 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -13,7 +13,8 @@ # nim files. import - lists, ropes, os, strutils, osproc, platform, condsyms, options, msgs, crc + lists, ropes, os, strutils, osproc, platform, condsyms, options, msgs, + securehash type TSystemCC* = enum @@ -572,26 +573,24 @@ proc getCompileCFileCmd*(cfilename: string, isExternal = false): string = "nim", quoteShell(getPrefixDir()), "lib", quoteShell(libpath)]) -proc footprint(filename: string): TCrc32 = - # note, '><' further modifies a crc value with a string. - result = crcFromFile(filename) >< - platform.OS[targetOS].name >< - platform.CPU[targetCPU].name >< - extccomp.CC[extccomp.cCompiler].name >< - getCompileCFileCmd(filename, true) +proc footprint(filename: string): SecureHash = + result = secureHash( + $secureHashFile(filename) & + platform.OS[targetOS].name & + platform.CPU[targetCPU].name & + extccomp.CC[extccomp.cCompiler].name & + getCompileCFileCmd(filename, true)) proc externalFileChanged(filename: string): bool = if gCmd notin {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToLLVM}: return false var crcFile = toGeneratedFile(filename.withPackageName, "crc") - var currentCrc = int(footprint(filename)) + var currentCrc = footprint(filename) var f: File if open(f, crcFile, fmRead): - var line = newStringOfCap(40) - if not f.readLine(line): line = "0" + let oldCrc = parseSecureHash(f.readLine()) close(f) - var oldCrc = parseInt(line) result = oldCrc != currentCrc else: result = true |