diff options
author | Araq <rumpf_a@web.de> | 2015-04-22 20:42:36 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-22 20:42:36 +0200 |
commit | 3b00d9cc7a06fd7720d56548b7139b8c52be5f33 (patch) | |
tree | 54fda4ce02aa3e25f4455bc6900d809f66e65e1f /koch.nim | |
parent | 8dadeebd084bb554b928c822abb43906766bf06d (diff) | |
download | Nim-3b00d9cc7a06fd7720d56548b7139b8c52be5f33.tar.gz |
removed a bit of cruft from koch
Diffstat (limited to 'koch.nim')
-rw-r--r-- | koch.nim | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/koch.nim b/koch.nim index 508d7e007..3ebfb6655 100644 --- a/koch.nim +++ b/koch.nim @@ -81,7 +81,7 @@ proc exec(cmd: string, errorcode: int = QuitFailure) = echo(cmd) if execShellCmd(cmd) != 0: quit("FAILURE", errorcode) -proc tryExec(cmd: string): bool = +proc tryExec(cmd: string): bool = echo(cmd) result = execShellCmd(cmd) == 0 @@ -96,7 +96,7 @@ proc copyExe(source, dest: string) = const compileNimInst = "-d:useLibzipSrc tools/niminst/niminst" -proc csource(args: string) = +proc csource(args: string) = exec("$4 cc $1 -r $3 --var:version=$2 --var:mingw=none csource --main:compiler/nim.nim compiler/installer.ini $1" % [args, VersionAsString, compileNimInst, findNim()]) @@ -114,13 +114,13 @@ proc nsis(args: string) = # make sure we have generated the niminst executables: buildTool("tools/niminst/niminst", args) buildTool("tools/nimgrep", args) - # produce 'nimrod_debug.exe': + # produce 'nim_debug.exe': exec "nim c compiler" / "nim.nim" copyExe("compiler/nim".exe, "bin/nim_debug".exe) exec(("tools" / "niminst" / "niminst --var:version=$# --var:mingw=mingw$#" & " nsis compiler/nim") % [VersionAsString, $(sizeof(pointer)*8)]) -proc install(args: string) = +proc install(args: string) = exec("$# cc -r $# --var:version=$# --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" % [findNim(), compileNimInst, VersionAsString]) exec("sh ./install.sh $#" % args) @@ -139,12 +139,10 @@ proc pdf(args="") = # -------------- boot --------------------------------------------------------- -proc findStartNim: string = +proc findStartNim: string = # we try several things before giving up: # * bin/nim # * $PATH/nim - # * bin/nimrod - # * $PATH/nimrod # If these fail, we try to build nim with the "build.(sh|bat)" script. var nim = "nim".exe result = "bin" / nim @@ -152,34 +150,27 @@ proc findStartNim: string = for dir in split(getEnv("PATH"), PathSep): if existsFile(dir / nim): return dir / nim - # try the old "nimrod.exe": - var nimrod = "nimrod".exe - result = "bin" / nimrod - if existsFile(result): return - for dir in split(getEnv("PATH"), PathSep): - if existsFile(dir / nim): return dir / nimrod - when defined(Posix): const buildScript = "build.sh" - if existsFile(buildScript): + if existsFile(buildScript): if tryExec("./" & buildScript): return "bin" / nim else: const buildScript = "build.bat" - if existsFile(buildScript): + if existsFile(buildScript): if tryExec(buildScript): return "bin" / nim echo("Found no nim compiler and every attempt to build one failed!") quit("FAILURE") -proc thVersion(i: int): string = +proc thVersion(i: int): string = result = ("compiler" / "nim" & $i).exe - + proc boot(args: string) = var output = "compiler" / "nim".exe var finalDest = "bin" / "nim".exe # default to use the 'c' command: let bootOptions = if args.len == 0 or args.startsWith("-"): "c" else: "" - + copyExe(findStartNim(), 0.thVersion) for i in 0..2: echo "iteration: ", i+1 @@ -204,7 +195,7 @@ const ".bzrignore", "nim", "nim.exe", "koch", "koch.exe", ".gitignore" ] -proc cleanAux(dir: string) = +proc cleanAux(dir: string) = for kind, path in walkDir(dir): case kind of pcFile: @@ -215,25 +206,25 @@ proc cleanAux(dir: string) = removeFile(path) of pcDir: case splitPath(path).tail - of "nimcache": + of "nimcache": echo "removing dir: ", path removeDir(path) of "dist", ".git", "icons": discard else: cleanAux(path) else: discard -proc removePattern(pattern: string) = - for f in walkFiles(pattern): +proc removePattern(pattern: string) = + for f in walkFiles(pattern): echo "removing: ", f removeFile(f) -proc clean(args: string) = +proc clean(args: string) = if existsFile("koch.dat"): removeFile("koch.dat") removePattern("web/*.html") removePattern("doc/*.html") cleanAux(getCurrentDir()) for kind, path in walkDir(getCurrentDir() / "build"): - if kind == pcDir: + if kind == pcDir: echo "removing dir: ", path removeDir(path) @@ -276,7 +267,7 @@ when defined(withUpdate): "Local branch must be ahead of it. Exiting...") else: quit("An error has occurred.") - + else: echo("No repo or executable found!") when defined(haveZipLib): @@ -293,7 +284,7 @@ when defined(withUpdate): quit("Error reading archive.") else: quit("No failback available. Exiting...") - + echo("Starting update...") boot(args) echo("Update complete!") @@ -346,8 +337,8 @@ proc temp(args: string) = copyExe(output, finalDest) if args.len > 0: exec(finalDest & " " & args) -proc showHelp() = - quit(HelpText % [VersionAsString & spaces(44-len(VersionAsString)), +proc showHelp() = + quit(HelpText % [VersionAsString & spaces(44-len(VersionAsString)), CompileDate, CompileTime], QuitSuccess) var op = initOptParser() |