only enable linenoise for -d:nimUseLinenoise (#13478)

* only enable linenoise for -d:nimUseLinenoise

* fixup
This commit is contained in:
Timothee Cour
2020-02-24 02:06:39 -08:00
committed by GitHub
parent 84e78b4ffc
commit 1cf5c280e3
6 changed files with 13 additions and 9 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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"