diff options
author | Araq <rumpf_a@web.de> | 2013-10-06 16:41:56 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-10-06 16:41:56 +0200 |
commit | eaf4da0411a17d0c22e071986c043ec3924e7b8a (patch) | |
tree | f992b9b282f051d3e3e696550ea12c602a89ef12 /tools/niminst | |
parent | 27215e89f92e039afa166bd8c2c76047595d3f85 (diff) | |
download | Nim-eaf4da0411a17d0c22e071986c043ec3924e7b8a.tar.gz |
niminst: slashify was a stupid idea
Diffstat (limited to 'tools/niminst')
-rw-r--r-- | tools/niminst/buildbat.tmpl | 8 | ||||
-rw-r--r-- | tools/niminst/buildsh.tmpl | 8 | ||||
-rw-r--r-- | tools/niminst/deinstall.tmpl | 4 | ||||
-rw-r--r-- | tools/niminst/inno.tmpl | 6 | ||||
-rw-r--r-- | tools/niminst/install.tmpl | 28 | ||||
-rw-r--r-- | tools/niminst/niminst.nim | 14 |
6 files changed, 34 insertions, 34 deletions
diff --git a/tools/niminst/buildbat.tmpl b/tools/niminst/buildbat.tmpl index f7ccbcbfa..36e1a3e79 100644 --- a/tools/niminst/buildbat.tmpl +++ b/tools/niminst/buildbat.tmpl @@ -5,7 +5,7 @@ SET CC=gcc SET LINKER=gcc SET COMP_FLAGS=?{c.ccompiler.flags} SET LINK_FLAGS=?{c.linker.flags} -SET BIN_DIR=?{firstBinPath(c).slashify} +SET BIN_DIR=?{firstBinPath(c).toWin} if EXIST ..\koch.nim SET BIN_DIR=..\bin @@ -16,9 +16,9 @@ REM call the compiler: # block win32: # var linkCmd = "" # for ff in items(c.cfiles[winIndex][cpuIndex]): -# let f = ff.slashify -ECHO %CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")} -%CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")} +# let f = ff.toWin +ECHO %CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} +%CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} # linkCmd.add(" " & changeFileExt(f, "o")) # end for diff --git a/tools/niminst/buildsh.tmpl b/tools/niminst/buildsh.tmpl index 244d73710..912e87d29 100644 --- a/tools/niminst/buildsh.tmpl +++ b/tools/niminst/buildsh.tmpl @@ -35,7 +35,7 @@ LINK_FLAGS="?{c.linker.flags}" ucpu=`uname -m` uos=`uname` # add(result, "# bin dir detection\n") -binDir=?{firstBinPath(c).slashify} +binDir=?{firstBinPath(c).toUnix} if [ -s ../koch.nim ]; then binDir="../bin" @@ -127,9 +127,9 @@ case $myos in ?{c.cpus[cpuA-1]}) # var linkCmd = "" # for ff in items(c.cfiles[osA][cpuA]): -# let f = ff.slashify - echo "$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}" - $CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")} +# let f = ff.toUnix + echo "$CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}" + $CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")} # add(linkCmd, " \\\n" & changeFileExt(f, "o")) # end for echo "$LINKER -o ?{"$binDir"/toLower(c.name)} ?linkCmd $LINK_FLAGS" diff --git a/tools/niminst/deinstall.tmpl b/tools/niminst/deinstall.tmpl index c961ac07a..d9abf9228 100644 --- a/tools/niminst/deinstall.tmpl +++ b/tools/niminst/deinstall.tmpl @@ -40,11 +40,11 @@ if [ $# -eq 1 ] ; then echo "removing files..." #for ff in items(c.cat[fcUnixBin]): - #let f = ff.slashify + #let f = ff.toUnix rm -f $bindir/?f.skipRoot #end for #for ff in items(c.cat[fcConfig]): - #let f = ff.slashify + #let f = ff.toUnix rm -f $configdir/?f.skipRoot #end for rm -rf $docdir diff --git a/tools/niminst/inno.tmpl b/tools/niminst/inno.tmpl index 0219dea1f..40edcc790 100644 --- a/tools/niminst/inno.tmpl +++ b/tools/niminst/inno.tmpl @@ -21,7 +21,7 @@ Name: english; MessagesFile: compiler:Default.isl [Files] #for i in low(TFileCategory)..fcWindows: # for f in items(c.cat[i]): -Source: ${expandFilename(f).slashify}; DestDir: {app}\${splitFile(f).dir.slashify}; Flags: ignoreversion +Source: ${expandFilename(f).toWin}; DestDir: {app}\${splitFile(f).dir.toWin}; Flags: ignoreversion # end for #end for @@ -32,7 +32,7 @@ Name: {group}\Console for $c.displayName; Filename: {cmd} Name: {group}\$c.displayName; Filename: {app}\${c.name}.exe #end if #for f in items(c.cat[fcDocStart]): -Name: {group}\Documentation; Filename: {app}\${f.slashify} +Name: {group}\Documentation; Filename: {app}\${f.toWin} #end for Name: {group}\{cm:UninstallProgram,$c.displayName}; Filename: {uninstallexe} @@ -65,7 +65,7 @@ begin setArrayLength(result, $c.binPaths.len); #var i = 0 #for b in items(c.binPaths): - result[$i] := ExpandConstant('{app}') + '\${b.slashify}'; + result[$i] := ExpandConstant('{app}') + '\${b.toWin}'; #inc(i) #end for end; diff --git a/tools/niminst/install.tmpl b/tools/niminst/install.tmpl index 3eb07b8af..fa61eea5e 100644 --- a/tools/niminst/install.tmpl +++ b/tools/niminst/install.tmpl @@ -7,7 +7,7 @@ set -e if [ $# -eq 1 ] ; then # if c.cat[fcUnixBin].len > 0: - if test -f ?{c.cat[fcUnixBin][0].slashify} + if test -f ?{c.cat[fcUnixBin][0].toUnix} then echo "?c.displayName build detected" else @@ -65,35 +65,35 @@ if [ $# -eq 1 ] ; then # mk = unixDirVars[cat] & "/" & mk # if not createdDirs.hasKey(mk): # createdDirs[mk] = "true" - mkdir -p ?{mk.slashify} + mkdir -p ?{mk.toUnix} # end if # end if # end for #end for #for f in items(c.cat[fcUnixBin]): - cp ?f.slashify $bindir/?f.skipRoot.slashify - chmod 755 $bindir/?f.skipRoot.slashify + cp ?f.toUnix $bindir/?f.skipRoot.toUnix + chmod 755 $bindir/?f.skipRoot.toUnix #end for #for f in items(c.cat[fcConfig]): - cp ?f.slashify $configdir/?f.skipRoot.slashify - chmod 644 $configdir/?f.skipRoot.slashify + cp ?f.toUnix $configdir/?f.skipRoot.toUnix + chmod 644 $configdir/?f.skipRoot.toUnix #end for #for f in items(c.cat[fcData]): - if [ -f ?f.slashify ]; then - cp ?f.slashify $datadir/?f.skipRoot.slashify - chmod 644 $datadir/?f.skipRoot.slashify + if [ -f ?f.toUnix ]; then + cp ?f.toUnix $datadir/?f.skipRoot.toUnix + chmod 644 $datadir/?f.skipRoot.toUnix fi #end for #for f in items(c.cat[fcDoc]): - if [ -f ?f.slashify ]; then - cp ?f.slashify $docdir/?f.skipRoot.slashify - chmod 644 $docdir/?f.skipRoot.slashify + if [ -f ?f.toUnix ]; then + cp ?f.toUnix $docdir/?f.skipRoot.toUnix + chmod 644 $docdir/?f.skipRoot.toUnix fi #end for #for f in items(c.cat[fcLib]): - cp ?f.slashify $libdir/?f.skipRoot.slashify - chmod 644 $libdir/?f.skipRoot.slashify + cp ?f.toUnix $libdir/?f.skipRoot.toUnix + chmod 644 $libdir/?f.skipRoot.toUnix #end for echo "installation successful" diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index e93a895e5..25ec0d283 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -104,8 +104,8 @@ proc firstBinPath(c: TConfigData): string = proc `\`(a, b: string): string = result = if a.len == 0: b else: a & '\\' & b -proc slashify(s: string): string = - when defined(unix): s.replace('\\', '/') else: s.replace('/', '\\') +template toUnix(s: string): string = s.replace('\\', '/') +template toWin(s: string): string = s.replace('/', '\\') proc skipRoot(f: string): string = # "abc/def/xyz" --> "def/xyz" @@ -392,7 +392,7 @@ proc readCFiles(c: var TConfigData, osA, cpuA: int) = quit("Cannot open: " & f) proc buildDir(os, cpu: int): string = - return "src" / ($os & "_" & $cpu) + return "nimcache" / ($os & "_" & $cpu) proc getOutputDir(c: var TConfigData): string = if c.outdir.len > 0: c.outdir else: "build" @@ -432,11 +432,11 @@ proc writeInstallScripts(c: var TConfigData) = writeFile(deinstallShFile, generateDeinstallScript(c), "\10") proc srcdist(c: var TConfigData) = - if not existsDir(getOutputDir(c) / "src"): - createDir(getOutputDir(c) / "src") + if not existsDir(getOutputDir(c) / "nimcache"): + createDir(getOutputDir(c) / "nimcache") for x in walkFiles(c.libpath / "lib/*.h"): - echo(getOutputDir(c) / "src" / extractFilename(x)) - copyFile(dest=getOutputDir(c) / "src" / extractFilename(x), source=x) + echo(getOutputDir(c) / "nimcache" / extractFilename(x)) + copyFile(dest=getOutputDir(c) / "nimcache" / extractFilename(x), source=x) var winIndex = -1 var intel32Index = -1 var intel64Index = -1 |