koch: unify nimble building scripts [backport:1.4] (#15443)
This commit gets rid of buildNimble in favor of the simpler bundleNimbleExe, which does pretty much the same thing.
This commit is contained in:
parent
0bfa0fcaea
commit
3919f0aa54
1 changed files with 5 additions and 29 deletions
34
koch.nim
34
koch.nim
|
|
@ -145,35 +145,11 @@ proc bundleC2nim(args: string) =
|
||||||
|
|
||||||
proc bundleNimbleExe(latest: bool, args: string) =
|
proc bundleNimbleExe(latest: bool, args: string) =
|
||||||
let commit = if latest: "HEAD" else: NimbleStableCommit
|
let commit = if latest: "HEAD" else: NimbleStableCommit
|
||||||
cloneDependency(distDir, "https://github.com/nim-lang/nimble.git", commit = commit)
|
cloneDependency(distDir, "https://github.com/nim-lang/nimble.git",
|
||||||
|
commit = commit, allowBundled = true)
|
||||||
# installer.ini expects it under $nim/bin
|
# installer.ini expects it under $nim/bin
|
||||||
nimCompile("dist/nimble/src/nimble.nim",
|
nimCompile("dist/nimble/src/nimble.nim",
|
||||||
options = "-d:release --nilseqs:on " & args)
|
options = "-d:release --noNimblePath " & args)
|
||||||
|
|
||||||
proc buildNimble(latest: bool, args: string) =
|
|
||||||
# if koch is used for a tar.xz, build the dist/nimble we shipped
|
|
||||||
# with the tarball:
|
|
||||||
var installDir = "dist/nimble"
|
|
||||||
if not latest and dirExists(installDir) and not dirExists("dist/nimble/.git"):
|
|
||||||
discard "don't do the git dance"
|
|
||||||
else:
|
|
||||||
if not dirExists("dist/nimble/.git"):
|
|
||||||
if dirExists(installDir):
|
|
||||||
var id = 0
|
|
||||||
while dirExists("dist/nimble" & $id):
|
|
||||||
inc id
|
|
||||||
installDir = "dist/nimble" & $id
|
|
||||||
# consider using/adapting cloneDependency
|
|
||||||
exec("git clone -q https://github.com/nim-lang/nimble.git " & installDir)
|
|
||||||
withDir(installDir):
|
|
||||||
if latest:
|
|
||||||
exec("git checkout -f master")
|
|
||||||
exec("git pull")
|
|
||||||
else:
|
|
||||||
exec("git fetch")
|
|
||||||
exec("git checkout " & NimbleStableCommit)
|
|
||||||
nimCompile(installDir / "src/nimble.nim",
|
|
||||||
options = "--noNimblePath --nilseqs:on -d:release " & args)
|
|
||||||
|
|
||||||
proc bundleNimsuggest(args: string) =
|
proc bundleNimsuggest(args: string) =
|
||||||
nimCompileFold("Compile nimsuggest", "nimsuggest/nimsuggest.nim",
|
nimCompileFold("Compile nimsuggest", "nimsuggest/nimsuggest.nim",
|
||||||
|
|
@ -704,14 +680,14 @@ when isMainModule:
|
||||||
of "temp": temp(op.cmdLineRest)
|
of "temp": temp(op.cmdLineRest)
|
||||||
of "xtemp": xtemp(op.cmdLineRest)
|
of "xtemp": xtemp(op.cmdLineRest)
|
||||||
of "wintools": bundleWinTools(op.cmdLineRest)
|
of "wintools": bundleWinTools(op.cmdLineRest)
|
||||||
of "nimble": buildNimble(latest, op.cmdLineRest)
|
of "nimble": bundleNimbleExe(latest, op.cmdLineRest)
|
||||||
of "nimsuggest": bundleNimsuggest(op.cmdLineRest)
|
of "nimsuggest": bundleNimsuggest(op.cmdLineRest)
|
||||||
# toolsNoNimble is kept for backward compatibility with build scripts
|
# toolsNoNimble is kept for backward compatibility with build scripts
|
||||||
of "toolsnonimble", "toolsnoexternal":
|
of "toolsnonimble", "toolsnoexternal":
|
||||||
buildTools(op.cmdLineRest)
|
buildTools(op.cmdLineRest)
|
||||||
of "tools":
|
of "tools":
|
||||||
buildTools(op.cmdLineRest)
|
buildTools(op.cmdLineRest)
|
||||||
buildNimble(latest, op.cmdLineRest)
|
bundleNimbleExe(latest, op.cmdLineRest)
|
||||||
bundleFusion(latest)
|
bundleFusion(latest)
|
||||||
of "pushcsource", "pushcsources": pushCsources()
|
of "pushcsource", "pushcsources": pushCsources()
|
||||||
of "valgrind": valgrind(op.cmdLineRest)
|
of "valgrind": valgrind(op.cmdLineRest)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue