This commit is contained in:
Araq
2013-09-01 10:36:13 +02:00
parent 0464a1071e
commit 8087f51d14
8 changed files with 48 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
[Project]
Name: "Nimrod"
Version: "$version"
; Windows and i386 must be first!
OS: "windows;linux;macosx;solaris;freebsd;netbsd;openbsd"
CPU: "i386;amd64;powerpc64;arm" # ;sparc
Authors: "Andreas Rumpf"

View File

@@ -22,6 +22,7 @@ version 0.9.4
Bugs
====
- compilation of niminst takes way too long. looks like a regression
- simple closure iterator doesn't work
- docgen: sometimes effects are listed twice
- 'result' is not properly cleaned for NRVO --> use uninit checking instead

View File

@@ -1,11 +1,11 @@
#! 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"
SET CC=gcc
SET LINKER=gcc
SET COMP_FLAGS=?{c.ccompiler.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
@@ -15,8 +15,8 @@ REM call the compiler:
# block win32:
# var linkCmd = ""
# for ff in items(c.cfiles[1][ord(target)]):
# let f = ff.replace('/', '\\')
# 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")}
# linkCmd.add(" " & changeFileExt(f, "o"))

View File

@@ -35,7 +35,7 @@ LINK_FLAGS="?{c.linker.flags}"
ucpu=`uname -m`
uos=`uname`
# add(result, "# bin dir detection\n")
binDir=?{firstBinPath(c)}
binDir=?{firstBinPath(c).slashify}
if [ -s ../koch.nim ]; then
binDir="../bin"
@@ -126,7 +126,8 @@ case $myos in
# for cpuA in 1..c.cpus.len:
?{c.cpus[cpuA-1]})
# 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")}"
$CC $COMP_FLAGS -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
# add(linkCmd, " \\\n" & changeFileExt(f, "o"))

View File

@@ -39,10 +39,12 @@ if [ $# -eq 1 ] ; then
esac
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
#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
#end for
rm -rf $docdir

View File

@@ -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)}; DestDir: {app}\${splitFile(f).dir}; Flags: ignoreversion
Source: ${expandFilename(f).slashify}; DestDir: {app}\${splitFile(f).dir.slashify}; 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
Name: {group}\Documentation; Filename: {app}\${f.slashify}
#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';
result[$i] := ExpandConstant('{app}') + '\${b.slashify}';
#inc(i)
#end for
end;

View File

@@ -7,7 +7,7 @@ set -e
if [ $# -eq 1 ] ; then
# if c.cat[fcUnixBin].len > 0:
if test -f ?{c.cat[fcUnixBin][0]}
if test -f ?{c.cat[fcUnixBin][0].slashify}
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
mkdir -p ?{mk.slashify}
# end if
# end if
# end for
#end for
#for f in items(c.cat[fcUnixBin]):
cp ?f $bindir/?f.skipRoot
chmod 755 $bindir/?f.skipRoot
cp ?f.slashify $bindir/?f.skipRoot.slashify
chmod 755 $bindir/?f.skipRoot.slashify
#end for
#for f in items(c.cat[fcConfig]):
cp ?f $configdir/?f.skipRoot
chmod 644 $configdir/?f.skipRoot
cp ?f.slashify $configdir/?f.skipRoot.slashify
chmod 644 $configdir/?f.skipRoot.slashify
#end for
#for f in items(c.cat[fcData]):
if [ -f ?f ]; then
cp ?f $datadir/?f.skipRoot
chmod 644 $datadir/?f.skipRoot
if [ -f ?f.slashify ]; then
cp ?f.slashify $datadir/?f.skipRoot.slashify
chmod 644 $datadir/?f.skipRoot.slashify
fi
#end for
#for f in items(c.cat[fcDoc]):
if [ -f ?f ]; then
cp ?f $docdir/?f.skipRoot
chmod 644 $docdir/?f.skipRoot
if [ -f ?f.slashify ]; then
cp ?f.slashify $docdir/?f.skipRoot.slashify
chmod 644 $docdir/?f.skipRoot.slashify
fi
#end for
#for f in items(c.cat[fcLib]):
cp ?f $libdir/?f.skipRoot
chmod 644 $libdir/?f.skipRoot
cp ?f.slashify $libdir/?f.skipRoot.slashify
chmod 644 $libdir/?f.skipRoot.slashify
#end for
echo "installation successful"

View File

@@ -27,7 +27,6 @@ const
type
TAppType = enum appConsole, appGUI
TTarget = enum tWin32 = 1, tWin64 = 2
TAction = enum
actionNone, # action not yet known
actionCSource # action: create C sources
@@ -103,6 +102,9 @@ 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('/', '\\')
proc skipRoot(f: string): string =
# "abc/def/xyz" --> "def/xyz"
var i = 0
@@ -400,15 +402,23 @@ proc srcdist(c: var TConfigData) =
for x in walkFiles(c.libpath / "lib/*.h"):
echo(getOutputDir(c) / "src" / extractFilename(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:
let osname = c.oses[osA-1]
if osname.cmpIgnoreStyle("windows") == 0: winIndex = osA-1
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)
if existsDir(dir): removeDir(dir)
createDir(dir)
var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
"--gen_mapping --cc:gcc --skipUserCfg" &
" --os:$# --cpu:$# $# $#") %
[c.oses[osA-1], c.cpus[cpuA-1], c.nimrodArgs,
[osname, cpuname, c.nimrodArgs,
changeFileExt(c.infile, "nim")]
echo(cmd)
if execShellCmd(cmd) != 0:
@@ -422,8 +432,13 @@ proc srcdist(c: var TConfigData) =
# second pass: remove duplicate files
removeDuplicateFiles(c)
writeFile(getOutputDir(c) / buildShFile, generateBuildShellScript(c), "\10")
writeFile(getOutputDir(c) / buildBatFile32, generateBuildBatchScript(c, tWin32), "\13\10")
writeFile(getOutputDir(c) / buildBatFile64, generateBuildBatchScript(c, tWin64), "\13\10")
if winIndex >= 0:
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)
# --------------------- generate inno setup -----------------------------------