make bootstrapping more robust for people who have Nim inside /usr/bin (#13855)
This commit is contained in:
parent
87e6b88f3b
commit
2b3b24a804
1 changed files with 31 additions and 29 deletions
|
|
@ -102,34 +102,35 @@ proc staticWalkDirImpl(path: string, relative: bool): PNode =
|
||||||
result.add newTree(nkTupleConstr, newIntNode(nkIntLit, k.ord),
|
result.add newTree(nkTupleConstr, newIntNode(nkIntLit, k.ord),
|
||||||
newStrNode(nkStrLit, f))
|
newStrNode(nkStrLit, f))
|
||||||
|
|
||||||
from std / compilesettings import SingleValueSetting, MultipleValueSetting
|
when defined(nimHasInvariant):
|
||||||
|
from std / compilesettings import SingleValueSetting, MultipleValueSetting
|
||||||
|
|
||||||
proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
|
proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
|
||||||
case SingleValueSetting(switch)
|
case SingleValueSetting(switch)
|
||||||
of arguments: result = conf.arguments
|
of arguments: result = conf.arguments
|
||||||
of outFile: result = conf.outFile.string
|
of outFile: result = conf.outFile.string
|
||||||
of outDir: result = conf.outDir.string
|
of outDir: result = conf.outDir.string
|
||||||
of nimcacheDir: result = conf.nimcacheDir.string
|
of nimcacheDir: result = conf.nimcacheDir.string
|
||||||
of projectName: result = conf.projectName
|
of projectName: result = conf.projectName
|
||||||
of projectPath: result = conf.projectPath.string
|
of projectPath: result = conf.projectPath.string
|
||||||
of projectFull: result = conf.projectFull.string
|
of projectFull: result = conf.projectFull.string
|
||||||
of command: result = conf.command
|
of command: result = conf.command
|
||||||
of commandLine: result = conf.commandLine
|
of commandLine: result = conf.commandLine
|
||||||
of linkOptions: result = conf.linkOptions
|
of linkOptions: result = conf.linkOptions
|
||||||
of compileOptions: result = conf.compileOptions
|
of compileOptions: result = conf.compileOptions
|
||||||
of ccompilerPath: result = conf.cCompilerPath
|
of ccompilerPath: result = conf.cCompilerPath
|
||||||
|
|
||||||
proc querySettingSeqImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): seq[string] =
|
proc querySettingSeqImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): seq[string] =
|
||||||
template copySeq(field: untyped): untyped =
|
template copySeq(field: untyped): untyped =
|
||||||
for i in field: result.add i.string
|
for i in field: result.add i.string
|
||||||
|
|
||||||
case MultipleValueSetting(switch)
|
case MultipleValueSetting(switch)
|
||||||
of nimblePaths: copySeq(conf.nimblePaths)
|
of nimblePaths: copySeq(conf.nimblePaths)
|
||||||
of searchPaths: copySeq(conf.searchPaths)
|
of searchPaths: copySeq(conf.searchPaths)
|
||||||
of lazyPaths: copySeq(conf.lazyPaths)
|
of lazyPaths: copySeq(conf.lazyPaths)
|
||||||
of commandArgs: result = conf.commandArgs
|
of commandArgs: result = conf.commandArgs
|
||||||
of cincludes: copySeq(conf.cIncludes)
|
of cincludes: copySeq(conf.cIncludes)
|
||||||
of clibs: copySeq(conf.cLibs)
|
of clibs: copySeq(conf.cLibs)
|
||||||
|
|
||||||
proc registerAdditionalOps*(c: PCtx) =
|
proc registerAdditionalOps*(c: PCtx) =
|
||||||
proc gorgeExWrapper(a: VmArgs) =
|
proc gorgeExWrapper(a: VmArgs) =
|
||||||
|
|
@ -181,10 +182,11 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
systemop getCurrentException
|
systemop getCurrentException
|
||||||
registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} =
|
registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} =
|
||||||
setResult(a, staticWalkDirImpl(getString(a, 0), getBool(a, 1)))
|
setResult(a, staticWalkDirImpl(getString(a, 0), getBool(a, 1)))
|
||||||
registerCallback c, "stdlib.compilesettings.querySetting", proc (a: VmArgs) {.nimcall.} =
|
when defined(nimHasInvariant):
|
||||||
setResult(a, querySettingImpl(a, c.config, getInt(a, 0)))
|
registerCallback c, "stdlib.compilesettings.querySetting", proc (a: VmArgs) {.nimcall.} =
|
||||||
registerCallback c, "stdlib.compilesettings.querySettingSeq", proc (a: VmArgs) {.nimcall.} =
|
setResult(a, querySettingImpl(a, c.config, getInt(a, 0)))
|
||||||
setResult(a, querySettingSeqImpl(a, c.config, getInt(a, 0)))
|
registerCallback c, "stdlib.compilesettings.querySettingSeq", proc (a: VmArgs) {.nimcall.} =
|
||||||
|
setResult(a, querySettingSeqImpl(a, c.config, getInt(a, 0)))
|
||||||
|
|
||||||
if defined(nimsuggest) or c.config.cmd == cmdCheck:
|
if defined(nimsuggest) or c.config.cmd == cmdCheck:
|
||||||
discard "don't run staticExec for 'nim suggest'"
|
discard "don't run staticExec for 'nim suggest'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue