mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 10:52:14 +00:00
niminst: slashify was a stupid idea
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user