Skip to content

Commit 2b368bc

Browse files
authored
fix linenoise regression (#13395)
* fix nightlies linenoise regression * fix other installers
1 parent 90491ea commit 2b368bc

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

tools/niminst/niminst.nim

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,20 @@ proc writeInstallScripts(c: var ConfigData) =
505505
writeFile(deinstallShFile, generateDeinstallScript(c), "\10")
506506
inclFilePermissions(deinstallShFile, {fpUserExec, fpGroupExec, fpOthersExec})
507507

508+
template gatherFiles(fun, libpath, outDir) =
509+
block:
510+
template copySrc(src) =
511+
let dst = outDir / extractFilename(src)
512+
when false: echo (dst, dst)
513+
fun(src, dst)
514+
515+
for f in walkFiles(libpath / "lib/*.h"): copySrc(f)
516+
copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
517+
508518
proc srcdist(c: var ConfigData) =
509-
if not existsDir(getOutputDir(c) / "c_code"):
510-
createDir(getOutputDir(c) / "c_code")
511-
for x in walkFiles(c.libpath / "lib/*.h"):
512-
when false: echo(getOutputDir(c) / "c_code" / extractFilename(x))
513-
copyFile(dest=getOutputDir(c) / "c_code" / extractFilename(x), source=x)
519+
let cCodeDir = getOutputDir(c) / "c_code"
520+
if not existsDir(cCodeDir): createDir(cCodeDir)
521+
gatherFiles(copyFile, c.libpath, cCodeDir)
514522
var winIndex = -1
515523
var intel32Index = -1
516524
var intel64Index = -1
@@ -603,8 +611,9 @@ when haveZipLib:
603611
addFile(z, proj / makeFile, "build" / makeFile)
604612
addFile(z, proj / installShFile, installShFile)
605613
addFile(z, proj / deinstallShFile, deinstallShFile)
606-
for f in walkFiles(c.libpath / "lib/*.h"):
607-
addFile(z, proj / "c_code" / extractFilename(f), f)
614+
615+
template addFileAux(src, dst) = addFile(z, dst, src)
616+
gatherFiles(addFileAux, c.libpath, proj / "c_code")
608617
for osA in 1..c.oses.len:
609618
for cpuA in 1..c.cpus.len:
610619
var dir = buildDir(osA, cpuA)
@@ -647,8 +656,8 @@ proc xzDist(c: var ConfigData; windowsZip=false) =
647656
processFile(proj / makeFile, "build" / makeFile)
648657
processFile(proj / installShFile, installShFile)
649658
processFile(proj / deinstallShFile, deinstallShFile)
650-
for f in walkFiles(c.libpath / "lib/*.h"):
651-
processFile(proj / "c_code" / extractFilename(f), f)
659+
template processFileAux(src, dst) = processFile(dst, src)
660+
gatherFiles(processFileAux, c.libpath, proj / "c_code")
652661
for osA in 1..c.oses.len:
653662
for cpuA in 1..c.cpus.len:
654663
var dir = buildDir(osA, cpuA)
@@ -722,8 +731,7 @@ proc debDist(c: var ConfigData) =
722731
copyNimDist(makeFile, makeFile)
723732
copyNimDist(installShFile, installShFile)
724733
createDir(workingDir / upstreamSource / "build")
725-
for f in walkFiles(c.libpath / "lib/*.h"):
726-
copyNimDist(f, "build" / extractFilename(f))
734+
gatherFiles(copyNimDist, c.libpath, "build")
727735
for osA in 1..c.oses.len:
728736
for cpuA in 1..c.cpus.len:
729737
var dir = buildDir(osA, cpuA)

0 commit comments

Comments
 (0)