summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-02-24 02:06:39 -0800
committerGitHub <noreply@github.com>2020-02-24 11:06:39 +0100
commit1cf5c280e3e5111732bfcf4bba3317a99c277593 (patch)
tree630548a2fd7fc624fed86e5473cb288655350996
parent84e78b4ffc005de7a76ec7d05bdfd0caf56a79b1 (diff)
downloadNim-1cf5c280e3e5111732bfcf4bba3317a99c277593.tar.gz
only enable linenoise for -d:nimUseLinenoise (#13478)
* only enable linenoise for -d:nimUseLinenoise

* fixup
-rw-r--r--compiler/commands.nim5
-rw-r--r--compiler/llstream.nim6
-rw-r--r--doc/koch.rst2
-rw-r--r--doc/nimc.rst2
-rw-r--r--koch.nim4
-rw-r--r--tools/niminst/niminst.nim3
6 files changed, 13 insertions, 9 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index cecb07386..638444efe 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -18,7 +18,8 @@ template bootSwitch(name, expr, userString) =
 
 bootSwitch(usedRelease, defined(release), "-d:release")
 bootSwitch(usedDanger, defined(danger), "-d:danger")
-bootSwitch(usedGnuReadline, defined(useLinenoise), "-d:useLinenoise")
+# `useLinenoise` deprecated in favor of `nimUseLinenoise`, kept for backward compatibility
+bootSwitch(useLinenoise, defined(nimUseLinenoise) or defined(useLinenoise), "-d:nimUseLinenoise")
 bootSwitch(usedBoehm, defined(boehmgc), "--gc:boehm")
 bootSwitch(usedMarkAndSweep, defined(gcmarkandsweep), "--gc:markAndSweep")
 bootSwitch(usedGenerational, defined(gcgenerational), "--gc:generational")
@@ -101,7 +102,7 @@ proc writeVersionInfo(conf: ConfigRef; pass: TCmdLinePass) =
       msgWriteln(conf, "git hash: " & gitHash, {msgStdout})
 
     msgWriteln(conf, "active boot switches:" & usedRelease & usedDanger &
-      usedTinyC & usedGnuReadline & usedNativeStacktrace &
+      usedTinyC & useLinenoise & usedNativeStacktrace &
       usedFFI & usedBoehm & usedMarkAndSweep & usedGenerational & usedGoGC & usedNoGC,
                {msgStdout})
     msgQuit(0)
diff --git a/compiler/llstream.nim b/compiler/llstream.nim
index b550716d6..4d9456ff0 100644
--- a/compiler/llstream.nim
+++ b/compiler/llstream.nim
@@ -12,8 +12,10 @@
 import
   pathutils
 
-template imp(x) = import x
-const hasRstdin = compiles(imp(rdstdin))
+# support `useGnuReadline`, `useLinenoise` for backwards compatibility
+const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and
+  not defined(windows)
+
 when hasRstdin: import rdstdin
 
 type
diff --git a/doc/koch.rst b/doc/koch.rst
index 0f8434064..436e0e406 100644
--- a/doc/koch.rst
+++ b/doc/koch.rst
@@ -35,7 +35,7 @@ options:
   By default a debug version is created, passing this option will
   force a release build, which is much faster and should be preferred
   unless you are debugging the compiler.
--d:useLinenoise
+-d:nimUseLinenoise
   Use the linenoise library for interactive mode (not needed on Windows).
 
 After compilation is finished you will hopefully end up with the nim
diff --git a/doc/nimc.rst b/doc/nimc.rst
index c1c418e01..b67c05a0e 100644
--- a/doc/nimc.rst
+++ b/doc/nimc.rst
@@ -528,7 +528,7 @@ for further information.
 
   The Nim compiler supports an interactive mode. This is also known as
   a `REPL`:idx: (*read eval print loop*). If Nim has been built with the
-  ``-d:useGnuReadline`` switch, it uses the GNU readline library for terminal
+  ``-d:nimUseLinenoise`` switch, it uses the GNU readline library for terminal
   input management. To start Nim in interactive mode use the command
   ``nim secret``. To quit use the ``quit()`` command. To determine whether an input
   line is an incomplete statement to be continued these rules are used:
diff --git a/koch.nim b/koch.nim
index e3b743c44..e3ef73acd 100644
--- a/koch.nim
+++ b/koch.nim
@@ -55,8 +55,8 @@ Possible Commands:
   nimble                   builds the Nimble tool
 Boot options:
   -d:release               produce a release version of the compiler
-  -d:useLinenoise          use the linenoise library for interactive mode
-                           (not needed on Windows)
+  -d:nimUseLinenoise       use the linenoise library for interactive mode
+                           `nim secret` (not needed on Windows)
   -d:leanCompiler          produce a compiler without JS codegen or
                            documentation generator in order to use less RAM
                            for bootstrapping
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index d821a68bb..4746f328a 100644
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -513,7 +513,8 @@ template gatherFiles(fun, libpath, outDir) =
       fun(src, dst)
 
     for f in walkFiles(libpath / "lib/*.h"): copySrc(f)
-    copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
+    # commenting out for now, see discussion in https://github.com/nim-lang/Nim/pull/13413
+    # copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
 
 proc srcdist(c: var ConfigData) =
   let cCodeDir = getOutputDir(c) / "c_code"