summary refs log tree commit diff stats
path: root/tools/niminst
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-03-13 17:03:57 +0100
committerdef <dennis@felsin9.de>2015-03-13 17:03:57 +0100
commit06b986dbd58af03adf476ca3b0c8dbfbf9437c44 (patch)
tree6f64c4020f663944719b0f079ff35aa8d2d4c02b /tools/niminst
parent02432f1052be5fb2976cd340440434eda88494e1 (diff)
downloadNim-06b986dbd58af03adf476ca3b0c8dbfbf9437c44.tar.gz
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
Diffstat (limited to 'tools/niminst')
-rw-r--r--tools/niminst/niminst.nim12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index 90e864a4d..e50b251d3 100644
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -57,7 +57,7 @@ type
     platforms: array[1..maxOS, array[1..maxCPU, bool]]
     ccompiler, linker, innosetup, nsisSetup: tuple[path, flags: string]
     name, displayName, version, description, license, infile, outdir: string
-    libpath: string
+    mainfile, libpath: string
     innoSetupFlag, installScript, uninstallScript: bool
     explicitPlatforms: bool
     vars: StringTableRef
@@ -88,6 +88,7 @@ proc iniConfigData(c: var ConfigData) =
   c.description = ""
   c.license = ""
   c.infile = ""
+  c.mainfile = ""
   c.outdir = ""
   c.nimArgs = ""
   c.libpath = ""
@@ -146,6 +147,8 @@ Command:
   deb                 create files for debhelper
 Options:
   -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
   -h, --help          shows this help
   -v, --version       shows the version
@@ -185,6 +188,7 @@ proc parseCmdLine(c: var ConfigData) =
         stdout.write(Version & "\n")
         quit(0)
       of "o", "output": c.outdir = val
+      of "m", "main": c.mainfile = changeFileExt(val, "nim")
       of "var":
         var idx = val.find('=')
         if idx < 0: quit("invalid command line")
@@ -192,6 +196,7 @@ proc parseCmdLine(c: var ConfigData) =
       else: quit(Usage)
     of cmdEnd: break
   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) =
   for k, f in walkDir(root):
@@ -360,7 +365,7 @@ proc parseIniFile(c: var ConfigData) =
       of cfgOption: quit(errorStr(p, "syntax error"))
       of cfgError: quit(errorStr(p, k.msg))
     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
   else:
     quit("cannot open: " & c.infile)
@@ -466,8 +471,7 @@ proc srcdist(c: var ConfigData) =
       var cmd = ("nim compile -f --symbolfiles:off --compileonly " &
                  "--gen_mapping --cc:gcc --skipUserCfg" &
                  " --os:$# --cpu:$# $# $#") %
-                 [osname, cpuname, c.nimArgs,
-                 changeFileExt(c.infile, "nim")]
+                 [osname, cpuname, c.nimArgs, c.mainfile]
       echo(cmd)
       if execShellCmd(cmd) != 0:
         quit("Error: call to nim compiler failed")