Rename compiler/nim.ini back to compiler/installer.ini

- Niminst has a new -m/--main option to set the main file, by default
  ini-file with .nim extension (old behaviour)
- Koch uses this to pass --main:compiler/nim.nim
- Fix includes/links of website.ini
This commit is contained in:
def 2015-03-13 17:03:57 +01:00
commit 06b986dbd5
5 changed files with 16 additions and 12 deletions

View file

@ -61,7 +61,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/nim.ini" Files: "compiler/installer.ini"
Files: "compiler/nim.nimrod.cfg" Files: "compiler/nim.nimrod.cfg"
Files: "compiler/*.nim" Files: "compiler/*.nim"
Files: "doc/*.txt" Files: "doc/*.txt"
@ -77,7 +77,7 @@ Files: "tools/niminst/*.nim"
Files: "tools/niminst/*.cfg" Files: "tools/niminst/*.cfg"
Files: "tools/niminst/*.tmpl" Files: "tools/niminst/*.tmpl"
Files: "tools/niminst/*.nsh" Files: "tools/niminst/*.nsh"
Files: "web/nim.ini" Files: "web/website.ini"
Files: "web/*.nim" Files: "web/*.nim"
Files: "web/*.txt" Files: "web/*.txt"

View file

@ -195,7 +195,7 @@ In the case of Nim's own documentation, the ``txt`` value is just a commit
hash to append to a formatted URL to https://github.com/Araq/Nim. The hash to append to a formatted URL to https://github.com/Araq/Nim. The
``tools/nimweb.nim`` helper queries the current git commit hash during doc ``tools/nimweb.nim`` helper queries the current git commit hash during doc
generation, but since you might be working on an unpublished repository, it generation, but since you might be working on an unpublished repository, it
also allows specifying a ``githash`` value in ``web/nim.ini`` to force a also allows specifying a ``githash`` value in ``web/website.ini`` to force a
specific commit in the output. specific commit in the output.

View file

@ -190,6 +190,6 @@ Real world example
The installers for the Nim compiler itself are generated by niminst. Have a The installers for the Nim compiler itself are generated by niminst. Have a
look at its configuration file: look at its configuration file:
.. include:: compiler/nim.ini .. include:: compiler/installer.ini
:literal: :literal:

View file

@ -97,13 +97,13 @@ 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 --var:mingw=none csource compiler/nim.ini $1" % 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()]) [args, VersionAsString, compileNimInst, findNim()])
proc zip(args: string) = proc zip(args: string) =
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none scripts compiler/nim.ini" % exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
[VersionAsString, compileNimInst, findNim()]) [VersionAsString, compileNimInst, findNim()])
exec("$# --var:version=$# --var:mingw=none zip compiler/nim.ini" % exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" %
["tools/niminst/niminst".exe, VersionAsString]) ["tools/niminst/niminst".exe, VersionAsString])
proc buildTool(toolname, args: string) = proc buildTool(toolname, args: string) =
@ -121,7 +121,7 @@ proc nsis(args: string) =
" nsis compiler/nim") % [VersionAsString, $(sizeof(pointer)*8)]) " nsis compiler/nim") % [VersionAsString, $(sizeof(pointer)*8)])
proc install(args: string) = proc install(args: string) =
exec("$# cc -r $# --var:version=$# --var:mingw=none scripts compiler/nim.ini" % exec("$# cc -r $# --var:version=$# --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
[findNim(), compileNimInst, VersionAsString]) [findNim(), compileNimInst, VersionAsString])
exec("sh ./install.sh $#" % args) exec("sh ./install.sh $#" % args)

View file

@ -57,7 +57,7 @@ type
platforms: array[1..maxOS, array[1..maxCPU, bool]] platforms: array[1..maxOS, array[1..maxCPU, bool]]
ccompiler, linker, innosetup, nsisSetup: tuple[path, flags: string] ccompiler, linker, innosetup, nsisSetup: tuple[path, flags: string]
name, displayName, version, description, license, infile, outdir: string name, displayName, version, description, license, infile, outdir: string
libpath: string mainfile, libpath: string
innoSetupFlag, installScript, uninstallScript: bool innoSetupFlag, installScript, uninstallScript: bool
explicitPlatforms: bool explicitPlatforms: bool
vars: StringTableRef vars: StringTableRef
@ -88,6 +88,7 @@ proc iniConfigData(c: var ConfigData) =
c.description = "" c.description = ""
c.license = "" c.license = ""
c.infile = "" c.infile = ""
c.mainfile = ""
c.outdir = "" c.outdir = ""
c.nimArgs = "" c.nimArgs = ""
c.libpath = "" c.libpath = ""
@ -146,6 +147,8 @@ Command:
deb create files for debhelper deb create files for debhelper
Options: Options:
-o, --output:dir set the output directory -o, --output:dir set the output directory
-m, --main:file set the main nim file, by default ini-file with .nim
extension
--var:name=value set the value of a variable --var:name=value set the value of a variable
-h, --help shows this help -h, --help shows this help
-v, --version shows the version -v, --version shows the version
@ -185,6 +188,7 @@ proc parseCmdLine(c: var ConfigData) =
stdout.write(Version & "\n") stdout.write(Version & "\n")
quit(0) quit(0)
of "o", "output": c.outdir = val of "o", "output": c.outdir = val
of "m", "main": c.mainfile = changeFileExt(val, "nim")
of "var": of "var":
var idx = val.find('=') var idx = val.find('=')
if idx < 0: quit("invalid command line") if idx < 0: quit("invalid command line")
@ -192,6 +196,7 @@ proc parseCmdLine(c: var ConfigData) =
else: quit(Usage) else: quit(Usage)
of cmdEnd: break of cmdEnd: break
if c.infile.len == 0: quit(Usage) if c.infile.len == 0: quit(Usage)
if c.mainfile.len == 0: c.mainfile = changeFileExt(c.infile, "nim")
proc walkDirRecursively(s: var seq[string], root: string) = proc walkDirRecursively(s: var seq[string], root: string) =
for k, f in walkDir(root): for k, f in walkDir(root):
@ -360,7 +365,7 @@ proc parseIniFile(c: var ConfigData) =
of cfgOption: quit(errorStr(p, "syntax error")) of cfgOption: quit(errorStr(p, "syntax error"))
of cfgError: quit(errorStr(p, k.msg)) of cfgError: quit(errorStr(p, k.msg))
close(p) close(p)
if c.name.len == 0: c.name = changeFileExt(extractFilename(c.infile), "") if c.name.len == 0: c.name = changeFileExt(extractFilename(c.mainfile), "")
if c.displayName.len == 0: c.displayName = c.name if c.displayName.len == 0: c.displayName = c.name
else: else:
quit("cannot open: " & c.infile) quit("cannot open: " & c.infile)
@ -466,8 +471,7 @@ proc srcdist(c: var ConfigData) =
var cmd = ("nim compile -f --symbolfiles:off --compileonly " & var cmd = ("nim compile -f --symbolfiles:off --compileonly " &
"--gen_mapping --cc:gcc --skipUserCfg" & "--gen_mapping --cc:gcc --skipUserCfg" &
" --os:$# --cpu:$# $# $#") % " --os:$# --cpu:$# $# $#") %
[osname, cpuname, c.nimArgs, [osname, cpuname, c.nimArgs, c.mainfile]
changeFileExt(c.infile, "nim")]
echo(cmd) echo(cmd)
if execShellCmd(cmd) != 0: if execShellCmd(cmd) != 0:
quit("Error: call to nim compiler failed") quit("Error: call to nim compiler failed")