summary refs log tree commit diff stats
path: root/tools/niminst
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-02-12 01:35:00 -0800
committerGitHub <noreply@github.com>2020-02-12 10:35:00 +0100
commit2b368bcdd705a5c7f0558df706fde01d217f5e9d (patch)
tree4560594c1a4c8991a9eba9c9f51f6f2b5a315a25 /tools/niminst
parent90491ea0a98aaca198bebf3ce99a1f86559f18ec (diff)
downloadNim-2b368bcdd705a5c7f0558df706fde01d217f5e9d.tar.gz
fix linenoise regression (#13395)
* fix nightlies linenoise regression

* fix other installers
Diffstat (limited to 'tools/niminst')
-rw-r--r--tools/niminst/niminst.nim30
1 files changed, 19 insertions, 11 deletions
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index 558184904..d821a68bb 100644
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -505,12 +505,20 @@ proc writeInstallScripts(c: var ConfigData) =
     writeFile(deinstallShFile, generateDeinstallScript(c), "\10")
     inclFilePermissions(deinstallShFile, {fpUserExec, fpGroupExec, fpOthersExec})
 
+template gatherFiles(fun, libpath, outDir) =
+  block:
+    template copySrc(src) =
+      let dst = outDir / extractFilename(src)
+      when false: echo (dst, dst)
+      fun(src, dst)
+
+    for f in walkFiles(libpath / "lib/*.h"): copySrc(f)
+    copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
+
 proc srcdist(c: var ConfigData) =
-  if not existsDir(getOutputDir(c) / "c_code"):
-    createDir(getOutputDir(c) / "c_code")
-  for x in walkFiles(c.libpath / "lib/*.h"):
-    when false: echo(getOutputDir(c) / "c_code" / extractFilename(x))
-    copyFile(dest=getOutputDir(c) / "c_code" / extractFilename(x), source=x)
+  let cCodeDir = getOutputDir(c) / "c_code"
+  if not existsDir(cCodeDir): createDir(cCodeDir)
+  gatherFiles(copyFile, c.libpath, cCodeDir)
   var winIndex = -1
   var intel32Index = -1
   var intel64Index = -1
@@ -603,8 +611,9 @@ when haveZipLib:
       addFile(z, proj / makeFile, "build" / makeFile)
       addFile(z, proj / installShFile, installShFile)
       addFile(z, proj / deinstallShFile, deinstallShFile)
-      for f in walkFiles(c.libpath / "lib/*.h"):
-        addFile(z, proj / "c_code" / extractFilename(f), f)
+
+      template addFileAux(src, dst) = addFile(z, dst, src)
+      gatherFiles(addFileAux, c.libpath, proj / "c_code")
       for osA in 1..c.oses.len:
         for cpuA in 1..c.cpus.len:
           var dir = buildDir(osA, cpuA)
@@ -647,8 +656,8 @@ proc xzDist(c: var ConfigData; windowsZip=false) =
     processFile(proj / makeFile, "build" / makeFile)
     processFile(proj / installShFile, installShFile)
     processFile(proj / deinstallShFile, deinstallShFile)
-    for f in walkFiles(c.libpath / "lib/*.h"):
-      processFile(proj / "c_code" / extractFilename(f), f)
+    template processFileAux(src, dst) = processFile(dst, src)
+    gatherFiles(processFileAux, c.libpath, proj / "c_code")
     for osA in 1..c.oses.len:
       for cpuA in 1..c.cpus.len:
         var dir = buildDir(osA, cpuA)
@@ -722,8 +731,7 @@ proc debDist(c: var ConfigData) =
   copyNimDist(makeFile, makeFile)
   copyNimDist(installShFile, installShFile)
   createDir(workingDir / upstreamSource / "build")
-  for f in walkFiles(c.libpath / "lib/*.h"):
-    copyNimDist(f, "build" / extractFilename(f))
+  gatherFiles(copyNimDist, c.libpath, "build")
   for osA in 1..c.oses.len:
     for cpuA in 1..c.cpus.len:
       var dir = buildDir(osA, cpuA)