Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/nimblepkg/nimenv.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,35 @@ proc compileNim*(options: Options, nimDest: string, v: VersionRange) =
else:
"csources_v1"
cd workspace:
echo "Entering CSOURCES", csourcesVersion, " exists ", dirExists(csourcesVersion)
if not dirExists(csourcesVersion):
exec "git clone https://github.com/nim-lang/" & csourcesVersion

var csourcesSucceed = false
cd workspace / csourcesVersion:
when defined(windows):
exec "build.bat"
let cmd = "build.bat"
csourcesSucceed = os.execShellCmd(cmd) == 0
else:
let makeExe = findExe("make")
if makeExe.len == 0:
exec "sh build.sh"
let cmd = "sh build.sh"
csourcesSucceed = os.execShellCmd(cmd) == 0
else:
exec "make"
let nimExe0 = ".." / csourcesVersion / "bin" / "nim".addFileExt(ExeExt)
let cmd = "make"
csourcesSucceed = os.execShellCmd(cmd) == 0

cd nimDest:
#Sometimes building from csources fails and we cant do much about it. So we fallback to the slow build_all method
if not csourcesSucceed:
display("Warning", "Building nim from csources failed. Using `build_all`", Warning, HighPriority)
let cmd =
when defined(windows): "build_all.bat"
else: "sh build_all.sh"
exec cmd
let nimExe = "bin" / "nim".addFileExt(ExeExt)
copyFileWithPermissions nimExe0, nimExe
let nimExe0 = ".." / csourcesVersion / "bin" / "nim".addFileExt(ExeExt)
if csourcesSucceed:
copyFileWithPermissions nimExe0, nimExe
exec nimExe & " c --noNimblePath --skipUserCfg --skipParentCfg --hints:off koch"
let kochExe = when defined(windows): "koch.exe" else: "./koch"
exec kochExe & " boot -d:release --skipUserCfg --skipParentCfg --hints:off"
Expand Down
1 change: 1 addition & 0 deletions tests/tniminstall.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ suite "Nim install":
echo "Checking version ", nimVer
let (_, exitCode) = execNimble("install", "-l")
let pkgPath = getCurrentDir() / "nimbledeps" / "pkgs2"
echo "Checking ", pkgPath
check exitCode == QuitSuccess
check walkDir(pkgPath).toSeq.anyIt(it[1].isNimPkgVer(nimVer))