diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2010-07-29 21:30:04 +0200 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2010-07-29 21:30:04 +0200 |
commit | ff02ce2d50d8a4b445f9fba6076527c3db62425c (patch) | |
tree | 065d5ecddb38f871e516b49c333f565b6cba9b31 /tools | |
parent | 804e2ac89d378b87e0ec8c723f607aa4271c57bb (diff) | |
download | Nim-ff02ce2d50d8a4b445f9fba6076527c3db62425c.tar.gz |
handling of compiler procs improved for DLL generation
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/buildsh.tmpl (renamed from tools/build.tmpl) | 10 | ||||
-rwxr-xr-x | tools/niminst.nim | 44 |
2 files changed, 34 insertions, 20 deletions
diff --git a/tools/build.tmpl b/tools/buildsh.tmpl index 5ba3ca755..c1aa4ba21 100755 --- a/tools/build.tmpl +++ b/tools/buildsh.tmpl @@ -1,5 +1,5 @@ #! stdtmpl(subsChar='?') | standard -#proc GenerateBuildScript(c: TConfigData): string = +#proc GenerateBuildShellScript(c: TConfigData): string = # result = "#! /bin/sh\n# Generated by niminst\n" CC="gcc" LINKER="gcc" @@ -83,8 +83,16 @@ case $myos in $LINKER $LINK_FLAGS -o ?{c.binPaths[0]}/?{toLower(c.name)} ?linkCmd || exit 1 ;; # end for + *) + echo "Error: no C code generated for: [$myos: $mycpu]" + exit 1 + ;; esac ;; +*) + echo "Error: no C code generated for: [$myos: $mycpu]" + exit 1 + ;; # end for esac diff --git a/tools/niminst.nim b/tools/niminst.nim index 2a5b18c38..a93ea2ef8 100755 --- a/tools/niminst.nim +++ b/tools/niminst.nim @@ -1,7 +1,7 @@ # # # The Nimrod Installation Generator -# (c) Copyright 2009 Andreas Rumpf +# (c) Copyright 2010 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -20,6 +20,7 @@ const maxOS = 20 # max number of OSes maxCPU = 10 # max number of CPUs buildShFile = "build.sh" + buildBatFile = "build.bat" installShFile = "install.sh" deinstallShFile = "deinstall.sh" @@ -89,17 +90,18 @@ proc skipRoot(f: string): string = if result.len == 0: result = f include "inno.tmpl" -include "build.tmpl" +include "buildsh.tmpl" +include "buildbat.tmpl" include "install.tmpl" include "deinstall.tmpl" # ------------------------- configuration file ------------------------------- const - Version = "0.7" + Version = "0.8" Usage = "niminst - Nimrod Installation Generator Version " & version & """ - (c) 2009 Andreas Rumpf + (c) 2010 Andreas Rumpf Usage: niminst [options] command[;command2...] ini-file[.ini] [compile_options] Command: @@ -289,6 +291,22 @@ proc writeFile(filename, content, newline: string) = else: quit("Cannot open for writing: " & filename) +proc removeDuplicateFiles(c: var TConfigData) = + for osA in countdown(c.oses.len, 1): + for cpuA in countdown(c.cpus.len, 1): + for i in 0..c.cfiles[osA][cpuA].len-1: + var dup = c.cfiles[osA][cpuA][i] + var f = extractFilename(dup) + for osB in 1..c.oses.len: + for cpuB in 1..c.cpus.len: + if osB != osA or cpuB != cpuA: + var orig = buildDir(osB, cpuB) / f + if ExistsFile(orig) and ExistsFile(dup) and + sameFileContent(orig, dup): + # file is identical, so delete duplicate: + RemoveFile(dup) + c.cfiles[osA][cpuA][i] = orig + proc srcdist(c: var TConfigData) = for x in walkFiles("lib/*.h"): CopyFile(dest="build" / extractFilename(x), source=x) @@ -311,21 +329,9 @@ proc srcdist(c: var TConfigData) = CopyFile(dest=dest, source=c.cfiles[osA][cpuA][i]) c.cfiles[osA][cpuA][i] = dest # second pass: remove duplicate files - for osA in countdown(c.oses.len, 1): - for cpuA in countdown(c.cpus.len, 1): - for i in 0..c.cfiles[osA][cpuA].len-1: - var dup = c.cfiles[osA][cpuA][i] - var f = extractFilename(dup) - for osB in 1..c.oses.len: - for cpuB in 1..c.cpus.len: - if osB != osA or cpuB != cpuA: - var orig = buildDir(osB, cpuB) / f - if ExistsFile(orig) and ExistsFile(dup) and - sameFileContent(orig, dup): - # file is identical, so delete duplicate: - RemoveFile(dup) - c.cfiles[osA][cpuA][i] = orig - writeFile(buildShFile, GenerateBuildScript(c), "\10") + removeDuplicateFiles(c) + writeFile(buildShFile, GenerateBuildShellScript(c), "\10") + writeFile(buildBatFile, GenerateBuildBatchScript(c), "\13\10") if c.installScript: writeFile(installShFile, GenerateInstallScript(c), "\10") if c.uninstallScript: |