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
commit 1cf5c280e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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(usedRelease, defined(release), "-d:release")
bootSwitch(usedDanger, defined(danger), "-d:danger") 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(usedBoehm, defined(boehmgc), "--gc:boehm")
bootSwitch(usedMarkAndSweep, defined(gcmarkandsweep), "--gc:markAndSweep") bootSwitch(usedMarkAndSweep, defined(gcmarkandsweep), "--gc:markAndSweep")
bootSwitch(usedGenerational, defined(gcgenerational), "--gc:generational") bootSwitch(usedGenerational, defined(gcgenerational), "--gc:generational")
@ -101,7 +102,7 @@ proc writeVersionInfo(conf: ConfigRef; pass: TCmdLinePass) =
msgWriteln(conf, "git hash: " & gitHash, {msgStdout}) msgWriteln(conf, "git hash: " & gitHash, {msgStdout})
msgWriteln(conf, "active boot switches:" & usedRelease & usedDanger & msgWriteln(conf, "active boot switches:" & usedRelease & usedDanger &
usedTinyC & usedGnuReadline & usedNativeStacktrace & usedTinyC & useLinenoise & usedNativeStacktrace &
usedFFI & usedBoehm & usedMarkAndSweep & usedGenerational & usedGoGC & usedNoGC, usedFFI & usedBoehm & usedMarkAndSweep & usedGenerational & usedGoGC & usedNoGC,
{msgStdout}) {msgStdout})
msgQuit(0) msgQuit(0)

View file

@ -12,8 +12,10 @@
import import
pathutils pathutils
template imp(x) = import x # support `useGnuReadline`, `useLinenoise` for backwards compatibility
const hasRstdin = compiles(imp(rdstdin)) const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and
not defined(windows)
when hasRstdin: import rdstdin when hasRstdin: import rdstdin
type type

View file

@ -35,7 +35,7 @@ options:
By default a debug version is created, passing this option will By default a debug version is created, passing this option will
force a release build, which is much faster and should be preferred force a release build, which is much faster and should be preferred
unless you are debugging the compiler. unless you are debugging the compiler.
-d:useLinenoise -d:nimUseLinenoise
Use the linenoise library for interactive mode (not needed on Windows). Use the linenoise library for interactive mode (not needed on Windows).
After compilation is finished you will hopefully end up with the nim 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 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 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 input management. To start Nim in interactive mode use the command
``nim secret``. To quit use the ``quit()`` command. To determine whether an input ``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: 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 nimble builds the Nimble tool
Boot options: Boot options:
-d:release produce a release version of the compiler -d:release produce a release version of the compiler
-d:useLinenoise use the linenoise library for interactive mode -d:nimUseLinenoise use the linenoise library for interactive mode
(not needed on Windows) `nim secret` (not needed on Windows)
-d:leanCompiler produce a compiler without JS codegen or -d:leanCompiler produce a compiler without JS codegen or
documentation generator in order to use less RAM documentation generator in order to use less RAM
for bootstrapping for bootstrapping

View file

@ -513,7 +513,8 @@ template gatherFiles(fun, libpath, outDir) =
fun(src, dst) fun(src, dst)
for f in walkFiles(libpath / "lib/*.h"): copySrc(f) 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) = proc srcdist(c: var ConfigData) =
let cCodeDir = getOutputDir(c) / "c_code" let cCodeDir = getOutputDir(c) / "c_code"