koch: bundle nim-lang/fusion with Nim (#15061)

Initial work on bundling nim-lang/fusion as part of the Nim distribution.
This commit is contained in:
alaviss 2020-07-25 20:52:18 +00:00 • committed by GitHub
commit 33c2d7bfc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,7 @@
const const
NimbleStableCommit = "e5d340df8cf26f89ad2c9f0bc081ecd7e0323b0a" # master NimbleStableCommit = "e5d340df8cf26f89ad2c9f0bc081ecd7e0323b0a" # master
FusionStableCommit = "88100a2f45860e98850f7a62fe0b11c37c7a86a1"
when not defined(windows): when not defined(windows):
const const
@ -50,8 +51,10 @@ Usage:
koch [options] command [options for command] koch [options] command [options for command]
Options: Options:
--help, -h shows this help and quits --help, -h shows this help and quits
--latest bundle the installers with a bleeding edge Nimble --latest bundle the installers with bleeding edge versions of
--stable bundle the installers with a stable Nimble (default) external components.
--stable bundle the installers with stable versions of
external components (default).
--nim:path use specified path for nim binary --nim:path use specified path for nim binary
--localdocs[:path] only build local documentations. If a path is not --localdocs[:path] only build local documentations. If a path is not
specified (or empty), the default is used. specified (or empty), the default is used.
@ -59,9 +62,11 @@ Possible Commands:
boot [options] bootstraps with given command line options boot [options] bootstraps with given command line options
distrohelper [bindir] helper for distro packagers distrohelper [bindir] helper for distro packagers
tools builds Nim related tools tools builds Nim related tools
toolsNoNimble builds Nim related tools (except nimble) toolsNoExternal builds Nim related tools (except external tools,
ie. nimble)
doesn't require network connectivity doesn't require network connectivity
nimble builds the Nimble tool nimble builds the Nimble tool
fusion clone fusion into the working tree
Boot options: Boot options:
-d:release produce a release version of the compiler -d:release produce a release version of the compiler
-d:nimUseLinenoise use the linenoise library for interactive mode -d:nimUseLinenoise use the linenoise library for interactive mode
@ -194,7 +199,13 @@ proc bundleWinTools(args: string) =
nimCompile(r"tools\downloader.nim", nimCompile(r"tools\downloader.nim",
options = r"--cc:vcc --app:gui -d:ssl --noNimblePath --path:..\ui " & args) options = r"--cc:vcc --app:gui -d:ssl --noNimblePath --path:..\ui " & args)
proc bundleFusion(latest: bool) =
let commit = if latest: "HEAD" else: FusionStableCommit
cloneDependency(distDir, "https://github.com/nim-lang/fusion.git", commit)
copyDir(distDir / "fusion" / "src" / "fusion", "lib" / "fusion")
proc zip(latest: bool; args: string) = proc zip(latest: bool; args: string) =
bundleFusion(latest)
bundleNimbleExe(latest, args) bundleNimbleExe(latest, args)
bundleNimsuggest(args) bundleNimsuggest(args)
bundleNimpretty(args) bundleNimpretty(args)
@ -234,6 +245,7 @@ proc buildTools(args: string = "") =
options = "-d:release " & args) options = "-d:release " & args)
proc nsis(latest: bool; args: string) = proc nsis(latest: bool; args: string) =
bundleFusion(latest)
bundleNimbleExe(latest, args) bundleNimbleExe(latest, args)
bundleNimsuggest(args) bundleNimsuggest(args)
bundleWinTools(args) bundleWinTools(args)
@ -693,15 +705,18 @@ when isMainModule:
of "wintools": bundleWinTools(op.cmdLineRest) of "wintools": bundleWinTools(op.cmdLineRest)
of "nimble": buildNimble(latest, op.cmdLineRest) of "nimble": buildNimble(latest, op.cmdLineRest)
of "nimsuggest": bundleNimsuggest(op.cmdLineRest) of "nimsuggest": bundleNimsuggest(op.cmdLineRest)
of "toolsnonimble": # toolsNoNimble is kept for backward compatibility with build scripts
of "toolsnonimble", "toolsnoexternal":
buildTools(op.cmdLineRest) buildTools(op.cmdLineRest)
of "tools": of "tools":
buildTools(op.cmdLineRest) buildTools(op.cmdLineRest)
buildNimble(latest, op.cmdLineRest) buildNimble(latest, op.cmdLineRest)
bundleFusion(latest)
of "pushcsource", "pushcsources": pushCsources() of "pushcsource", "pushcsources": pushCsources()
of "valgrind": valgrind(op.cmdLineRest) of "valgrind": valgrind(op.cmdLineRest)
of "c2nim": bundleC2nim(op.cmdLineRest) of "c2nim": bundleC2nim(op.cmdLineRest)
of "drnim": buildDrNim(op.cmdLineRest) of "drnim": buildDrNim(op.cmdLineRest)
of "fusion": bundleFusion(latest)
else: showHelp() else: showHelp()
break break
of cmdEnd: break of cmdEnd: break