Fixes niminst zip not creating output dir & cleans related code.

This commit is contained in:
Dominik Picheta 2016-10-16 16:11:26 +02:00
commit d004a06c6e

View file

@ -621,37 +621,38 @@ proc xzDist(c: var ConfigData; windowsZip=false) =
let proj = toLower(c.name) & "-" & c.version let proj = toLower(c.name) & "-" & c.version
let tmpDir = if c.outdir.len == 0: "build" else: c.outdir let tmpDir = if c.outdir.len == 0: "build" else: c.outdir
template processFile(z, dest, src) = template processFile(destFile, src) =
let s = src let dest = tmpDir / destFile
let d = dest echo "Copying ", src, " to ", dest
echo "Copying ", s, " to ", tmpDir / d if not existsFile(src):
let destdir = tmpdir / d.splitFile.dir echo "[Warning] Source file doesn't exist: ", src
if not dirExists(destdir): createDir(destdir) let destDir = dest.splitFile.dir
copyFileWithPermissions(s, tmpDir / d) if not dirExists(destDir): createDir(destDir)
copyFileWithPermissions(src, dest)
processFile(z, proj / buildBatFile32, "build" / buildBatFile32) processFile(proj / buildBatFile32, "build" / buildBatFile32)
processFile(z, proj / buildBatFile64, "build" / buildBatFile64) processFile(proj / buildBatFile64, "build" / buildBatFile64)
processFile(z, proj / buildShFile, "build" / buildShFile) processFile(proj / buildShFile, "build" / buildShFile)
processFile(z, proj / makeFile, "build" / makeFile) processFile(proj / makeFile, "build" / makeFile)
processFile(z, proj / installShFile, installShFile) processFile(proj / installShFile, installShFile)
processFile(z, proj / deinstallShFile, deinstallShFile) processFile(proj / deinstallShFile, deinstallShFile)
if not windowsZip: if not windowsZip:
for f in walkFiles(c.libpath / "lib/*.h"): for f in walkFiles(c.libpath / "lib/*.h"):
processFile(z, proj / "c_code" / extractFilename(f), f) processFile(proj / "c_code" / extractFilename(f), f)
for osA in 1..c.oses.len: for osA in 1..c.oses.len:
for cpuA in 1..c.cpus.len: for cpuA in 1..c.cpus.len:
var dir = buildDir(osA, cpuA) var dir = buildDir(osA, cpuA)
for k, f in walkDir("build" / dir): for k, f in walkDir("build" / dir):
if k == pcFile: processFile(z, proj / dir / extractFilename(f), f) if k == pcFile: processFile(proj / dir / extractFilename(f), f)
let osSpecific = if windowsZip: fcWindows else: fcUnix let osSpecific = if windowsZip: fcWindows else: fcUnix
for cat in items({fcConfig..fcOther, osSpecific, fcNimble}): for cat in items({fcConfig..fcOther, osSpecific, fcNimble}):
echo("Current category: ", cat) echo("Current category: ", cat)
for f in items(c.cat[cat]): processFile(z, proj / f, f) for f in items(c.cat[cat]): processFile(proj / f, f)
# Copy the .nimble file over # Copy the .nimble file over
let nimbleFile = c.nimblePkgName & ".nimble" let nimbleFile = c.nimblePkgName & ".nimble"
processFile(z, proj / nimbleFile, nimbleFile) processFile(proj / nimbleFile, nimbleFile)
when true: when true:
let oldDir = getCurrentDir() let oldDir = getCurrentDir()