add nimCompile to simplify koch; add nimfind to koch tools (#9723)
This commit is contained in:
parent
3fe8b4f69d
commit
2eb14bdd41
3 changed files with 29 additions and 20 deletions
37
koch.nim
37
koch.nim
|
|
@ -117,10 +117,11 @@ proc bundleNimbleSrc(latest: bool) =
|
||||||
|
|
||||||
proc bundleNimbleExe(latest: bool) =
|
proc bundleNimbleExe(latest: bool) =
|
||||||
bundleNimbleSrc(latest)
|
bundleNimbleSrc(latest)
|
||||||
# now compile Nimble and copy it to $nim/bin for the installer.ini
|
# installer.ini expects it under $nim/bin
|
||||||
# to pick it up:
|
nimCompile("dist/nimble/src/nimble.nim", options = "-d:release --nilseqs:on")
|
||||||
nimexec("c -d:release --nilseqs:on dist/nimble/src/nimble.nim")
|
|
||||||
copyExe("dist/nimble/src/nimble".exe, "bin/nimble".exe)
|
proc buildNimfind() =
|
||||||
|
nimCompile("tools/nimfind.nim", options = "-d:release")
|
||||||
|
|
||||||
proc buildNimble(latest: bool) =
|
proc buildNimble(latest: bool) =
|
||||||
# old installations created nim/nimblepkg/*.nim files. We remove these
|
# old installations created nim/nimblepkg/*.nim files. We remove these
|
||||||
|
|
@ -146,27 +147,24 @@ proc buildNimble(latest: bool) =
|
||||||
else:
|
else:
|
||||||
exec("git checkout -f stable")
|
exec("git checkout -f stable")
|
||||||
exec("git pull")
|
exec("git pull")
|
||||||
nimexec("c --noNimblePath --nilseqs:on -d:release " & installDir / "src/nimble.nim")
|
nimCompile(installDir / "src/nimble.nim", options = "--noNimblePath --nilseqs:on -d:release")
|
||||||
copyExe(installDir / "src/nimble".exe, "bin/nimble".exe)
|
|
||||||
|
|
||||||
proc bundleNimsuggest() =
|
proc bundleNimsuggest() =
|
||||||
nimexec "c -d:release -o:" & ("bin/nimsuggest".exe) &
|
nimCompile("nimsuggest/nimsuggest.nim", options = "-d:release")
|
||||||
" nimsuggest/nimsuggest.nim"
|
|
||||||
|
|
||||||
proc buildVccTool() =
|
proc buildVccTool() =
|
||||||
nimexec("c -o:bin/vccexe.exe tools/vccenv/vccexe")
|
nimCompile("tools/vccenv/vccexe.nim")
|
||||||
|
|
||||||
proc bundleWinTools() =
|
proc bundleWinTools() =
|
||||||
nimexec("c tools/finish.nim")
|
# TODO: consider building under `bin` instead of `.`
|
||||||
copyExe("tools/finish".exe, "finish".exe)
|
nimCompile("tools/finish.nim", outputDir = "")
|
||||||
removeFile("tools/finish".exe)
|
|
||||||
buildVccTool()
|
buildVccTool()
|
||||||
nimexec("c -o:bin/nimgrab.exe -d:ssl tools/nimgrab.nim")
|
nimCompile("tools/nimgrab.nim", options = "-d:ssl")
|
||||||
nimexec("c -o:bin/nimgrep.exe tools/nimgrep.nim")
|
nimCompile("tools/nimgrep.nim")
|
||||||
when false:
|
when false:
|
||||||
# not yet a tool worth including
|
# not yet a tool worth including
|
||||||
nimexec(r"c --cc:vcc --app:gui -o:bin\downloader.exe -d:ssl --noNimblePath " &
|
nimCompile(r"tools\downloader.nim", options = r"--cc:vcc --app:gui -d:ssl --noNimblePath --path:..\ui")
|
||||||
r"--path:..\ui tools\downloader.nim")
|
|
||||||
|
|
||||||
proc zip(latest: bool; args: string) =
|
proc zip(latest: bool; args: string) =
|
||||||
bundleNimbleExe(latest)
|
bundleNimbleExe(latest)
|
||||||
|
|
@ -200,12 +198,11 @@ proc buildTool(toolname, args: string) =
|
||||||
|
|
||||||
proc buildTools(latest: bool) =
|
proc buildTools(latest: bool) =
|
||||||
bundleNimsuggest()
|
bundleNimsuggest()
|
||||||
nimexec "c -d:release -o:" & ("bin/nimgrep".exe) & " tools/nimgrep.nim"
|
nimCompile("tools/nimgrep.nim", options = "-d:release")
|
||||||
when defined(windows): buildVccTool()
|
when defined(windows): buildVccTool()
|
||||||
|
nimCompile("nimpretty/nimpretty.nim", options = "-d:release")
|
||||||
nimexec "c -o:" & ("bin/nimpretty".exe) & " nimpretty/nimpretty.nim"
|
|
||||||
|
|
||||||
buildNimble(latest)
|
buildNimble(latest)
|
||||||
|
buildNimfind()
|
||||||
|
|
||||||
proc nsis(latest: bool; args: string) =
|
proc nsis(latest: bool; args: string) =
|
||||||
bundleNimbleExe(latest)
|
bundleNimbleExe(latest)
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,18 @@ proc execCleanPath*(cmd: string,
|
||||||
putEnv("PATH", prevPath)
|
putEnv("PATH", prevPath)
|
||||||
|
|
||||||
proc nimexec*(cmd: string) =
|
proc nimexec*(cmd: string) =
|
||||||
|
# Consider using `nimCompile` instead
|
||||||
exec findNim() & " " & cmd
|
exec findNim() & " " & cmd
|
||||||
|
|
||||||
|
proc nimCompile*(input: string, outputDir = "bin", mode = "c", options = "") =
|
||||||
|
# TODO: simplify pending https://github.com/nim-lang/Nim/issues/9513
|
||||||
|
var cmd = findNim() & " " & mode
|
||||||
|
let output = outputDir / input.splitFile.name.exe
|
||||||
|
cmd.add " -o:" & output
|
||||||
|
cmd.add " " & options
|
||||||
|
cmd.add " " & input
|
||||||
|
exec cmd
|
||||||
|
|
||||||
const
|
const
|
||||||
pdf = """
|
pdf = """
|
||||||
doc/manual.rst
|
doc/manual.rst
|
||||||
|
|
|
||||||
2
tools/nimfind.nims
Normal file
2
tools/nimfind.nims
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
--define:nimfind
|
||||||
|
--define:nimcore
|
||||||
Loading…
Add table
Add a link
Reference in a new issue