summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--koch.nim85
-rw-r--r--tools/winrelease.nim9
2 files changed, 53 insertions, 41 deletions
diff --git a/koch.nim b/koch.nim
index aaa03d558..a07987eb9 100644
--- a/koch.nim
+++ b/koch.nim
@@ -233,7 +233,7 @@ proc bundleWinTools() =
             r"--path:..\ui tools\downloader.nim")
 
 proc zip(args: string) =
-  bundleNimbleSrc()
+  bundleNimbleExe()
   bundleNimsuggest(false)
   bundleWinTools()
   nimexec("cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
@@ -407,13 +407,15 @@ proc winReleaseArch(arch: string) =
   withMingw r"..\mingw" & arch & r"\bin":
     # Rebuilding koch is necessary because it uses its pointer size to
     # determine which mingw link to put in the NSIS installer.
-    nimexec "c --out:koch_temp --cpu:$# koch" % cpu
-    exec "koch_temp boot -d:release --cpu:$#" % cpu
-    exec "koch_temp zip -d:release"
+    nimexec "c --cpu:$# koch" % cpu
+    exec "koch boot -d:release --cpu:$#" % cpu
+    exec "koch zip -d:release"
     overwriteFile r"build\nim-$#.zip" % VersionAsString,
              r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch]
 
-proc winRelease() =
+proc winRelease*() =
+  # Now used from "tools/winrelease" and not directly supported by koch
+  # anymore!
   # Build -docs file:
   when true:
     web(gaCode)
@@ -530,39 +532,40 @@ proc showHelp() =
   quit(HelpText % [VersionAsString & spaces(44-len(VersionAsString)),
                    CompileDate, CompileTime], QuitSuccess)
 
-var op = initOptParser()
-op.next()
-case op.kind
-of cmdLongOption, cmdShortOption: showHelp()
-of cmdArgument:
-  case normalize(op.key)
-  of "boot": boot(op.cmdLineRest)
-  of "clean": clean(op.cmdLineRest)
-  of "web": web(op.cmdLineRest)
-  of "doc", "docs": web("--onlyDocs " & op.cmdLineRest)
-  of "json2": web("--json2 " & op.cmdLineRest)
-  of "website": website(op.cmdLineRest & gaCode)
-  of "web0":
-    # undocumented command for Araq-the-merciful:
-    web(op.cmdLineRest & gaCode)
-  of "pdf": pdf()
-  of "csource", "csources": csource(op.cmdLineRest)
-  of "zip": zip(op.cmdLineRest)
-  of "xz": xz(op.cmdLineRest)
-  of "nsis": nsis(op.cmdLineRest)
-  of "geninstall": geninstall(op.cmdLineRest)
-  of "distrohelper": geninstall()
-  of "install": install(op.cmdLineRest)
-  of "testinstall": testUnixInstall()
-  of "test", "tests": tests(op.cmdLineRest)
-  of "temp": temp(op.cmdLineRest)
-  of "xtemp": xtemp(op.cmdLineRest)
-  of "winrelease": winRelease()
-  of "wintools": bundleWinTools()
-  of "nimble": buildNimble(existsDir(".git"))
-  of "nimsuggest": bundleNimsuggest(buildExe=true)
-  of "tools": buildTools(existsDir(".git"))
-  of "pushcsource", "pushcsources": pushCsources()
-  of "valgrind": valgrind(op.cmdLineRest)
-  else: showHelp()
-of cmdEnd: showHelp()
+when isMainModule:
+  var op = initOptParser()
+  op.next()
+  case op.kind
+  of cmdLongOption, cmdShortOption: showHelp()
+  of cmdArgument:
+    case normalize(op.key)
+    of "boot": boot(op.cmdLineRest)
+    of "clean": clean(op.cmdLineRest)
+    of "web": web(op.cmdLineRest)
+    of "doc", "docs": web("--onlyDocs " & op.cmdLineRest)
+    of "json2": web("--json2 " & op.cmdLineRest)
+    of "website": website(op.cmdLineRest & gaCode)
+    of "web0":
+      # undocumented command for Araq-the-merciful:
+      web(op.cmdLineRest & gaCode)
+    of "pdf": pdf()
+    of "csource", "csources": csource(op.cmdLineRest)
+    of "zip": zip(op.cmdLineRest)
+    of "xz": xz(op.cmdLineRest)
+    of "nsis": nsis(op.cmdLineRest)
+    of "geninstall": geninstall(op.cmdLineRest)
+    of "distrohelper": geninstall()
+    of "install": install(op.cmdLineRest)
+    of "testinstall": testUnixInstall()
+    of "test", "tests": tests(op.cmdLineRest)
+    of "temp": temp(op.cmdLineRest)
+    of "xtemp": xtemp(op.cmdLineRest)
+    #of "winrelease": winRelease()
+    of "wintools": bundleWinTools()
+    of "nimble": buildNimble(existsDir(".git"))
+    of "nimsuggest": bundleNimsuggest(buildExe=true)
+    of "tools": buildTools(existsDir(".git"))
+    of "pushcsource", "pushcsources": pushCsources()
+    of "valgrind": valgrind(op.cmdLineRest)
+    else: showHelp()
+  of cmdEnd: showHelp()
diff --git a/tools/winrelease.nim b/tools/winrelease.nim
new file mode 100644
index 000000000..5a687cfaa
--- /dev/null
+++ b/tools/winrelease.nim
@@ -0,0 +1,9 @@
+## This is a small helper program to build the Win release.
+## This used to be part of koch (and it still uses koch as a library)
+## but since 'koch.exe' cannot overwrite itself is now its own program.
+## The problem is that 'koch.exe' too is part of the zip bundle and
+## needs to have the right 32/64 bit version. (Bug #6147)
+
+import "../koch"
+
+winRelease()