@@ -51,23 +51,34 @@ proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
51
51
else :
52
52
" csources_v1"
53
53
cd workspace:
54
- echo " Entering CSOURCES" , csourcesVersion, " exists " , dirExists(csourcesVersion)
55
54
if not dirExists(csourcesVersion):
56
55
exec " git clone https://github.com/nim-lang/" & csourcesVersion
57
56
57
+ var csourcesSucceed = false
58
58
cd workspace / csourcesVersion:
59
59
when defined(windows):
60
- exec " build.bat"
60
+ let cmd = " build.bat"
61
+ csourcesSucceed = os.execShellCmd(cmd) != 0
61
62
else :
62
63
let makeExe = findExe(" make" )
63
64
if makeExe.len == 0 :
64
- exec " sh build.sh"
65
+ let cmd = " sh build.sh"
66
+ csourcesSucceed = os.execShellCmd(cmd) != 0
65
67
else :
66
- exec " make"
67
- let nimExe0 = " .." / csourcesVersion / " bin" / " nim" .addFileExt(ExeExt)
68
+ let cmd = " make"
69
+ csourcesSucceed = os.execShellCmd(cmd) != 0
70
+
68
71
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
69
79
let nimExe = " bin" / " nim" .addFileExt(ExeExt)
70
- copyFileWithPermissions nimExe0, nimExe
80
+ when defined(nimExe0):
81
+ copyFileWithPermissions nimExe0, nimExe
71
82
exec nimExe & " c --noNimblePath --skipUserCfg --skipParentCfg --hints:off koch"
72
83
let kochExe = when defined(windows): " koch.exe" else : " ./koch"
73
84
exec kochExe & " boot -d:release --skipUserCfg --skipParentCfg --hints:off"
0 commit comments