mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
renamed babelcmd to nimblecmd; config files are now nim.cfg; other renamings
This commit is contained in:
@@ -26,7 +26,7 @@ bootSwitch(usedNoGC, defined(nogc), "--gc:none")
|
||||
|
||||
import
|
||||
os, msgs, options, nversion, condsyms, strutils, extccomp, platform, lists,
|
||||
wordrecg, parseutils, babelcmd, idents
|
||||
wordrecg, parseutils, nimblecmd, idents
|
||||
|
||||
# but some have deps to imported modules. Yay.
|
||||
bootSwitch(usedTinyC, hasTinyCBackend, "-d:tinyc")
|
||||
@@ -280,14 +280,15 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||
of "path", "p":
|
||||
expectArg(switch, arg, pass, info)
|
||||
addPath(processPath(arg), info)
|
||||
of "babelpath":
|
||||
if pass in {passCmd2, passPP} and not options.gNoBabelPath:
|
||||
of "nimblepath", "babelpath":
|
||||
# keep the old name for compat
|
||||
if pass in {passCmd2, passPP} and not options.gNoNimblePath:
|
||||
expectArg(switch, arg, pass, info)
|
||||
let path = processPath(arg, notRelativeToProj=true)
|
||||
babelPath(path, info)
|
||||
of "nobabelpath":
|
||||
nimblePath(path, info)
|
||||
of "nonimblepath", "nobabelpath":
|
||||
expectNoArg(switch, arg, pass, info)
|
||||
options.gNoBabelPath = true
|
||||
options.gNoNimblePath = true
|
||||
of "excludepath":
|
||||
expectArg(switch, arg, pass, info)
|
||||
let path = processPath(arg)
|
||||
|
||||
@@ -58,7 +58,7 @@ iterator chosen(packages: StringTableRef): string =
|
||||
let res = if val == latest: key else: key & '-' & val
|
||||
yield res
|
||||
|
||||
proc addBabelPath(p: string, info: TLineInfo) =
|
||||
proc addNimblePath(p: string, info: TLineInfo) =
|
||||
if not contains(options.searchPaths, p):
|
||||
if gVerbosity >= 1: message(info, hintPath, p)
|
||||
lists.prependStr(options.lazyPaths, p)
|
||||
@@ -70,10 +70,10 @@ proc addPathWithNimFiles(p: string, info: TLineInfo) =
|
||||
result = true
|
||||
break
|
||||
if hasNimFile(p):
|
||||
addBabelPath(p, info)
|
||||
addNimblePath(p, info)
|
||||
else:
|
||||
for kind, p2 in walkDir(p):
|
||||
if hasNimFile(p2): addBabelPath(p2, info)
|
||||
if hasNimFile(p2): addNimblePath(p2, info)
|
||||
|
||||
proc addPathRec(dir: string, info: TLineInfo) =
|
||||
var packages = newStringTable(modeStyleInsensitive)
|
||||
@@ -83,8 +83,8 @@ proc addPathRec(dir: string, info: TLineInfo) =
|
||||
if k == pcDir and p[pos] != '.':
|
||||
addPackage(packages, p)
|
||||
for p in packages.chosen:
|
||||
addBabelPath(p, info)
|
||||
addNimblePath(p, info)
|
||||
|
||||
proc babelPath*(path: string, info: TLineInfo) =
|
||||
proc nimblePath*(path: string, info: TLineInfo) =
|
||||
addPathRec(path, info)
|
||||
addBabelPath(path, info)
|
||||
addNimblePath(path, info)
|
||||
@@ -224,8 +224,8 @@ proc loadConfigs*(cfg: string) =
|
||||
if libpath == "":
|
||||
# choose default libpath:
|
||||
var prefix = getPrefixDir()
|
||||
if prefix == "/usr": libpath = "/usr/lib/nimrod"
|
||||
elif prefix == "/usr/local": libpath = "/usr/local/lib/nimrod"
|
||||
if prefix == "/usr": libpath = "/usr/lib/nim"
|
||||
elif prefix == "/usr/local": libpath = "/usr/local/lib/nim"
|
||||
else: libpath = joinPath(prefix, "lib")
|
||||
|
||||
if optSkipConfigFile notin gGlobalOptions:
|
||||
@@ -244,5 +244,6 @@ proc loadConfigs*(cfg: string) =
|
||||
|
||||
if gProjectName.len != 0:
|
||||
# new project wide config file:
|
||||
readConfigFile(changeFileExt(gProjectFull, "nimrod.cfg"))
|
||||
|
||||
let projectConfig = changeFileExt(gProjectFull, "nim.cfg")
|
||||
if fileExists(projectConfig): readConfigFile(projectConfig)
|
||||
else: readConfigFile(changeFileExt(gProjectFull, "nimrod.cfg"))
|
||||
|
||||
@@ -114,7 +114,7 @@ var
|
||||
gDirtyBufferIdx* = 0'i32 # indicates the fileIdx of the dirty version of
|
||||
# the tracked source X, saved by the CAAS client.
|
||||
gDirtyOriginalIdx* = 0'i32 # the original source file of the dirtified buffer.
|
||||
gNoBabelPath* = false
|
||||
gNoNimblePath* = false
|
||||
|
||||
proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools}
|
||||
proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc
|
||||
@@ -139,7 +139,7 @@ const
|
||||
JsonExt* = "json"
|
||||
TexExt* = "tex"
|
||||
IniExt* = "ini"
|
||||
DefaultConfig* = "nimrod.cfg"
|
||||
DefaultConfig* = "nim.cfg"
|
||||
DocConfig* = "nimdoc.cfg"
|
||||
DocTexConfig* = "nimdoc.tex.cfg"
|
||||
|
||||
|
||||
141
config/nim.cfg
Normal file
141
config/nim.cfg
Normal file
@@ -0,0 +1,141 @@
|
||||
# Configuration file for the Nim Compiler.
|
||||
# (c) 2014 Andreas Rumpf
|
||||
|
||||
# Feel free to edit the default values as you need.
|
||||
|
||||
# You may set environment variables with
|
||||
# @putenv "key" "val"
|
||||
# Environment variables cannot be used in the options, however!
|
||||
|
||||
cc = gcc
|
||||
|
||||
# example of how to setup a cross-compiler:
|
||||
arm.linux.gcc.exe = "arm-linux-gcc"
|
||||
arm.linux.gcc.linkerexe = "arm-linux-gcc"
|
||||
|
||||
cs:partial
|
||||
|
||||
path="$lib/core"
|
||||
path="$lib/pure"
|
||||
path="$lib/pure/collections"
|
||||
path="$lib/pure/concurrency"
|
||||
path="$lib/impure"
|
||||
path="$lib/wrappers"
|
||||
# path="$lib/wrappers/cairo"
|
||||
# path="$lib/wrappers/gtk"
|
||||
# path="$lib/wrappers/lua"
|
||||
# path="$lib/wrappers/opengl"
|
||||
path="$lib/wrappers/pcre"
|
||||
path="$lib/wrappers/readline"
|
||||
path="$lib/wrappers/sdl"
|
||||
# path="$lib/wrappers/x11"
|
||||
path="$lib/wrappers/zip"
|
||||
path="$lib/wrappers/libffi"
|
||||
path="$lib/windows"
|
||||
path="$lib/posix"
|
||||
path="$lib/js"
|
||||
path="$lib/pure/unidecode"
|
||||
|
||||
@if nimbabel:
|
||||
babelpath="$home/.babel/pkgs/"
|
||||
@end
|
||||
|
||||
@if release or quick:
|
||||
obj_checks:off
|
||||
field_checks:off
|
||||
range_checks:off
|
||||
bound_checks:off
|
||||
overflow_checks:off
|
||||
assertions:off
|
||||
stacktrace:off
|
||||
linetrace:off
|
||||
debugger:off
|
||||
line_dir:off
|
||||
dead_code_elim:on
|
||||
@end
|
||||
|
||||
@if release:
|
||||
opt:speed
|
||||
@end
|
||||
|
||||
# additional options always passed to the compiler:
|
||||
--parallel_build: "0" # 0 to auto-detect number of processors
|
||||
|
||||
hint[LineTooLong]=off
|
||||
#hint[XDeclaredButNotUsed]=off
|
||||
|
||||
@if unix:
|
||||
@if not bsd:
|
||||
# -fopenmp
|
||||
gcc.options.linker = "-ldl"
|
||||
gpp.options.linker = "-ldl"
|
||||
clang.options.linker = "-ldl"
|
||||
tcc.options.linker = "-ldl"
|
||||
@end
|
||||
@if bsd or haiku:
|
||||
# BSD got posix_spawn only recently, so we deactivate it for osproc:
|
||||
define:useFork
|
||||
# at least NetBSD has problems with thread local storage:
|
||||
tlsEmulation:on
|
||||
@end
|
||||
@end
|
||||
|
||||
# Configuration for the Intel C/C++ compiler:
|
||||
@if windows:
|
||||
icl.options.speed = "/Ox /arch:SSE2"
|
||||
icl.options.always = "/nologo"
|
||||
@end
|
||||
|
||||
# Configuration for the GNU C/C++ compiler:
|
||||
@if windows:
|
||||
#gcc.path = r"$nimrod\dist\mingw\bin"
|
||||
@if gcc:
|
||||
tlsEmulation:on
|
||||
@end
|
||||
@end
|
||||
|
||||
@if macosx:
|
||||
cc = clang
|
||||
tlsEmulation:on
|
||||
gcc.options.always = "-w -fasm-blocks"
|
||||
gpp.options.always = "-w -fasm-blocks -fpermissive"
|
||||
@else:
|
||||
gcc.options.always = "-w"
|
||||
gpp.options.always = "-w -fpermissive"
|
||||
@end
|
||||
|
||||
gcc.options.speed = "-O3 -fno-strict-aliasing"
|
||||
gcc.options.size = "-Os"
|
||||
gcc.options.debug = "-g3 -O0"
|
||||
|
||||
gpp.options.speed = "-O3 -fno-strict-aliasing"
|
||||
gpp.options.size = "-Os"
|
||||
gpp.options.debug = "-g3 -O0"
|
||||
#passl = "-pg"
|
||||
|
||||
# Configuration for the LLVM GCC compiler:
|
||||
llvm_gcc.options.debug = "-g"
|
||||
llvm_gcc.options.always = "-w"
|
||||
llvm_gcc.options.speed = "-O2"
|
||||
llvm_gcc.options.size = "-Os"
|
||||
|
||||
# Configuration for the LLVM CLang compiler:
|
||||
clang.options.debug = "-g"
|
||||
clang.options.always = "-w"
|
||||
clang.options.speed = "-O3"
|
||||
clang.options.size = "-Os"
|
||||
|
||||
# Configuration for the Visual C/C++ compiler:
|
||||
vcc.options.linker = "/DEBUG /Zi /Fd\"$projectName.pdb\" /F33554432" # set the stack size to 8 MB
|
||||
vcc.options.debug = "/Zi /Fd\"$projectName.pdb\""
|
||||
vcc.options.always = "/nologo"
|
||||
vcc.options.speed = "/Ox /arch:SSE2"
|
||||
vcc.options.size = "/O1"
|
||||
|
||||
# Configuration for the Digital Mars C/C++ compiler:
|
||||
@if windows:
|
||||
dmc.path = r"$nimrod\dist\dm\bin"
|
||||
@end
|
||||
|
||||
# Configuration for the Tiny C Compiler:
|
||||
tcc.options.always = "-w"
|
||||
@@ -79,7 +79,8 @@ Advanced options:
|
||||
select the GC to use; default is 'refc'
|
||||
--index:on|off turn index file generation on|off
|
||||
--putenv:key=value set an environment variable
|
||||
--babelPath:PATH add a path for Babel support
|
||||
--NimblePath:PATH add a path for Nimble support
|
||||
--noNimblePath deactivate the Nimble path
|
||||
--excludePath:PATH exclude a path from the list of search paths
|
||||
--dynlibOverride:SYMBOL marks SYMBOL so that dynlib:SYMBOL
|
||||
has no effect and can be statically linked instead;
|
||||
|
||||
@@ -4,7 +4,7 @@ import
|
||||
|
||||
var f = newFileStream(paramStr(1), fmRead)
|
||||
if f != nil:
|
||||
var p: TCfgParser
|
||||
var p: CfgParser
|
||||
open(p, f, paramStr(1))
|
||||
while true:
|
||||
var e = next(p)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# Nimrod Benchmark tool
|
||||
# Nim Benchmark tool
|
||||
# (c) Copyright 2012 Dominik Picheta
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
@@ -15,7 +15,7 @@ type
|
||||
|
||||
proc compileBench(file: string) =
|
||||
## Compiles ``file``.
|
||||
doAssert(execCmdEx("nimrod c -d:release " & file).exitCode == QuitSuccess)
|
||||
doAssert(execCmdEx("nim c -d:release " & file).exitCode == QuitSuccess)
|
||||
|
||||
proc runBench(file: string): TBenchResult =
|
||||
## Runs ``file`` and returns info on how long it took to run.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
cmd: "nimrod js --hints:on $options $file"
|
||||
cmd: "nim js --hints:on $options $file"
|
||||
"""
|
||||
|
||||
# This file tests the JavaScript generator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
#
|
||||
# The Nimrod Tester
|
||||
# The Nim Tester
|
||||
# (c) Copyright 2014 Andreas Rumpf
|
||||
#
|
||||
# Look at license.txt for more info.
|
||||
|
||||
@@ -9,7 +9,7 @@ type
|
||||
TRunMode = enum
|
||||
ProcRun, CaasRun, SymbolProcRun
|
||||
|
||||
TNimrodSession* = object
|
||||
NimSession* = object
|
||||
nim: PProcess # Holds the open process for CaasRun sessions, nil otherwise.
|
||||
mode: TRunMode # Stores the type of run mode the session was started with.
|
||||
lastOutput: string # Preserves the last output, needed for ProcRun mode.
|
||||
@@ -26,15 +26,15 @@ const
|
||||
|
||||
var
|
||||
TesterDir = getAppDir() / ".."
|
||||
NimrodBin = TesterDir / "../bin/nimrod"
|
||||
NimBin = TesterDir / "../bin/nim"
|
||||
|
||||
proc replaceVars(session: var TNimrodSession, text: string): string =
|
||||
proc replaceVars(session: var NimSession, text: string): string =
|
||||
result = text.replace(filenameReplaceVar, session.filename)
|
||||
result = result.replace(moduleReplaceVar, session.modname)
|
||||
result = result.replace(silentReplaceVar, silentReplaceText)
|
||||
|
||||
proc startNimrodSession(project, script: string, mode: TRunMode):
|
||||
TNimrodSession =
|
||||
NimSession =
|
||||
let (dir, name, ext) = project.splitFile
|
||||
result.mode = mode
|
||||
result.lastOutput = ""
|
||||
@@ -50,10 +50,10 @@ proc startNimrodSession(project, script: string, mode: TRunMode):
|
||||
removeDir(nimcacheDir / "nimcache")
|
||||
|
||||
if mode == CaasRun:
|
||||
result.nim = startProcess(NimrodBin, workingDir = dir,
|
||||
result.nim = startProcess(NimBin, workingDir = dir,
|
||||
args = ["serve", "--server.type:stdin", name])
|
||||
|
||||
proc doCaasCommand(session: var TNimrodSession, command: string): string =
|
||||
proc doCaasCommand(session: var NimSession, command: string): string =
|
||||
assert session.mode == CaasRun
|
||||
session.nim.inputStream.write(session.replaceVars(command) & "\n")
|
||||
session.nim.inputStream.flush
|
||||
@@ -69,11 +69,11 @@ proc doCaasCommand(session: var TNimrodSession, command: string): string =
|
||||
result = "FAILED TO EXECUTE: " & command & "\n" & result
|
||||
break
|
||||
|
||||
proc doProcCommand(session: var TNimrodSession, command: string): string =
|
||||
proc doProcCommand(session: var NimSession, command: string): string =
|
||||
assert session.mode == ProcRun or session.mode == SymbolProcRun
|
||||
except: result = "FAILED TO EXECUTE: " & command & "\n" & result
|
||||
var
|
||||
process = startProcess(NimrodBin, args = session.replaceVars(command).split)
|
||||
process = startProcess(NimBin, args = session.replaceVars(command).split)
|
||||
stream = outputStream(process)
|
||||
line = TaintedString("")
|
||||
|
||||
@@ -84,7 +84,7 @@ proc doProcCommand(session: var TNimrodSession, command: string): string =
|
||||
|
||||
process.close()
|
||||
|
||||
proc doCommand(session: var TNimrodSession, command: string) =
|
||||
proc doCommand(session: var NimSession, command: string) =
|
||||
if session.mode == CaasRun:
|
||||
if not session.nim.running:
|
||||
session.lastOutput = "FAILED TO EXECUTE: " & command & "\n" &
|
||||
@@ -102,7 +102,7 @@ proc doCommand(session: var TNimrodSession, command: string) =
|
||||
session.lastOutput = doProcCommand(session,
|
||||
command & " " & session.filename)
|
||||
|
||||
proc close(session: var TNimrodSession) {.destructor.} =
|
||||
proc close(session: var NimSession) {.destructor.} =
|
||||
if session.mode == CaasRun:
|
||||
session.nim.close
|
||||
|
||||
|
||||
@@ -192,9 +192,9 @@ proc jsTests(r: var TResults, cat: Category, options: string) =
|
||||
# testSpec(r, t, options)
|
||||
|
||||
proc findMainFile(dir: string): string =
|
||||
# finds the file belonging to ".nimrod.cfg"; if there is no such file
|
||||
# finds the file belonging to ".nim.cfg"; if there is no such file
|
||||
# it returns the some ".nim" file if there is only one:
|
||||
const cfgExt = ".nimrod.cfg"
|
||||
const cfgExt = ".nim.cfg"
|
||||
result = ""
|
||||
var nimFiles = 0
|
||||
for kind, file in os.walkDir(dir):
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## This program verifies Nimrod against the testcases.
|
||||
## This program verifies Nim against the testcases.
|
||||
|
||||
import
|
||||
parseutils, strutils, pegs, os, osproc, streams, parsecfg, json,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
[Project]
|
||||
Name: "Nimrod"
|
||||
Title: "Nimrod Programming Language"
|
||||
Name: "Nim"
|
||||
Title: "Nim Programming Language"
|
||||
Logo: "efficient, expressive, elegant"
|
||||
Authors: "Andreas Rumpf and contributors"
|
||||
|
||||
[Links]
|
||||
# Underscores are replaced with a space.
|
||||
# Everything after ; is the ID
|
||||
User_Forum: "http://forum.nimrod-code.org;link_forum"
|
||||
User_Forum: "http://forum.nim-lang.org;link_forum"
|
||||
Aporia_IDE: "https://github.com/nimrod-code/Aporia;link_aporia"
|
||||
Nimbuild: "http://build.nimrod-code.org;link_nimbuild"
|
||||
Nimbuild: "http://build.nim-lang.org;link_nimbuild"
|
||||
|
||||
[Tabs]
|
||||
# Menu entry: filename
|
||||
@@ -36,9 +36,9 @@ UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson."""
|
||||
|
||||
|
||||
[Documentation]
|
||||
doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters"
|
||||
doc: "endb;intern;apis;lib;manual;tut1;tut2;nimc;overview;filters"
|
||||
doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt"
|
||||
pdf: "manual;lib;tut1;tut2;nimrodc;niminst;gc"
|
||||
pdf: "manual;lib;tut1;tut2;nimc;niminst;gc"
|
||||
srcdoc2: "system.nim;impure/graphics;wrappers/sdl"
|
||||
srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned"
|
||||
srcdoc2: "impure/re;pure/sockets;pure/typetraits"
|
||||
Reference in New Issue
Block a user