Add a builddir option.
This commit is contained in:
parent
d2f6c7f2e7
commit
cce58bd981
2 changed files with 14 additions and 2 deletions
|
|
@ -425,10 +425,11 @@ proc buildFromDir(pkgInfo: TPackageInfo, paths: seq[string]) =
|
||||||
var args = ""
|
var args = ""
|
||||||
for path in paths: args.add("--path:\"" & path & "\" ")
|
for path in paths: args.add("--path:\"" & path & "\" ")
|
||||||
for bin in pkgInfo.bin:
|
for bin in pkgInfo.bin:
|
||||||
|
let outputOpt = pkgInfo.getOutputOption(bin)
|
||||||
echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend,
|
echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend,
|
||||||
" backend...")
|
" backend...")
|
||||||
doCmd(getNimBin() & " $# -d:release --noBabelPath $# \"$#\"" %
|
doCmd(getNimBin() & " $# -d:release --noBabelPath $#$# \"$#\"" %
|
||||||
[pkgInfo.backend, args, realDir / bin.changeFileExt("nim")])
|
[pkgInfo.backend, args, outputOpt, realDir / bin.changeFileExt("nim")])
|
||||||
|
|
||||||
proc saveNimbleMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) =
|
proc saveNimbleMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) =
|
||||||
var nimblemeta = %{"url": %url}
|
var nimblemeta = %{"url": %url}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ type
|
||||||
installExt*: seq[string]
|
installExt*: seq[string]
|
||||||
requires*: seq[TPkgTuple]
|
requires*: seq[TPkgTuple]
|
||||||
bin*: seq[string]
|
bin*: seq[string]
|
||||||
|
buildDir*: string
|
||||||
srcDir*: string
|
srcDir*: string
|
||||||
backend*: string
|
backend*: string
|
||||||
|
|
||||||
|
|
@ -56,6 +57,7 @@ proc initPackageInfo(): TPackageInfo =
|
||||||
result.requires = @[]
|
result.requires = @[]
|
||||||
result.bin = @[]
|
result.bin = @[]
|
||||||
result.srcDir = ""
|
result.srcDir = ""
|
||||||
|
result.buildDir = ""
|
||||||
result.backend = "c"
|
result.backend = "c"
|
||||||
|
|
||||||
proc validatePackageInfo(pkgInfo: TPackageInfo, path: string) =
|
proc validatePackageInfo(pkgInfo: TPackageInfo, path: string) =
|
||||||
|
|
@ -140,6 +142,7 @@ proc readPackageInfo*(path: string): TPackageInfo =
|
||||||
of "description": result.description = ev.value
|
of "description": result.description = ev.value
|
||||||
of "license": result.license = ev.value
|
of "license": result.license = ev.value
|
||||||
of "srcdir": result.srcDir = ev.value
|
of "srcdir": result.srcDir = ev.value
|
||||||
|
of "builddir": result.buildDir = ev.value
|
||||||
of "skipdirs":
|
of "skipdirs":
|
||||||
result.skipDirs.add(ev.value.multiSplit)
|
result.skipDirs.add(ev.value.multiSplit)
|
||||||
of "skipfiles":
|
of "skipfiles":
|
||||||
|
|
@ -318,6 +321,14 @@ proc getRealDir*(pkgInfo: TPackageInfo): string =
|
||||||
else:
|
else:
|
||||||
result = pkgInfo.mypath.splitFile.dir
|
result = pkgInfo.mypath.splitFile.dir
|
||||||
|
|
||||||
|
proc getOutputOption*(pkgInfo: TPackageInfo, bin: string): string =
|
||||||
|
## Returns an output option for the nim compiler if a build directory
|
||||||
|
## has been set.
|
||||||
|
if pkgInfo.buildDir != "":
|
||||||
|
result = " -o:\"" & pkgInfo.mypath.splitFile.dir / pkgInfo.buildDir / bin & "\""
|
||||||
|
else:
|
||||||
|
result = ""
|
||||||
|
|
||||||
proc getNameVersion*(pkgpath: string): tuple[name, version: string] =
|
proc getNameVersion*(pkgpath: string): tuple[name, version: string] =
|
||||||
## Splits ``pkgpath`` in the format ``/home/user/.nimble/pkgs/package-0.1``
|
## Splits ``pkgpath`` in the format ``/home/user/.nimble/pkgs/package-0.1``
|
||||||
## into ``(packagea, 0.1)``
|
## into ``(packagea, 0.1)``
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue