From 0218c1d493a8a02565bf23e9f1ed168d40dc7519 Mon Sep 17 00:00:00 2001 From: Eugen Minciu Date: Sun, 28 Dec 2014 21:11:35 +0200 Subject: [PATCH] Add option to build in debug/release mode. --- src/nimble.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nimble.nim b/src/nimble.nim index 3436200..1b0d9fd 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -419,17 +419,18 @@ proc processDeps(pkginfo: TPackageInfo, options: TOptions): seq[string] = addRevDep(options, i, pkginfo) saveNimbleData(options) -proc buildFromDir(pkgInfo: TPackageInfo, paths: seq[string]) = +proc buildFromDir(pkgInfo: TPackageInfo, paths: seq[string], forRelease: bool) = ## Builds a package as specified by ``pkgInfo``. let realDir = pkgInfo.getRealDir() + let releaseOpt = if forRelease: "-d:release" else: "" var args = "" for path in paths: args.add("--path:\"" & path & "\" ") for bin in pkgInfo.bin: let outputOpt = pkgInfo.getOutputOption(bin) echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend, " backend...") - doCmd(getNimBin() & " $# -d:release --noBabelPath $#$# \"$#\"" % - [pkgInfo.backend, args, outputOpt, realDir / bin.changeFileExt("nim")]) + doCmd(getNimBin() & " $# $# --noBabelPath $# $# \"$#\"" % + [pkgInfo.backend, releaseOpt, args, outputOpt, realDir / bin.changeFileExt("nim")]) proc saveNimbleMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) = var nimblemeta = %{"url": %url} @@ -480,7 +481,7 @@ proc installFromDir(dir: string, latest: bool, options: TOptions, # Build before removing an existing package (if one exists). This way # if the build fails then the old package will still be installed. - if pkgInfo.bin.len > 0: buildFromDir(pkgInfo, result.paths) + if pkgInfo.bin.len > 0: buildFromDir(pkgInfo, result.paths, true) let versionStr = (if latest: "" else: '-' & pkgInfo.version) let pkgDestDir = pkgsDir / (pkgInfo.name & versionStr) @@ -620,7 +621,7 @@ proc install(packages: seq[TPkgTuple], proc build(options: TOptions) = var pkgInfo = getPkgInfo(getCurrentDir()) let paths = processDeps(pkginfo, options) - buildFromDir(pkgInfo, paths) + buildFromDir(pkgInfo, paths, false) proc search(options: TOptions) = ## Searches for matches in ``options.action.search``.