niminst: slashify was a stupid idea
This commit is contained in:
parent
27215e89f9
commit
eaf4da0411
6 changed files with 34 additions and 34 deletions
|
|
@ -5,7 +5,7 @@ SET CC=gcc
|
||||||
SET LINKER=gcc
|
SET LINKER=gcc
|
||||||
SET COMP_FLAGS=?{c.ccompiler.flags}
|
SET COMP_FLAGS=?{c.ccompiler.flags}
|
||||||
SET LINK_FLAGS=?{c.linker.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
|
if EXIST ..\koch.nim SET BIN_DIR=..\bin
|
||||||
|
|
||||||
|
|
@ -16,9 +16,9 @@ REM call the compiler:
|
||||||
# block win32:
|
# block win32:
|
||||||
# var linkCmd = ""
|
# var linkCmd = ""
|
||||||
# for ff in items(c.cfiles[winIndex][cpuIndex]):
|
# for ff in items(c.cfiles[winIndex][cpuIndex]):
|
||||||
# let f = ff.slashify
|
# let f = ff.toWin
|
||||||
ECHO %CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
ECHO %CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
%CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
%CC% %COMP_FLAGS% -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
# linkCmd.add(" " & changeFileExt(f, "o"))
|
# linkCmd.add(" " & changeFileExt(f, "o"))
|
||||||
# end for
|
# end for
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ LINK_FLAGS="?{c.linker.flags}"
|
||||||
ucpu=`uname -m`
|
ucpu=`uname -m`
|
||||||
uos=`uname`
|
uos=`uname`
|
||||||
# add(result, "# bin dir detection\n")
|
# add(result, "# bin dir detection\n")
|
||||||
binDir=?{firstBinPath(c).slashify}
|
binDir=?{firstBinPath(c).toUnix}
|
||||||
|
|
||||||
if [ -s ../koch.nim ]; then
|
if [ -s ../koch.nim ]; then
|
||||||
binDir="../bin"
|
binDir="../bin"
|
||||||
|
|
@ -127,9 +127,9 @@ case $myos in
|
||||||
?{c.cpus[cpuA-1]})
|
?{c.cpus[cpuA-1]})
|
||||||
# var linkCmd = ""
|
# var linkCmd = ""
|
||||||
# for ff in items(c.cfiles[osA][cpuA]):
|
# for ff in items(c.cfiles[osA][cpuA]):
|
||||||
# let f = ff.slashify
|
# let f = ff.toUnix
|
||||||
echo "$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}"
|
echo "$CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}"
|
||||||
$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
$CC $COMP_FLAGS -Inimcache -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
||||||
# end for
|
# end for
|
||||||
echo "$LINKER -o ?{"$binDir"/toLower(c.name)} ?linkCmd $LINK_FLAGS"
|
echo "$LINKER -o ?{"$binDir"/toLower(c.name)} ?linkCmd $LINK_FLAGS"
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ if [ $# -eq 1 ] ; then
|
||||||
echo "removing files..."
|
echo "removing files..."
|
||||||
|
|
||||||
#for ff in items(c.cat[fcUnixBin]):
|
#for ff in items(c.cat[fcUnixBin]):
|
||||||
#let f = ff.slashify
|
#let f = ff.toUnix
|
||||||
rm -f $bindir/?f.skipRoot
|
rm -f $bindir/?f.skipRoot
|
||||||
#end for
|
#end for
|
||||||
#for ff in items(c.cat[fcConfig]):
|
#for ff in items(c.cat[fcConfig]):
|
||||||
#let f = ff.slashify
|
#let f = ff.toUnix
|
||||||
rm -f $configdir/?f.skipRoot
|
rm -f $configdir/?f.skipRoot
|
||||||
#end for
|
#end for
|
||||||
rm -rf $docdir
|
rm -rf $docdir
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Name: english; MessagesFile: compiler:Default.isl
|
||||||
[Files]
|
[Files]
|
||||||
#for i in low(TFileCategory)..fcWindows:
|
#for i in low(TFileCategory)..fcWindows:
|
||||||
# for f in items(c.cat[i]):
|
# 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
|
||||||
#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
|
Name: {group}\$c.displayName; Filename: {app}\${c.name}.exe
|
||||||
#end if
|
#end if
|
||||||
#for f in items(c.cat[fcDocStart]):
|
#for f in items(c.cat[fcDocStart]):
|
||||||
Name: {group}\Documentation; Filename: {app}\${f.slashify}
|
Name: {group}\Documentation; Filename: {app}\${f.toWin}
|
||||||
#end for
|
#end for
|
||||||
Name: {group}\{cm:UninstallProgram,$c.displayName}; Filename: {uninstallexe}
|
Name: {group}\{cm:UninstallProgram,$c.displayName}; Filename: {uninstallexe}
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ begin
|
||||||
setArrayLength(result, $c.binPaths.len);
|
setArrayLength(result, $c.binPaths.len);
|
||||||
#var i = 0
|
#var i = 0
|
||||||
#for b in items(c.binPaths):
|
#for b in items(c.binPaths):
|
||||||
result[$i] := ExpandConstant('{app}') + '\${b.slashify}';
|
result[$i] := ExpandConstant('{app}') + '\${b.toWin}';
|
||||||
#inc(i)
|
#inc(i)
|
||||||
#end for
|
#end for
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set -e
|
||||||
|
|
||||||
if [ $# -eq 1 ] ; then
|
if [ $# -eq 1 ] ; then
|
||||||
# if c.cat[fcUnixBin].len > 0:
|
# if c.cat[fcUnixBin].len > 0:
|
||||||
if test -f ?{c.cat[fcUnixBin][0].slashify}
|
if test -f ?{c.cat[fcUnixBin][0].toUnix}
|
||||||
then
|
then
|
||||||
echo "?c.displayName build detected"
|
echo "?c.displayName build detected"
|
||||||
else
|
else
|
||||||
|
|
@ -65,35 +65,35 @@ if [ $# -eq 1 ] ; then
|
||||||
# mk = unixDirVars[cat] & "/" & mk
|
# mk = unixDirVars[cat] & "/" & mk
|
||||||
# if not createdDirs.hasKey(mk):
|
# if not createdDirs.hasKey(mk):
|
||||||
# createdDirs[mk] = "true"
|
# createdDirs[mk] = "true"
|
||||||
mkdir -p ?{mk.slashify}
|
mkdir -p ?{mk.toUnix}
|
||||||
# end if
|
# end if
|
||||||
# end if
|
# end if
|
||||||
# end for
|
# end for
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
#for f in items(c.cat[fcUnixBin]):
|
#for f in items(c.cat[fcUnixBin]):
|
||||||
cp ?f.slashify $bindir/?f.skipRoot.slashify
|
cp ?f.toUnix $bindir/?f.skipRoot.toUnix
|
||||||
chmod 755 $bindir/?f.skipRoot.slashify
|
chmod 755 $bindir/?f.skipRoot.toUnix
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcConfig]):
|
#for f in items(c.cat[fcConfig]):
|
||||||
cp ?f.slashify $configdir/?f.skipRoot.slashify
|
cp ?f.toUnix $configdir/?f.skipRoot.toUnix
|
||||||
chmod 644 $configdir/?f.skipRoot.slashify
|
chmod 644 $configdir/?f.skipRoot.toUnix
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcData]):
|
#for f in items(c.cat[fcData]):
|
||||||
if [ -f ?f.slashify ]; then
|
if [ -f ?f.toUnix ]; then
|
||||||
cp ?f.slashify $datadir/?f.skipRoot.slashify
|
cp ?f.toUnix $datadir/?f.skipRoot.toUnix
|
||||||
chmod 644 $datadir/?f.skipRoot.slashify
|
chmod 644 $datadir/?f.skipRoot.toUnix
|
||||||
fi
|
fi
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcDoc]):
|
#for f in items(c.cat[fcDoc]):
|
||||||
if [ -f ?f.slashify ]; then
|
if [ -f ?f.toUnix ]; then
|
||||||
cp ?f.slashify $docdir/?f.skipRoot.slashify
|
cp ?f.toUnix $docdir/?f.skipRoot.toUnix
|
||||||
chmod 644 $docdir/?f.skipRoot.slashify
|
chmod 644 $docdir/?f.skipRoot.toUnix
|
||||||
fi
|
fi
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcLib]):
|
#for f in items(c.cat[fcLib]):
|
||||||
cp ?f.slashify $libdir/?f.skipRoot.slashify
|
cp ?f.toUnix $libdir/?f.skipRoot.toUnix
|
||||||
chmod 644 $libdir/?f.skipRoot.slashify
|
chmod 644 $libdir/?f.skipRoot.toUnix
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
echo "installation successful"
|
echo "installation successful"
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ proc firstBinPath(c: TConfigData): string =
|
||||||
proc `\`(a, b: string): string =
|
proc `\`(a, b: string): string =
|
||||||
result = if a.len == 0: b else: a & '\\' & b
|
result = if a.len == 0: b else: a & '\\' & b
|
||||||
|
|
||||||
proc slashify(s: string): string =
|
template toUnix(s: string): string = s.replace('\\', '/')
|
||||||
when defined(unix): s.replace('\\', '/') else: s.replace('/', '\\')
|
template toWin(s: string): string = s.replace('/', '\\')
|
||||||
|
|
||||||
proc skipRoot(f: string): string =
|
proc skipRoot(f: string): string =
|
||||||
# "abc/def/xyz" --> "def/xyz"
|
# "abc/def/xyz" --> "def/xyz"
|
||||||
|
|
@ -392,7 +392,7 @@ proc readCFiles(c: var TConfigData, osA, cpuA: int) =
|
||||||
quit("Cannot open: " & f)
|
quit("Cannot open: " & f)
|
||||||
|
|
||||||
proc buildDir(os, cpu: int): string =
|
proc buildDir(os, cpu: int): string =
|
||||||
return "src" / ($os & "_" & $cpu)
|
return "nimcache" / ($os & "_" & $cpu)
|
||||||
|
|
||||||
proc getOutputDir(c: var TConfigData): string =
|
proc getOutputDir(c: var TConfigData): string =
|
||||||
if c.outdir.len > 0: c.outdir else: "build"
|
if c.outdir.len > 0: c.outdir else: "build"
|
||||||
|
|
@ -432,11 +432,11 @@ proc writeInstallScripts(c: var TConfigData) =
|
||||||
writeFile(deinstallShFile, generateDeinstallScript(c), "\10")
|
writeFile(deinstallShFile, generateDeinstallScript(c), "\10")
|
||||||
|
|
||||||
proc srcdist(c: var TConfigData) =
|
proc srcdist(c: var TConfigData) =
|
||||||
if not existsDir(getOutputDir(c) / "src"):
|
if not existsDir(getOutputDir(c) / "nimcache"):
|
||||||
createDir(getOutputDir(c) / "src")
|
createDir(getOutputDir(c) / "nimcache")
|
||||||
for x in walkFiles(c.libpath / "lib/*.h"):
|
for x in walkFiles(c.libpath / "lib/*.h"):
|
||||||
echo(getOutputDir(c) / "src" / extractFilename(x))
|
echo(getOutputDir(c) / "nimcache" / extractFilename(x))
|
||||||
copyFile(dest=getOutputDir(c) / "src" / extractFilename(x), source=x)
|
copyFile(dest=getOutputDir(c) / "nimcache" / extractFilename(x), source=x)
|
||||||
var winIndex = -1
|
var winIndex = -1
|
||||||
var intel32Index = -1
|
var intel32Index = -1
|
||||||
var intel64Index = -1
|
var intel64Index = -1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue