summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-01-15 08:56:35 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-01-15 10:12:28 +0100
commite216e0debda7efcaf9681a1233a38414c690e54f (patch)
tree5dde34ef516b5e69ac34d878f107b82a9aedd754 /tools
parent723a5a09f449be5ebf752c98c161b3da70c0ab93 (diff)
downloadNim-e216e0debda7efcaf9681a1233a38414c690e54f.tar.gz
finish tool: untested download feature
Diffstat (limited to 'tools')
-rw-r--r--tools/finish.nim26
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/finish.nim b/tools/finish.nim
index fffc7bf47..abdafebf1 100644
--- a/tools/finish.nim
+++ b/tools/finish.nim
@@ -1,7 +1,12 @@
 
 # -------------- post unzip steps ---------------------------------------------
 
-import strutils, os, osproc
+import strutils, os, osproc, browsers
+
+const arch = $(sizeof(int)*8)
+
+proc downloadMingw() =
+  openDefaultBrowser("http://nim-lang.org/download/mingw$1.zip" % arch)
 
 when defined(windows):
   import registry
@@ -159,6 +164,25 @@ proc main() =
           echo "*incompatible* means Nim and GCC disagree on the size of a pointer."
         echo "No compatible MingW candidates found " &
              "in the standard locations [Error]"
+        if askBool("Do you want to download MingW from Nim's website? (y/n) "):
+          let dest = getCurrentDir() / "dist"
+          downloadMingw()
+          echo "After download, unzip it in: ", dest
+          echo "so that ", dest / "mingw" & arch, " exists."
+          if askBool("Download and unzip successful? (y/n) "):
+            incompat.setLen 0
+            let alternative = tryDirs(incompat, defaultMingwLocations())
+            if alternative.len == 0:
+              if incompat.len > 0:
+                echo "The following *incompatible* MingW installations exist"
+                for x in incompat: echo x
+                echo "*incompatible* means Nim and GCC disagree on the size of a pointer."
+              echo "Still no compatible MingW candidates found " &
+                   "in the standard locations [Error]"
+            else:
+              echo "Patching Nim's config to use:"
+              echo alternative
+              patchConfig(alternative)
       else:
         if askBool("Found a MingW directory that is not in your PATH.\n" &
                    alternative &