koch now uses nim.exe
This commit is contained in:
parent
a68f17a9f7
commit
0f4567d59e
6 changed files with 51 additions and 42 deletions
|
|
@ -58,7 +58,7 @@ Files: "icons/koch.res"
|
||||||
Files: "icons/koch_icon.o"
|
Files: "icons/koch_icon.o"
|
||||||
|
|
||||||
Files: "compiler/readme.txt"
|
Files: "compiler/readme.txt"
|
||||||
Files: "compiler/nimrod.ini"
|
Files: "compiler/nim.ini"
|
||||||
Files: "compiler/nimrod.cfg"
|
Files: "compiler/nimrod.cfg"
|
||||||
Files: "compiler/*.nim"
|
Files: "compiler/*.nim"
|
||||||
Files: "compiler/c2nim/*.nim"
|
Files: "compiler/c2nim/*.nim"
|
||||||
|
|
@ -114,7 +114,7 @@ Files: "examples/*.tmpl"
|
||||||
|
|
||||||
|
|
||||||
[Windows]
|
[Windows]
|
||||||
Files: "bin/nimrod.exe"
|
Files: "bin/nim.exe"
|
||||||
Files: "bin/c2nim.exe"
|
Files: "bin/c2nim.exe"
|
||||||
Files: "bin/niminst.exe"
|
Files: "bin/niminst.exe"
|
||||||
Files: "bin/nimgrep.exe"
|
Files: "bin/nimgrep.exe"
|
||||||
|
|
@ -128,7 +128,7 @@ InnoSetup: "Yes"
|
||||||
|
|
||||||
|
|
||||||
[UnixBin]
|
[UnixBin]
|
||||||
Files: "bin/nimrod"
|
Files: "bin/nim"
|
||||||
|
|
||||||
|
|
||||||
[Unix]
|
[Unix]
|
||||||
|
|
@ -150,5 +150,4 @@ flags = "-w"
|
||||||
buildDepends: "gcc (>= 4:4.3.2)"
|
buildDepends: "gcc (>= 4:4.3.2)"
|
||||||
pkgDepends: "gcc (>= 4:4.3.2)"
|
pkgDepends: "gcc (>= 4:4.3.2)"
|
||||||
shortDesc: "The Nim Compiler"
|
shortDesc: "The Nim Compiler"
|
||||||
licenses: "bin/nimrod,MIT;lib/*,MIT;"
|
licenses: "bin/nim,MIT;lib/*,MIT;"
|
||||||
|
|
||||||
78
koch.nim
78
koch.nim
|
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Maintenance program for Nimrod
|
# Maintenance program for Nim
|
||||||
# (c) Copyright 2014 Andreas Rumpf
|
# (c) Copyright 2014 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
|
|
@ -26,7 +26,7 @@ when defined(haveZipLib):
|
||||||
const
|
const
|
||||||
HelpText = """
|
HelpText = """
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
| Maintenance program for Nimrod |
|
| Maintenance program for Nim |
|
||||||
| Version $1|
|
| Version $1|
|
||||||
| (c) 2014 Andreas Rumpf |
|
| (c) 2014 Andreas Rumpf |
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
|
|
@ -45,7 +45,7 @@ Possible Commands:
|
||||||
zip builds the installation ZIP package
|
zip builds the installation ZIP package
|
||||||
inno [options] builds the Inno Setup installer (for Windows)
|
inno [options] builds the Inno Setup installer (for Windows)
|
||||||
tests [options] run the testsuite
|
tests [options] run the testsuite
|
||||||
update updates nimrod to the latest version from github
|
update updates nim to the latest version from github
|
||||||
(compile koch with -d:withUpdate to enable)
|
(compile koch with -d:withUpdate to enable)
|
||||||
temp options creates a temporary compiler for testing
|
temp options creates a temporary compiler for testing
|
||||||
Boot options:
|
Boot options:
|
||||||
|
|
@ -61,13 +61,13 @@ Boot options:
|
||||||
proc exe(f: string): string = return addFileExt(f, ExeExt)
|
proc exe(f: string): string = return addFileExt(f, ExeExt)
|
||||||
|
|
||||||
proc findNim(): string =
|
proc findNim(): string =
|
||||||
var nimrod = "nimrod".exe
|
var nim = "nim".exe
|
||||||
result = "bin" / nimrod
|
result = "bin" / nim
|
||||||
if existsFile(result): return
|
if existsFile(result): return
|
||||||
for dir in split(getEnv("PATH"), PathSep):
|
for dir in split(getEnv("PATH"), PathSep):
|
||||||
if existsFile(dir / nimrod): return dir / nimrod
|
if existsFile(dir / nim): return dir / nim
|
||||||
# assume there is a symlink to the exe or something:
|
# assume there is a symlink to the exe or something:
|
||||||
return nimrod
|
return nim
|
||||||
|
|
||||||
proc exec(cmd: string) =
|
proc exec(cmd: string) =
|
||||||
echo(cmd)
|
echo(cmd)
|
||||||
|
|
@ -81,12 +81,12 @@ const
|
||||||
compileNimInst = "-d:useLibzipSrc tools/niminst/niminst"
|
compileNimInst = "-d:useLibzipSrc tools/niminst/niminst"
|
||||||
|
|
||||||
proc csource(args: string) =
|
proc csource(args: string) =
|
||||||
exec("$4 cc $1 -r $3 --var:version=$2 csource compiler/nimrod.ini $1" %
|
exec("$4 cc $1 -r $3 --var:version=$2 csource compiler/nim.ini $1" %
|
||||||
[args, NimrodVersion, compileNimInst, findNim()])
|
[args, NimVersion, compileNimInst, findNim()])
|
||||||
|
|
||||||
proc zip(args: string) =
|
proc zip(args: string) =
|
||||||
exec("$3 cc -r $2 --var:version=$1 zip compiler/nimrod.ini" %
|
exec("$3 cc -r $2 --var:version=$1 zip compiler/nim.ini" %
|
||||||
[NimrodVersion, compileNimInst, findNim()])
|
[NimVersion, compileNimInst, findNim()])
|
||||||
|
|
||||||
proc buildTool(toolname, args: string) =
|
proc buildTool(toolname, args: string) =
|
||||||
exec("$# cc $# $#" % [findNim(), args, toolname])
|
exec("$# cc $# $#" % [findNim(), args, toolname])
|
||||||
|
|
@ -96,50 +96,60 @@ proc inno(args: string) =
|
||||||
# make sure we have generated the niminst executables:
|
# make sure we have generated the niminst executables:
|
||||||
buildTool("tools/niminst/niminst", args)
|
buildTool("tools/niminst/niminst", args)
|
||||||
buildTool("tools/nimgrep", args)
|
buildTool("tools/nimgrep", args)
|
||||||
exec("tools" / "niminst" / "niminst --var:version=$# inno compiler/nimrod" %
|
exec("tools" / "niminst" / "niminst --var:version=$# inno compiler/nim" %
|
||||||
NimrodVersion)
|
NimVersion)
|
||||||
|
|
||||||
proc install(args: string) =
|
proc install(args: string) =
|
||||||
exec("$# cc -r $# --var:version=$# scripts compiler/nimrod.ini" %
|
exec("$# cc -r $# --var:version=$# scripts compiler/nim.ini" %
|
||||||
[findNim(), compileNimInst, NimrodVersion])
|
[findNim(), compileNimInst, NimVersion])
|
||||||
exec("sh ./install.sh $#" % args)
|
exec("sh ./install.sh $#" % args)
|
||||||
|
|
||||||
proc web(args: string) =
|
proc web(args: string) =
|
||||||
exec("$# cc -r tools/nimweb.nim web/nimrod --putenv:nimrodversion=$#" %
|
exec("$# cc -r tools/nimweb.nim web/nim --putenv:nimversion=$#" %
|
||||||
[findNim(), NimrodVersion])
|
[findNim(), NimVersion])
|
||||||
|
|
||||||
# -------------- boot ---------------------------------------------------------
|
# -------------- boot ---------------------------------------------------------
|
||||||
|
|
||||||
const
|
const
|
||||||
bootOptions = "" # options to pass to the bootstrap process
|
bootOptions = "" # options to pass to the bootstrap process
|
||||||
|
|
||||||
proc findStartNimrod: string =
|
proc findStartNim: string =
|
||||||
# we try several things before giving up:
|
# we try several things before giving up:
|
||||||
|
# * bin/nim
|
||||||
|
# * $PATH/nim
|
||||||
# * bin/nimrod
|
# * bin/nimrod
|
||||||
# * $PATH/nimrod
|
# * $PATH/nimrod
|
||||||
# If these fail, we try to build nimrod with the "build.(sh|bat)" script.
|
# If these fail, we try to build nim with the "build.(sh|bat)" script.
|
||||||
|
var nim = "nim".exe
|
||||||
|
result = "bin" / nim
|
||||||
|
if existsFile(result): return
|
||||||
|
for dir in split(getEnv("PATH"), PathSep):
|
||||||
|
if existsFile(dir / nim): return dir / nim
|
||||||
|
|
||||||
|
# try the old "nimrod.exe":
|
||||||
var nimrod = "nimrod".exe
|
var nimrod = "nimrod".exe
|
||||||
result = "bin" / nimrod
|
result = "bin" / nimrod
|
||||||
if existsFile(result): return
|
if existsFile(result): return
|
||||||
for dir in split(getEnv("PATH"), PathSep):
|
for dir in split(getEnv("PATH"), PathSep):
|
||||||
if existsFile(dir / nimrod): return dir / nimrod
|
if existsFile(dir / nim): return dir / nimrod
|
||||||
|
|
||||||
when defined(Posix):
|
when defined(Posix):
|
||||||
const buildScript = "build.sh"
|
const buildScript = "build.sh"
|
||||||
if existsFile(buildScript):
|
if existsFile(buildScript):
|
||||||
if tryExec("./" & buildScript): return "bin" / nimrod
|
if tryExec("./" & buildScript): return "bin" / nim
|
||||||
else:
|
else:
|
||||||
const buildScript = "build.bat"
|
const buildScript = "build.bat"
|
||||||
if existsFile(buildScript):
|
if existsFile(buildScript):
|
||||||
if tryExec(buildScript): return "bin" / nimrod
|
if tryExec(buildScript): return "bin" / nim
|
||||||
|
|
||||||
echo("Found no nimrod compiler and every attempt to build one failed!")
|
echo("Found no nim compiler and every attempt to build one failed!")
|
||||||
quit("FAILURE")
|
quit("FAILURE")
|
||||||
|
|
||||||
proc safeRemove(filename: string) =
|
proc safeRemove(filename: string) =
|
||||||
if existsFile(filename): removeFile(filename)
|
if existsFile(filename): removeFile(filename)
|
||||||
|
|
||||||
proc thVersion(i: int): string =
|
proc thVersion(i: int): string =
|
||||||
result = ("compiler" / "nimrod" & $i).exe
|
result = ("compiler" / "nim" & $i).exe
|
||||||
|
|
||||||
proc copyExe(source, dest: string) =
|
proc copyExe(source, dest: string) =
|
||||||
safeRemove(dest)
|
safeRemove(dest)
|
||||||
|
|
@ -147,13 +157,13 @@ proc copyExe(source, dest: string) =
|
||||||
inclFilePermissions(dest, {fpUserExec})
|
inclFilePermissions(dest, {fpUserExec})
|
||||||
|
|
||||||
proc boot(args: string) =
|
proc boot(args: string) =
|
||||||
var output = "compiler" / "nimrod".exe
|
var output = "compiler" / "nim".exe
|
||||||
var finalDest = "bin" / "nimrod".exe
|
var finalDest = "bin" / "nim".exe
|
||||||
|
|
||||||
copyExe(findStartNimrod(), 0.thVersion)
|
copyExe(findStartNim(), 0.thVersion)
|
||||||
for i in 0..2:
|
for i in 0..2:
|
||||||
echo "iteration: ", i+1
|
echo "iteration: ", i+1
|
||||||
exec i.thVersion & " c $# $# compiler" / "nimrod.nim" % [bootOptions, args]
|
exec i.thVersion & " c $# $# compiler" / "nim.nim" % [bootOptions, args]
|
||||||
if sameFileContent(output, i.thVersion):
|
if sameFileContent(output, i.thVersion):
|
||||||
copyExe(output, finalDest)
|
copyExe(output, finalDest)
|
||||||
echo "executables are equal: SUCCESS!"
|
echo "executables are equal: SUCCESS!"
|
||||||
|
|
@ -171,7 +181,7 @@ const
|
||||||
".idx", ".ilk"
|
".idx", ".ilk"
|
||||||
]
|
]
|
||||||
ignore = [
|
ignore = [
|
||||||
".bzrignore", "nimrod", "nimrod.exe", "koch", "koch.exe", ".gitignore"
|
".bzrignore", "nim", "nim.exe", "koch", "koch.exe", ".gitignore"
|
||||||
]
|
]
|
||||||
|
|
||||||
proc cleanAux(dir: string) =
|
proc cleanAux(dir: string) =
|
||||||
|
|
@ -275,15 +285,15 @@ template `|`(a, b): expr = (if a.len > 0: a else: b)
|
||||||
proc tests(args: string) =
|
proc tests(args: string) =
|
||||||
# we compile the tester with taintMode:on to have a basic
|
# we compile the tester with taintMode:on to have a basic
|
||||||
# taint mode test :-)
|
# taint mode test :-)
|
||||||
exec "nimrod cc --taintMode:on tests/testament/tester"
|
exec "nim cc --taintMode:on tests/testament/tester"
|
||||||
let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
|
let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
|
||||||
exec tester & " " & (args|"all")
|
exec tester & " " & (args|"all")
|
||||||
exec tester & " html"
|
exec tester & " html"
|
||||||
|
|
||||||
proc temp(args: string) =
|
proc temp(args: string) =
|
||||||
var output = "compiler" / "nimrod".exe
|
var output = "compiler" / "nim".exe
|
||||||
var finalDest = "bin" / "nimrod_temp".exe
|
var finalDest = "bin" / "nim_temp".exe
|
||||||
exec("nimrod c compiler" / "nimrod")
|
exec("nim c compiler" / "nim")
|
||||||
copyExe(output, finalDest)
|
copyExe(output, finalDest)
|
||||||
if args.len > 0: exec(finalDest & " " & args)
|
if args.len > 0: exec(finalDest & " " & args)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
|
||||||
else:
|
else:
|
||||||
# posix relies on crappy LD_LIBRARY_PATH (ugh!):
|
# posix relies on crappy LD_LIBRARY_PATH (ugh!):
|
||||||
var libpath = getenv"LD_LIBRARY_PATH".string
|
var libpath = getenv"LD_LIBRARY_PATH".string
|
||||||
if peg"\i '/nimrod' (!'/')* '/lib'" notin libpath:
|
if peg"\i '/nim' (!'/')* '/lib'" notin libpath:
|
||||||
echo "[Warning] insufficient LD_LIBRARY_PATH"
|
echo "[Warning] insufficient LD_LIBRARY_PATH"
|
||||||
var serverDll = DynlibFormat % "server"
|
var serverDll = DynlibFormat % "server"
|
||||||
safeCopyFile("tests/dll" / serverDll, "lib" / serverDll)
|
safeCopyFile("tests/dll" / serverDll, "lib" / serverDll)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
import parseutils, strutils, os, osproc, streams, parsecfg
|
import parseutils, strutils, os, osproc, streams, parsecfg
|
||||||
|
|
||||||
const
|
const
|
||||||
cmdTemplate* = r"nimrod $target --hints:on $options $file"
|
cmdTemplate* = r"nim $target --hints:on $options $file"
|
||||||
|
|
||||||
type
|
type
|
||||||
TTestAction* = enum
|
TTestAction* = enum
|
||||||
|
|
@ -18,7 +18,7 @@ type
|
||||||
actionRun = "run"
|
actionRun = "run"
|
||||||
actionReject = "reject"
|
actionReject = "reject"
|
||||||
TResultEnum* = enum
|
TResultEnum* = enum
|
||||||
reNimrodcCrash, # nimrod compiler seems to have crashed
|
reNimrodcCrash, # nim compiler seems to have crashed
|
||||||
reMsgsDiffer, # error messages differ
|
reMsgsDiffer, # error messages differ
|
||||||
reFilesDiffer, # expected and given filenames differ
|
reFilesDiffer, # expected and given filenames differ
|
||||||
reLinesDiffer, # expected and given line numbers differ
|
reLinesDiffer, # expected and given line numbers differ
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue