fixes #582
This commit is contained in:
parent
0464a1071e
commit
8087f51d14
8 changed files with 48 additions and 30 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
[Project]
|
[Project]
|
||||||
Name: "Nimrod"
|
Name: "Nimrod"
|
||||||
Version: "$version"
|
Version: "$version"
|
||||||
; Windows and i386 must be first!
|
|
||||||
OS: "windows;linux;macosx;solaris;freebsd;netbsd;openbsd"
|
OS: "windows;linux;macosx;solaris;freebsd;netbsd;openbsd"
|
||||||
CPU: "i386;amd64;powerpc64;arm" # ;sparc
|
CPU: "i386;amd64;powerpc64;arm" # ;sparc
|
||||||
Authors: "Andreas Rumpf"
|
Authors: "Andreas Rumpf"
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -22,6 +22,7 @@ version 0.9.4
|
||||||
Bugs
|
Bugs
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- compilation of niminst takes way too long. looks like a regression
|
||||||
- simple closure iterator doesn't work
|
- simple closure iterator doesn't work
|
||||||
- docgen: sometimes effects are listed twice
|
- docgen: sometimes effects are listed twice
|
||||||
- 'result' is not properly cleaned for NRVO --> use uninit checking instead
|
- 'result' is not properly cleaned for NRVO --> use uninit checking instead
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#! stdtmpl(subsChar='?') | standard
|
#! stdtmpl(subsChar='?') | standard
|
||||||
#proc GenerateBuildBatchScript(c: TConfigData, target: TTarget): string =
|
#proc GenerateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string =
|
||||||
# result = "@echo off\nREM Generated by niminst\n"
|
# result = "@echo off\nREM Generated by niminst\n"
|
||||||
SET CC=gcc
|
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)}
|
SET BIN_DIR=?{firstBinPath(c).slashify}
|
||||||
|
|
||||||
if EXIST ..\koch.nim SET BIN_DIR=..\bin
|
if EXIST ..\koch.nim SET BIN_DIR=..\bin
|
||||||
|
|
||||||
|
|
@ -15,8 +15,8 @@ REM call the compiler:
|
||||||
|
|
||||||
# block win32:
|
# block win32:
|
||||||
# var linkCmd = ""
|
# var linkCmd = ""
|
||||||
# for ff in items(c.cfiles[1][ord(target)]):
|
# for ff in items(c.cfiles[winIndex][cpuIndex]):
|
||||||
# let f = ff.replace('/', '\\')
|
# let f = ff.slashify
|
||||||
ECHO %CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
ECHO %CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
%CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
%CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
# linkCmd.add(" " & changeFileExt(f, "o"))
|
# linkCmd.add(" " & changeFileExt(f, "o"))
|
||||||
|
|
|
||||||
|
|
@ -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)}
|
binDir=?{firstBinPath(c).slashify}
|
||||||
|
|
||||||
if [ -s ../koch.nim ]; then
|
if [ -s ../koch.nim ]; then
|
||||||
binDir="../bin"
|
binDir="../bin"
|
||||||
|
|
@ -126,7 +126,8 @@ case $myos in
|
||||||
# for cpuA in 1..c.cpus.len:
|
# for cpuA in 1..c.cpus.len:
|
||||||
?{c.cpus[cpuA-1]})
|
?{c.cpus[cpuA-1]})
|
||||||
# var linkCmd = ""
|
# var linkCmd = ""
|
||||||
# for f in items(c.cfiles[osA][cpuA]):
|
# for ff in items(c.cfiles[osA][cpuA]):
|
||||||
|
# let f = ff.slashify
|
||||||
echo "$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}"
|
echo "$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}"
|
||||||
$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
|
||||||
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,12 @@ if [ $# -eq 1 ] ; then
|
||||||
esac
|
esac
|
||||||
echo "removing files..."
|
echo "removing files..."
|
||||||
|
|
||||||
#for f in items(c.cat[fcUnixBin]):
|
#for ff in items(c.cat[fcUnixBin]):
|
||||||
|
#let f = ff.slashify
|
||||||
rm -f $bindir/?f.skipRoot
|
rm -f $bindir/?f.skipRoot
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcConfig]):
|
#for ff in items(c.cat[fcConfig]):
|
||||||
|
#let f = ff.slashify
|
||||||
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)}; DestDir: {app}\${splitFile(f).dir}; Flags: ignoreversion
|
Source: ${expandFilename(f).slashify}; DestDir: {app}\${splitFile(f).dir.slashify}; 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
|
Name: {group}\Documentation; Filename: {app}\${f.slashify}
|
||||||
#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';
|
result[$i] := ExpandConstant('{app}') + '\${b.slashify}';
|
||||||
#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]}
|
if test -f ?{c.cat[fcUnixBin][0].slashify}
|
||||||
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
|
mkdir -p ?{mk.slashify}
|
||||||
# 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 $bindir/?f.skipRoot
|
cp ?f.slashify $bindir/?f.skipRoot.slashify
|
||||||
chmod 755 $bindir/?f.skipRoot
|
chmod 755 $bindir/?f.skipRoot.slashify
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcConfig]):
|
#for f in items(c.cat[fcConfig]):
|
||||||
cp ?f $configdir/?f.skipRoot
|
cp ?f.slashify $configdir/?f.skipRoot.slashify
|
||||||
chmod 644 $configdir/?f.skipRoot
|
chmod 644 $configdir/?f.skipRoot.slashify
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcData]):
|
#for f in items(c.cat[fcData]):
|
||||||
if [ -f ?f ]; then
|
if [ -f ?f.slashify ]; then
|
||||||
cp ?f $datadir/?f.skipRoot
|
cp ?f.slashify $datadir/?f.skipRoot.slashify
|
||||||
chmod 644 $datadir/?f.skipRoot
|
chmod 644 $datadir/?f.skipRoot.slashify
|
||||||
fi
|
fi
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcDoc]):
|
#for f in items(c.cat[fcDoc]):
|
||||||
if [ -f ?f ]; then
|
if [ -f ?f.slashify ]; then
|
||||||
cp ?f $docdir/?f.skipRoot
|
cp ?f.slashify $docdir/?f.skipRoot.slashify
|
||||||
chmod 644 $docdir/?f.skipRoot
|
chmod 644 $docdir/?f.skipRoot.slashify
|
||||||
fi
|
fi
|
||||||
#end for
|
#end for
|
||||||
#for f in items(c.cat[fcLib]):
|
#for f in items(c.cat[fcLib]):
|
||||||
cp ?f $libdir/?f.skipRoot
|
cp ?f.slashify $libdir/?f.skipRoot.slashify
|
||||||
chmod 644 $libdir/?f.skipRoot
|
chmod 644 $libdir/?f.skipRoot.slashify
|
||||||
#end for
|
#end for
|
||||||
|
|
||||||
echo "installation successful"
|
echo "installation successful"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ const
|
||||||
|
|
||||||
type
|
type
|
||||||
TAppType = enum appConsole, appGUI
|
TAppType = enum appConsole, appGUI
|
||||||
TTarget = enum tWin32 = 1, tWin64 = 2
|
|
||||||
TAction = enum
|
TAction = enum
|
||||||
actionNone, # action not yet known
|
actionNone, # action not yet known
|
||||||
actionCSource # action: create C sources
|
actionCSource # action: create C sources
|
||||||
|
|
@ -103,6 +102,9 @@ 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 =
|
||||||
|
when defined(unix): s.replace('\\', '/') else: s.replace('/', '\\')
|
||||||
|
|
||||||
proc skipRoot(f: string): string =
|
proc skipRoot(f: string): string =
|
||||||
# "abc/def/xyz" --> "def/xyz"
|
# "abc/def/xyz" --> "def/xyz"
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
@ -400,15 +402,23 @@ proc srcdist(c: var TConfigData) =
|
||||||
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) / "src" / extractFilename(x))
|
||||||
copyFile(dest=getOutputDir(c) / "src" / extractFilename(x), source=x)
|
copyFile(dest=getOutputDir(c) / "src" / extractFilename(x), source=x)
|
||||||
|
var winIndex = -1
|
||||||
|
var intel32Index = -1
|
||||||
|
var intel64Index = -1
|
||||||
for osA in 1..c.oses.len:
|
for osA in 1..c.oses.len:
|
||||||
|
let osname = c.oses[osA-1]
|
||||||
|
if osname.cmpIgnoreStyle("windows") == 0: winIndex = osA-1
|
||||||
for cpuA in 1..c.cpus.len:
|
for cpuA in 1..c.cpus.len:
|
||||||
|
let cpuname = c.cpus[cpuA-1]
|
||||||
|
if cpuname.cmpIgnoreStyle("i386") == 0: intel32Index = cpuA-1
|
||||||
|
elif cpuname.cmpIgnoreStyle("amd64") == 0: intel64Index = cpuA-1
|
||||||
var dir = getOutputDir(c) / buildDir(osA, cpuA)
|
var dir = getOutputDir(c) / buildDir(osA, cpuA)
|
||||||
if existsDir(dir): removeDir(dir)
|
if existsDir(dir): removeDir(dir)
|
||||||
createDir(dir)
|
createDir(dir)
|
||||||
var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
|
var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
|
||||||
"--gen_mapping --cc:gcc --skipUserCfg" &
|
"--gen_mapping --cc:gcc --skipUserCfg" &
|
||||||
" --os:$# --cpu:$# $# $#") %
|
" --os:$# --cpu:$# $# $#") %
|
||||||
[c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs,
|
[osname, cpuname, c.nimrodArgs,
|
||||||
changeFileExt(c.infile, "nim")]
|
changeFileExt(c.infile, "nim")]
|
||||||
echo(cmd)
|
echo(cmd)
|
||||||
if execShellCmd(cmd) != 0:
|
if execShellCmd(cmd) != 0:
|
||||||
|
|
@ -422,8 +432,13 @@ proc srcdist(c: var TConfigData) =
|
||||||
# second pass: remove duplicate files
|
# second pass: remove duplicate files
|
||||||
removeDuplicateFiles(c)
|
removeDuplicateFiles(c)
|
||||||
writeFile(getOutputDir(c) / buildShFile, generateBuildShellScript(c), "\10")
|
writeFile(getOutputDir(c) / buildShFile, generateBuildShellScript(c), "\10")
|
||||||
writeFile(getOutputDir(c) / buildBatFile32, generateBuildBatchScript(c, tWin32), "\13\10")
|
if winIndex >= 0:
|
||||||
writeFile(getOutputDir(c) / buildBatFile64, generateBuildBatchScript(c, tWin64), "\13\10")
|
if intel32Index >= 0:
|
||||||
|
writeFile(getOutputDir(c) / buildBatFile32,
|
||||||
|
generateBuildBatchScript(c, winIndex, intel32Index), "\13\10")
|
||||||
|
if intel64Index >= 0:
|
||||||
|
writeFile(getOutputDir(c) / buildBatFile64,
|
||||||
|
generateBuildBatchScript(c, winIndex, intel64Index), "\13\10")
|
||||||
writeInstallScripts(c)
|
writeInstallScripts(c)
|
||||||
|
|
||||||
# --------------------- generate inno setup -----------------------------------
|
# --------------------- generate inno setup -----------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue