summary refs log tree commit diff stats
path: root/tools/niminst
diff options
context:
space:
mode:
Diffstat (limited to 'tools/niminst')
-rw-r--r--tools/niminst/buildbat.tmpl2
-rw-r--r--tools/niminst/buildsh.tmpl14
-rw-r--r--tools/niminst/debcreation.nim2
-rw-r--r--tools/niminst/deinstall.tmpl2
-rw-r--r--tools/niminst/inno.tmpl4
-rw-r--r--tools/niminst/install.tmpl2
-rw-r--r--tools/niminst/makefile.tmpl168
-rw-r--r--tools/niminst/niminst.nim90
-rw-r--r--tools/niminst/nsis.tmpl10
9 files changed, 240 insertions, 54 deletions
diff --git a/tools/niminst/buildbat.tmpl b/tools/niminst/buildbat.tmpl
index 415574273..3a11715bf 100644
--- a/tools/niminst/buildbat.tmpl
+++ b/tools/niminst/buildbat.tmpl
@@ -1,5 +1,5 @@
 #! stdtmpl(subsChar='?') | standard
-#proc generateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string = 
+#proc generateBuildBatchScript(c: ConfigData, winIndex, cpuIndex: int): string = 
 #  result = "@echo off\nREM Generated by niminst\n"
 SET CC=gcc
 SET LINKER=gcc
diff --git a/tools/niminst/buildsh.tmpl b/tools/niminst/buildsh.tmpl
index 4966af07a..52da351be 100644
--- a/tools/niminst/buildsh.tmpl
+++ b/tools/niminst/buildsh.tmpl
@@ -1,7 +1,7 @@
 #! stdtmpl(subsChar='?') | standard
-#proc generateBuildShellScript(c: TConfigData): string = 
+#proc generateBuildShellScript(c: ConfigData): string = 
 #  result = "#! /bin/sh\n# Generated from niminst\n" &
-#           "# Template is in tools/buildsh.tmpl\n" &
+#           "# Template is in tools/niminst/buildsh.tmpl\n" &
 #           "# To regenerate run ``niminst csource`` or ``koch csource``\n"
 
 set -e
@@ -54,10 +54,16 @@ case $uos in
     myos="linux" 
     LINK_FLAGS="$LINK_FLAGS -ldl -lm"
     ;;
-  *freebsd* | *dragonfly* ) 
+  *dragonfly* )
     myos="freebsd"
     LINK_FLAGS="$LINK_FLAGS -lm"
     ;;
+  *freebsd* )
+    myos="freebsd"
+    CC="clang"
+    LINKER="clang"
+    LINK_FLAGS="$LINK_FLAGS -lm"
+    ;;
   *openbsd* )
     myos="openbsd" 
     LINK_FLAGS="$LINK_FLAGS -lm"
@@ -105,7 +111,7 @@ case $ucpu in
       LINK_FLAGS="$LINK_FLAGS -m64"
     fi
     mycpu="powerpc64" ;;
-  *power*|*Power*|*ppc* ) 
+  *power*|*ppc* ) 
     mycpu="powerpc" ;;
   *mips* ) 
     mycpu="mips" ;;
diff --git a/tools/niminst/debcreation.nim b/tools/niminst/debcreation.nim
index 574f7ea6b..bbd997981 100644
--- a/tools/niminst/debcreation.nim
+++ b/tools/niminst/debcreation.nim
@@ -84,7 +84,7 @@ proc createCopyright(pkgName, mtnName, mtnEmail, version: string,
     addN("Files: " & f)
     addN("License: " & license)
 
-proc formatDateTime(t: TTimeInfo, timezone: string): string =
+proc formatDateTime(t: TimeInfo, timezone: string): string =
   var day = ($t.weekday)[0..2] & ", "
   
   return "$1$2 $3 $4 $5:$6:$7 $8" % [day, intToStr(t.monthday, 2),
diff --git a/tools/niminst/deinstall.tmpl b/tools/niminst/deinstall.tmpl
index 15f912af6..c4717a257 100644
--- a/tools/niminst/deinstall.tmpl
+++ b/tools/niminst/deinstall.tmpl
@@ -1,5 +1,5 @@
 #! stdtmpl(subsChar='?') | standard
-#proc generateDeinstallScript(c: TConfigData): string = 
+#proc generateDeinstallScript(c: ConfigData): string = 
 #  result = "#! /bin/sh\n# Generated by niminst\n"
 #  var proj = c.name.toLower
 
diff --git a/tools/niminst/inno.tmpl b/tools/niminst/inno.tmpl
index 3460c22a2..4acf0557c 100644
--- a/tools/niminst/inno.tmpl
+++ b/tools/niminst/inno.tmpl
@@ -1,5 +1,5 @@
 #! stdtmpl | standard
-#proc generateInnoSetup(c: TConfigData): string =
+#proc generateInnoSetup(c: ConfigData): string =
 #  result = ""
 ; Default Template for NimInst
 [Setup]
@@ -19,7 +19,7 @@ ChangesEnvironment=yes
 Name: english; MessagesFile: compiler:Default.isl
 
 [Files] 
-  #for i in low(TFileCategory)..fcWindows:
+  #for i in low(FileCategory)..fcWindows:
   #  for f in items(c.cat[i]):
 Source: ${expandFilename(f).toWin}; DestDir: {app}\${splitFile(f).dir.toWin}; Flags: ignoreversion
   #  end for
diff --git a/tools/niminst/install.tmpl b/tools/niminst/install.tmpl
index 437e13dfb..3ec42c287 100644
--- a/tools/niminst/install.tmpl
+++ b/tools/niminst/install.tmpl
@@ -1,5 +1,5 @@
 #! stdtmpl(subsChar = '?') | standard
-#proc generateInstallScript(c: TConfigData): string = 
+#proc generateInstallScript(c: ConfigData): string = 
 #  result = "#! /bin/sh\n# Generated by niminst\n"
 #  var proj = c.name.toLower
 
diff --git a/tools/niminst/makefile.tmpl b/tools/niminst/makefile.tmpl
new file mode 100644
index 000000000..8ab3b89d1
--- /dev/null
+++ b/tools/niminst/makefile.tmpl
@@ -0,0 +1,168 @@
+#! stdtmpl(subsChar='?') | standard
+#proc generateMakefile(c: ConfigData): string = 
+#  result = "# Generated from niminst\n" &
+#           "# Template is in tools/niminst/makefile.tmpl\n" &
+#           "# To regenerate run ``niminst csource`` or ``koch csource``\n"
+
+CC = gcc
+LINKER = gcc
+COMP_FLAGS = ?{c.ccompiler.flags}
+LINK_FLAGS = ?{c.linker.flags}
+binDir = ?{firstBinPath(c).toUnix}
+
+koch := $(shell sh -c 'test -s ../koch.nim && echo "yes"')
+ifeq ($(koch),yes)
+	binDir = ../bin
+endif
+
+ucpu := $(shell sh -c 'uname -m | tr "[:upper:]" "[:lower:]"')
+uos := $(shell sh -c 'uname | tr "[:upper:]" "[:lower:]"')
+
+ifeq ($(uos),linux)
+	myos = linux
+	LINK_FLAGS += -ldl -lm
+endif
+ifeq ($(uos),dragonfly)
+	myos = freebsd
+	LINK_FLAGS += -lm
+endif
+ifeq ($(uos),freebsd)
+	myos= freebsd
+	CC = clang
+	LINKER = clang
+	LINK_FLAGS += -lm
+endif
+ifeq ($(uos),openbsd)
+	myos = openbsd
+	LINK_FLAGS += -lm
+endif
+ifeq ($(uos),netbsd)
+	myos = netbsd
+	LINK_FLAGS += -lm
+endif
+ifeq ($(uos),darwin)
+	myos = macosx
+	CC = clang
+	LINKER = clang
+	LINK_FLAGS += -ldl -lm
+	ifeq ($HOSTTYPE,x86_64)
+		ucpu = amd64
+	endif
+endif
+ifeq ($(uos),aix)
+	myos = aix
+	LINK_FLAGS += -dl -lm
+endif
+ifeq ($(uos),solaris)
+	myos = solaris
+	LINK_FLAGS += -ldl -lm -lsocket -lnsl
+endif
+ifeq ($(uos),sun)
+	myos = solaris
+	LINK_FLAGS += -ldl -lm -lsocket -lnsl
+endif
+ifeq ($(uos),haiku)
+	myos = haiku
+endif
+ifndef uos
+	@echo "Error: unknown operating system: $(uos)"
+	@exit 1
+endif
+
+ifeq ($(ucpu),i386)
+	mycpu = i386
+endif
+ifeq ($(ucpu),i486)
+	mycpu = i386
+endif
+ifeq ($(ucpu),i586)
+	mycpu = i386
+endif
+ifeq ($(ucpu),i686)
+	mycpu = i386
+endif
+ifeq ($(ucpu),bepc)
+	mycpu = i386
+endif
+ifeq ($(ucpu),i86pc)
+	mycpu = i386
+endif
+ifeq ($(ucpu),amd64)
+	mycpu = amd64
+endif
+ifeq ($(ucpu),x86-64)
+	mycpu = amd64
+endif
+ifeq ($(ucpu),x86_64)
+	mycpu = amd64
+endif
+ifeq ($(ucpu),sparc)
+	mycpu = sparc
+endif
+ifeq ($(ucpu),sun)
+	mycpu = sparc
+endif
+ifeq ($(ucpu),ppc64)
+	mycpu = powerpc64
+	ifeq ($(myos),linux)
+		COMP_FLAGS += -m64
+		LINK_FLAGS += -m64
+	endif
+endif
+ifeq ($(ucpu),powerpc)
+	mycpu = powerpc
+endif
+ifeq ($(ucpu),ppc)
+	mycpu = ppc
+endif
+ifeq ($(ucpu),mips)
+	mycpu = mips
+endif
+ifeq ($(ucpu),arm)
+	mycpu = arm
+endif
+ifeq ($(ucpu),armeb)
+	mycpu = arm
+endif
+ifeq ($(ucpu),armel)
+	mycpu = arm
+endif
+ifeq ($(ucpu),armv6l)
+	mycpu = arm
+endif
+ifndef ucpu
+	@echo "Error: unknown processor : $(ucpu)"
+	@exit 1
+endif
+
+# for osA in 1..c.oses.len:
+ifeq ($(myos),?{c.oses[osA-1]})
+#   for cpuA in 1..c.cpus.len:
+	ifeq ($(mycpu),?{c.cpus[cpuA-1]})
+#     var oFiles = ""
+#     for ff in c.cfiles[osA][cpuA].items:
+#       oFiles.add(" " & changeFileExt(ff.toUnix, "o"))
+#     end for
+		oFiles =?oFiles
+	endif
+#   end for
+endif
+# end for
+
+ifeq ($(strip $(oFiles)),)
+	@echo "Error: no C code generated for: [$(myos): $(mycpu)]"
+	@exit 1
+endif
+
+%.o: %.c
+	$(CC) $(COMP_FLAGS) -Ic_code -c $< -o $@
+
+?{"$(binDir)/" & toLower(c.name)}: $(oFiles)
+	@mkdir -p $(binDir)
+	$(LINKER) -o $@ $^ $(LINK_FLAGS)
+	@echo "SUCCESS"
+
+.PHONY: clean
+
+clean:
+	rm -f $(oFiles) ?{"$(binDir)/" & toLower(c.name)}
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index 9ee3eb9b9..e50b251d3 100644
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -1,7 +1,7 @@
 #
 #
 #        The Nim Installation Generator
-#        (c) Copyright 2014 Andreas Rumpf
+#        (c) Copyright 2015 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -22,12 +22,13 @@ const
   buildShFile = "build.sh"
   buildBatFile32 = "build.bat"
   buildBatFile64 = "build64.bat"
+  makeFile = "makefile"
   installShFile = "install.sh"
   deinstallShFile = "deinstall.sh"
 
 type
-  TAppType = enum appConsole, appGUI
-  TAction = enum
+  AppType = enum appConsole, appGUI
+  Action = enum
     actionNone,   # action not yet known
     actionCSource # action: create C sources
     actionInno,   # action: create Inno Setup installer
@@ -36,7 +37,7 @@ type
     actionZip,    # action: create zip file
     actionDeb     # action: prepare deb package
 
-  TFileCategory = enum
+  FileCategory = enum
     fcWinBin,     # binaries for Windows
     fcConfig,     # configuration files
     fcData,       # data files
@@ -48,19 +49,19 @@ type
     fcUnixBin,    # binaries for Unix
     fcDocStart    # links to documentation for Windows installer
 
-  TConfigData = object of TObject
-    actions: set[TAction]
-    cat: array[TFileCategory, seq[string]]
+  ConfigData = object of RootObj
+    actions: set[Action]
+    cat: array[FileCategory, seq[string]]
     binPaths, authors, oses, cpus, downloads: seq[string]
     cfiles: array[1..maxOS, array[1..maxCPU, seq[string]]]
     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: PStringTable
-    app: TAppType
+    vars: StringTableRef
+    app: AppType
     nimArgs: string
     debOpts: TDebOptions
 
@@ -69,9 +70,9 @@ const
     "$configdir", "$datadir", "$docdir", "$libdir"
   ]
 
-proc initConfigData(c: var TConfigData) =
+proc iniConfigData(c: var ConfigData) =
   c.actions = {}
-  for i in low(TFileCategory)..high(TFileCategory): c.cat[i] = @[]
+  for i in low(FileCategory)..high(FileCategory): c.cat[i] = @[]
   c.binPaths = @[]
   c.authors = @[]
   c.oses = @[]
@@ -87,6 +88,7 @@ proc initConfigData(c: var TConfigData) =
   c.description = ""
   c.license = ""
   c.infile = ""
+  c.mainfile = ""
   c.outdir = ""
   c.nimArgs = ""
   c.libpath = ""
@@ -100,7 +102,7 @@ proc initConfigData(c: var TConfigData) =
   c.debOpts.shortDesc = ""
   c.debOpts.licenses = @[]
 
-proc firstBinPath(c: TConfigData): string =
+proc firstBinPath(c: ConfigData): string =
   if c.binPaths.len > 0: result = c.binPaths[0]
   else: result = ""
 
@@ -122,6 +124,7 @@ proc skipRoot(f: string): string =
 include "inno.tmpl"
 include "nsis.tmpl"
 include "buildsh.tmpl"
+include "makefile.tmpl"
 include "buildbat.tmpl"
 include "install.tmpl"
 include "deinstall.tmpl"
@@ -132,7 +135,7 @@ const
   Version = "1.0"
   Usage = "niminst - Nim Installation Generator Version " & Version & """
 
-  (c) 2014 Andreas Rumpf
+  (c) 2015 Andreas Rumpf
 Usage:
   niminst [options] command[;command2...] ini-file[.ini] [compile_options]
 Command:
@@ -144,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
@@ -151,7 +156,7 @@ Compile_options:
   will be passed to the Nim compiler
 """
 
-proc parseCmdLine(c: var TConfigData) =
+proc parseCmdLine(c: var ConfigData) =
   var p = initOptParser()
   while true:
     next(p)
@@ -183,6 +188,7 @@ proc parseCmdLine(c: var TConfigData) =
         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")
@@ -190,6 +196,7 @@ proc parseCmdLine(c: var TConfigData) =
       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):
@@ -209,19 +216,19 @@ proc addFiles(s: var seq[string], patterns: seq[string]) =
         inc(i)
       if i == 0: echo("[Warning] No file found that matches: " & p)
 
-proc pathFlags(p: var TCfgParser, k, v: string,
+proc pathFlags(p: var CfgParser, k, v: string,
                t: var tuple[path, flags: string]) =
   case normalize(k)
   of "path": t.path = v
   of "flags": t.flags = v
   else: quit(errorStr(p, "unknown variable: " & k))
 
-proc filesOnly(p: var TCfgParser, k, v: string, dest: var seq[string]) =
+proc filesOnly(p: var CfgParser, k, v: string, dest: var seq[string]) =
   case normalize(k)
   of "files": addFiles(dest, split(v, {';'}))
   else: quit(errorStr(p, "unknown variable: " & k))
 
-proc yesno(p: var TCfgParser, v: string): bool =
+proc yesno(p: var CfgParser, v: string): bool =
   case normalize(v)
   of "yes", "y", "on", "true":
     result = true
@@ -235,7 +242,7 @@ proc incl(s: var seq[string], x: string): int =
   s.add(x)
   result = s.len-1 
 
-proc platforms(c: var TConfigData, v: string) =
+proc platforms(c: var ConfigData, v: string) =
   for line in splitLines(v):
     let p = line.find(": ")
     if p <= 1: continue
@@ -246,9 +253,9 @@ proc platforms(c: var TConfigData, v: string) =
       let cpuIdx = c.cpus.incl(cpu)
       c.platforms[c.oses.len][cpuIdx+1] = true
 
-proc parseIniFile(c: var TConfigData) =
+proc parseIniFile(c: var ConfigData) =
   var
-    p: TCfgParser
+    p: CfgParser
     section = ""
     hasCpuOs = false
   var input = newFileStream(c.infile, fmRead)
@@ -358,15 +365,15 @@ proc parseIniFile(c: var TConfigData) =
       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)
 
 # ------------------------- generate source based installation ---------------
 
-proc readCFiles(c: var TConfigData, osA, cpuA: int) =
-  var p: TCfgParser
+proc readCFiles(c: var ConfigData, osA, cpuA: int) =
+  var p: CfgParser
   var f = splitFile(c.infile).dir / "mapping.txt"
   c.cfiles[osA][cpuA] = @[]
   var input = newFileStream(f, fmRead)
@@ -402,11 +409,11 @@ proc readCFiles(c: var TConfigData, osA, cpuA: int) =
 proc buildDir(os, cpu: int): string =
   return "c_code" / ($os & "_" & $cpu)
 
-proc getOutputDir(c: var TConfigData): string =
+proc getOutputDir(c: var ConfigData): string =
   if c.outdir.len > 0: c.outdir else: "build"
 
 proc writeFile(filename, content, newline: string) =
-  var f: TFile
+  var f: File
   if open(f, filename, fmWrite):
     for x in splitLines(content):
       write(f, x)
@@ -415,7 +422,7 @@ proc writeFile(filename, content, newline: string) =
   else:
     quit("Cannot open for writing: " & filename)
 
-proc removeDuplicateFiles(c: var TConfigData) =
+proc removeDuplicateFiles(c: var ConfigData) =
   for osA in countdown(c.oses.len, 1):
     for cpuA in countdown(c.cpus.len, 1):
       if c.cfiles[osA][cpuA].isNil: c.cfiles[osA][cpuA] = @[]
@@ -433,13 +440,15 @@ proc removeDuplicateFiles(c: var TConfigData) =
                 removeFile(dup)
                 c.cfiles[osA][cpuA][i] = orig
 
-proc writeInstallScripts(c: var TConfigData) =
+proc writeInstallScripts(c: var ConfigData) =
   if c.installScript:
     writeFile(installShFile, generateInstallScript(c), "\10")
+    inclFilePermissions(installShFile, {fpUserExec, fpGroupExec, fpOthersExec})
   if c.uninstallScript:
     writeFile(deinstallShFile, generateDeinstallScript(c), "\10")
+    inclFilePermissions(deinstallShFile, {fpUserExec, fpGroupExec, fpOthersExec})
 
-proc srcdist(c: var TConfigData) =
+proc srcdist(c: var ConfigData) =
   if not existsDir(getOutputDir(c) / "c_code"):
     createDir(getOutputDir(c) / "c_code")
   for x in walkFiles(c.libpath / "lib/*.h"):
@@ -462,8 +471,7 @@ proc srcdist(c: var TConfigData) =
       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")
@@ -476,6 +484,8 @@ proc srcdist(c: var TConfigData) =
   # second pass: remove duplicate files
   removeDuplicateFiles(c)
   writeFile(getOutputDir(c) / buildShFile, generateBuildShellScript(c), "\10")
+  inclFilePermissions(getOutputDir(c) / buildShFile, {fpUserExec, fpGroupExec, fpOthersExec})
+  writeFile(getOutputDir(c) / makeFile, generateMakefile(c), "\10")
   if winIndex >= 0:
     if intel32Index >= 0:
       writeFile(getOutputDir(c) / buildBatFile32,
@@ -486,7 +496,7 @@ proc srcdist(c: var TConfigData) =
   writeInstallScripts(c)
 
 # --------------------- generate inno setup -----------------------------------
-proc setupDist(c: var TConfigData) =
+proc setupDist(c: var ConfigData) =
   let scrpt = generateInnoSetup(c)
   let n = "build" / "install_$#_$#.iss" % [toLower(c.name), c.version]
   writeFile(n, scrpt, "\13\10")
@@ -503,7 +513,7 @@ proc setupDist(c: var TConfigData) =
       quit("External program failed")
 
 # --------------------- generate NSIS setup -----------------------------------
-proc setupDist2(c: var TConfigData) =
+proc setupDist2(c: var ConfigData) =
   let scrpt = generateNsisSetup(c)
   let n = "build" / "install_$#_$#.nsi" % [toLower(c.name), c.version]
   writeFile(n, scrpt, "\13\10")
@@ -521,9 +531,9 @@ proc setupDist2(c: var TConfigData) =
 
 # ------------------ generate ZIP file ---------------------------------------
 when haveZipLib:
-  proc zipDist(c: var TConfigData) =
-    var proj = toLower(c.name)
-    var n = "$#_$#.zip" % [proj, c.version]
+  proc zipDist(c: var ConfigData) =
+    var proj = toLower(c.name) & "-" & c.version
+    var n = "$#.zip" % proj
     if c.outdir.len == 0: n = "build" / n
     else: n = c.outdir / n
     var z: TZipArchive
@@ -531,6 +541,7 @@ when haveZipLib:
       addFile(z, proj / buildBatFile32, "build" / buildBatFile32)
       addFile(z, proj / buildBatFile64, "build" / buildBatFile64)
       addFile(z, proj / buildShFile, "build" / buildShFile)
+      addFile(z, proj / makeFile, "build" / makeFile)
       addFile(z, proj / installShFile, installShFile)
       addFile(z, proj / deinstallShFile, deinstallShFile)
       for f in walkFiles(c.libpath / "lib/*.h"):
@@ -549,7 +560,7 @@ when haveZipLib:
 
 # -- prepare build files for .deb creation
 
-proc debDist(c: var TConfigData) =
+proc debDist(c: var ConfigData) =
   if not existsFile(getOutputDir(c) / "build.sh"): quit("No build.sh found.")
   if not existsFile(getOutputDir(c) / "install.sh"): quit("No install.sh found.")
   
@@ -571,6 +582,7 @@ proc debDist(c: var TConfigData) =
   
   # Don't copy all files, only the ones specified in the config:
   copyNimDist(buildShFile, buildShFile)
+  copyNimDist(makeFile, makeFile)
   copyNimDist(installShFile, installShFile)
   createDir(workingDir / upstreamSource / "build")
   for f in walkFiles(c.libpath / "lib/*.h"):
@@ -595,8 +607,8 @@ proc debDist(c: var TConfigData) =
 
 # ------------------- main ----------------------------------------------------
 
-var c: TConfigData
-initConfigData(c)
+var c: ConfigData
+iniConfigData(c)
 parseCmdLine(c)
 parseIniFile(c)
 if actionInno in c.actions:
diff --git a/tools/niminst/nsis.tmpl b/tools/niminst/nsis.tmpl
index 40e171d41..c21bfb9d5 100644
--- a/tools/niminst/nsis.tmpl
+++ b/tools/niminst/nsis.tmpl
@@ -1,5 +1,5 @@
 #! stdtmpl(subsChar='?') | standard
-#proc generateNsisSetup(c: TConfigData): string = 
+#proc generateNsisSetup(c: ConfigData): string = 
 #  result = "; NSIS script generated by niminst\n" &
 #           "; To regenerate run ``niminst nsis`` or ``koch nsis``\n"
 
@@ -50,8 +50,8 @@
   SetCompressor /SOLID /FINAL lzma
 
   ; Installer and Uninstaller Icons
-  ; Icon "nimrod.ico"
-  ; UninstallIcon "nimrod.ico"
+  ; Icon "nim.ico"
+  ; UninstallIcon "nim.ico"
 
   ; Set installation details to be shown by default
   ShowInstDetails show
@@ -113,7 +113,7 @@
     SetOverwrite ifnewer
 
     ; Write all the files to the output directory.
-    #for i in low(TFileCategory)..fcWindows:
+    #for i in low(FileCategory)..fcWindows:
     #  for f in items(c.cat[i]):
          SetOutPath "$INSTDIR\?{splitFile(f).dir.toWin}"
          File "?{expandFilename(f).toWin}"
@@ -128,7 +128,7 @@
     ; Write application registry keys
     WriteRegStr HKCU "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\bin\?{c.name}.exe"
     WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
-    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
+    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe"
     WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\?{c.name}.exe"
     WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
     WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"