@@ -51,23 +51,34 @@ proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
5151 else :
5252 " csources_v1"
5353 cd workspace:
54- echo " Entering CSOURCES" , csourcesVersion, " exists " , dirExists (csourcesVersion)
5554 if not dirExists (csourcesVersion):
5655 exec " git clone https://github.com/nim-lang/" & csourcesVersion
5756
57+ var csourcesSucceed = false
5858 cd workspace / csourcesVersion:
5959 when defined (windows):
60- exec " build.bat"
60+ let cmd = " build.bat"
61+ csourcesSucceed = os.execShellCmd (cmd) != 0
6162 else :
6263 let makeExe = findExe (" make" )
6364 if makeExe.len == 0 :
64- exec " sh build.sh"
65+ let cmd = " sh build.sh"
66+ csourcesSucceed = os.execShellCmd (cmd) != 0
6567 else :
66- exec " make"
67- let nimExe0 = " .." / csourcesVersion / " bin" / " nim" .addFileExt (ExeExt )
68+ let cmd = " make"
69+ csourcesSucceed = os.execShellCmd (cmd) != 0
70+
6871 cd nimDest:
72+ # Sometimes building from csources fails and we cant do much about it. So we fallback to the slow build_all method
73+ if not csourcesSucceed:
74+ display (" Warning" , " Building nim from csources failed. Using `build_all`" , Warning , HighPriority )
75+ let cmd =
76+ when defined (windows): " build_all.bat"
77+ else : " sh build_all.sh"
78+ exec cmd
6979 let nimExe = " bin" / " nim" .addFileExt (ExeExt )
70- copyFileWithPermissions nimExe0, nimExe
80+ when defined (nimExe0):
81+ copyFileWithPermissions nimExe0, nimExe
7182 exec nimExe & " c --noNimblePath --skipUserCfg --skipParentCfg --hints:off koch"
7283 let kochExe = when defined (windows): " koch.exe" else : " ./koch"
7384 exec kochExe & " boot -d:release --skipUserCfg --skipParentCfg --hints:off"
0 commit comments