@@ -505,12 +505,20 @@ proc writeInstallScripts(c: var ConfigData) =
505
505
writeFile(deinstallShFile, generateDeinstallScript(c), " \10 " )
506
506
inclFilePermissions(deinstallShFile, {fpUserExec, fpGroupExec, fpOthersExec})
507
507
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
+
508
518
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)
514
522
var winIndex = - 1
515
523
var intel32Index = - 1
516
524
var intel64Index = - 1
@@ -603,8 +611,9 @@ when haveZipLib:
603
611
addFile(z, proj / makeFile, " build" / makeFile)
604
612
addFile(z, proj / installShFile, installShFile)
605
613
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" )
608
617
for osA in 1 .. c.oses.len:
609
618
for cpuA in 1 .. c.cpus.len:
610
619
var dir = buildDir(osA, cpuA)
@@ -647,8 +656,8 @@ proc xzDist(c: var ConfigData; windowsZip=false) =
647
656
processFile(proj / makeFile, " build" / makeFile)
648
657
processFile(proj / installShFile, installShFile)
649
658
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" )
652
661
for osA in 1 .. c.oses.len:
653
662
for cpuA in 1 .. c.cpus.len:
654
663
var dir = buildDir(osA, cpuA)
@@ -722,8 +731,7 @@ proc debDist(c: var ConfigData) =
722
731
copyNimDist(makeFile, makeFile)
723
732
copyNimDist(installShFile, installShFile)
724
733
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" )
727
735
for osA in 1 .. c.oses.len:
728
736
for cpuA in 1 .. c.cpus.len:
729
737
var dir = buildDir(osA, cpuA)
0 commit comments