Skip to content

Commit b8ec07f

Browse files
authored
properly fixes #13758 so that import std/macros stays legal (#14291)
* properly fix #12389 * use --lib:lib in koch.nim.cfg instead * third time is the charm
1 parent a39123c commit b8ec07f

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

compiler/nim.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import
2424
idents, lineinfos, cmdlinehelper,
2525
pathutils
2626

27-
from browsers import openDefaultBrowser
27+
from std/browsers import openDefaultBrowser
2828
from nodejs import findNodeJs
2929

3030
when hasTinyCBackend:

koch.nim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ when defined(amd64) and defined(windows) and defined(vcc):
2727
when defined(i386) and defined(windows) and defined(vcc):
2828
{.link: "icons/koch-i386-windows-vcc.res".}
2929

30-
import
31-
os, strutils, parseopt, osproc
30+
import std/[os, strutils, parseopt, osproc]
31+
# Using `std/os` instead of `os` to fail early if config isn't set up properly.
32+
# If this fails with: `Error: cannot open file: std/os`, see
33+
# https://github.com/nim-lang/Nim/pull/14291 for explanation + how to fix.
3234

3335
import tools / kochdocs
3436
import tools / deps
@@ -318,9 +320,13 @@ proc boot(args: string) =
318320
let ret = execCmdEx(nimStart & " --version")
319321
doAssert ret.exitCode == 0
320322
let version = ret.output.splitLines[0]
323+
# remove these when csources get updated
324+
template addLib() =
325+
extraOption.add " --lib:lib" # see https://github.com/nim-lang/Nim/pull/14291
321326
if version.startsWith "Nim Compiler Version 0.19.0":
322327
extraOption.add " -d:nimBoostrapCsources0_19_0"
323-
# remove this when csources get updated
328+
addLib()
329+
elif version.startsWith "Nim Compiler Version 0.20.0": addLib()
324330

325331
# in order to use less memory, we split the build into two steps:
326332
# --compileOnly produces a $project.json file and does not run GCC/Clang.

koch.nim.cfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
-d:booting
1+
-d:booting
2+
3+
@if openbsd:
4+
# because openbsd getAppFilename was broken in v0.20.0
5+
# workaround see https://github.com/nim-lang/Nim/pull/14291
6+
--lib:lib
7+
@end

lib/pure/typetraits.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ since (1, 1):
9393
type StaticParam*[value: static type] = object
9494
## used to wrap a static value in `genericParams`
9595
96-
# NOTE: See https://github.com/nim-lang/Nim/issues/13758 - `import std/macros` does not work on OpenBSD
97-
import macros
96+
import std/macros
9897
9998
macro genericParamsImpl(T: typedesc): untyped =
10099
# auxiliary macro needed, can't do it directly in `genericParams`

0 commit comments

Comments
 (0)