installer fixes and improvements

This commit is contained in:
Andreas Rumpf
2016-06-07 10:09:23 +02:00
parent 7f53224563
commit 82a75635f7
3 changed files with 23 additions and 3 deletions

View File

@@ -65,6 +65,7 @@ Files: "compiler/installer.ini"
Files: "compiler/*.cfg"
Files: "compiler/*.nim"
Files: "doc/*.txt"
Files: "doc/*.rst"
Files: "doc/manual/*.txt"
Files: "doc/*.nim"
Files: "doc/*.cfg"
@@ -84,6 +85,7 @@ Files: "tools/niminst/*.nsh"
Files: "web/website.ini"
Files: "web/*.nim"
Files: "web/*.txt"
Files: "web/*.rst"
Files: "bin/nimblepkg/*.nim"
Files: "bin/nimblepkg/*.cfg"
@@ -131,6 +133,8 @@ Files: "examples/*.txt"
Files: "examples/*.cfg"
Files: "examples/*.tmpl"
Files: "dist/nimble"
Files: "tests/actiontable/*.nim"
Files: "tests/alias/*.nim"
Files: "tests/ambsym/*.nim"

View File

@@ -110,13 +110,28 @@ proc csource(args: string) =
exec("$4 cc $1 -r $3 --var:version=$2 --var:mingw=none csource --main:compiler/nim.nim compiler/installer.ini $1" %
[args, VersionAsString, compileNimInst, findNim()])
proc bundleNimble() =
if dirExists("dist/nimble/.git"):
exec("git --git-dir dist/nimble pull --rebase")
else:
exec("git clone https://github.com/nim-lang/nimble.git dist/nimble")
let tags = execProcess("git --git-dir dist/nimble/.git tag -l v*").splitLines
let tag = tags[^1]
exec("git --git-dir dist/nimble/.git checkout " & tag)
# now compile Nimble and copy it to $nim/bin for the installer.ini
# to pick it up:
exec(findNim() & " c dist/nimble/src/nimble.nim")
copyExe("dist/nimble/nimble".exe, "bin/nimble".exe)
proc zip(args: string) =
bundleNimble()
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
[VersionAsString, compileNimInst, findNim()])
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" %
["tools/niminst/niminst".exe, VersionAsString])
proc xz(args: string) =
bundleNimble()
exec("$3 cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %
[VersionAsString, compileNimInst, findNim()])
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim xz compiler/installer.ini" %
@@ -127,6 +142,7 @@ proc buildTool(toolname, args: string) =
copyFile(dest="bin"/ splitFile(toolname).name.exe, source=toolname.exe)
proc nsis(args: string) =
bundleNimble()
# make sure we have generated the niminst executables:
buildTool("tools/niminst/niminst", args)
#buildTool("tools/nimgrep", args)

View File

@@ -89,7 +89,7 @@ proc quoteShellWindows*(s: string): string {.noSideEffect, rtl, extern: "nosp$1"
result.add("\"")
proc quoteShellPosix*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} =
## Quote s, so it can be safely passed to POSIX shell.
## Quote ``s``, so it can be safely passed to POSIX shell.
## Based on Python's pipes.quote
const safeUnixChars = {'%', '+', '-', '.', '/', '_', ':', '=', '@',
'0'..'9', 'A'..'Z', 'a'..'z'}
@@ -104,7 +104,7 @@ proc quoteShellPosix*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".}
return "'" & s.replace("'", "'\"'\"'") & "'"
proc quoteShell*(s: string): string {.noSideEffect, rtl, extern: "nosp$1".} =
## Quote s, so it can be safely passed to shell.
## Quote ``s``, so it can be safely passed to shell.
when defined(Windows):
return quoteShellWindows(s)
elif defined(posix):
@@ -967,7 +967,7 @@ elif not defined(useNimRtl):
proc kill(p: Process) =
if kill(p.id, SIGKILL) != 0'i32:
raiseOsError(osLastError())
when defined(macosx) or defined(freebsd) or defined(netbsd) or
defined(openbsd):
import kqueue, times