bring back std/ prefix within compiler and ensure it works in bootstrap + bsd (#17902)
* [WIP] bring back std/ prefix within compiler and ensure it works in bootstrap + bsd * refs https://github.com/nim-lang/Nim/pull/16282#discussion_r616846863 * sounds very similar to https://github.com/nim-lang/Nim/pull/14291 * more: vmops * update tools/ci_generate.nim * auto-generate freebsd.yml as well, to avoid duplication with openbsd.yml * cleanup * undo temporary CI removal
This commit is contained in:
parent
d32ab61e61
commit
d0485e326a
7 changed files with 65 additions and 33 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
## DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
|
||||||
|
|
||||||
# see https://man.sr.ht/builds.sr.ht/compatibility.md#freebsd
|
# see https://man.sr.ht/builds.sr.ht/compatibility.md#freebsd
|
||||||
image: freebsd/latest
|
image: freebsd/latest
|
||||||
packages:
|
packages:
|
||||||
|
|
@ -8,9 +10,12 @@ packages:
|
||||||
- devel/sfml
|
- devel/sfml
|
||||||
- www/node
|
- www/node
|
||||||
- devel/gmake
|
- devel/gmake
|
||||||
|
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/nim-lang/Nim
|
- https://github.com/nim-lang/Nim
|
||||||
environment:
|
environment:
|
||||||
|
NIM_TESTAMENT_BATCH: "0_1"
|
||||||
CC: /usr/bin/clang
|
CC: /usr/bin/clang
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
|
|
@ -20,9 +25,10 @@ tasks:
|
||||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
- test: |
|
- test: |
|
||||||
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
if ! ./koch runCI; then
|
if ! ./koch runCI; then
|
||||||
nim c -r tools/ci_testresults.nim
|
nim r tools/ci_testresults.nim
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
triggers:
|
triggers:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
## do not edit directly; auto-generated by `nim r tools/ci_generate.nim`
|
## DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
|
||||||
|
|
||||||
image: openbsd/latest
|
image: openbsd/latest
|
||||||
packages:
|
packages:
|
||||||
|
|
@ -10,6 +10,8 @@ packages:
|
||||||
- sfml
|
- sfml
|
||||||
- sdl2
|
- sdl2
|
||||||
- libffi
|
- libffi
|
||||||
|
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/nim-lang/Nim
|
- https://github.com/nim-lang/Nim
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -20,9 +22,10 @@ tasks:
|
||||||
set -e
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||||
$nim_csources c koch
|
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
- test: |
|
- test: |
|
||||||
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
if ! ./koch runCI; then
|
if ! ./koch runCI; then
|
||||||
nim r tools/ci_testresults.nim
|
nim r tools/ci_testresults.nim
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
## do not edit directly; auto-generated by `nim r tools/ci_generate.nim`
|
## DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
|
||||||
|
|
||||||
image: openbsd/latest
|
image: openbsd/latest
|
||||||
packages:
|
packages:
|
||||||
|
|
@ -10,6 +10,8 @@ packages:
|
||||||
- sfml
|
- sfml
|
||||||
- sdl2
|
- sdl2
|
||||||
- libffi
|
- libffi
|
||||||
|
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/nim-lang/Nim
|
- https://github.com/nim-lang/Nim
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -20,9 +22,10 @@ tasks:
|
||||||
set -e
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||||
$nim_csources c koch
|
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
- test: |
|
- test: |
|
||||||
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
if ! ./koch runCI; then
|
if ! ./koch runCI; then
|
||||||
nim r tools/ci_testresults.nim
|
nim r tools/ci_testresults.nim
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## Dead code elimination (=DCE) for IC.
|
## Dead code elimination (=DCE) for IC.
|
||||||
|
|
||||||
import intsets, tables
|
import std/[intsets, tables]
|
||||||
import ".." / [ast, options, lineinfos, types]
|
import ".." / [ast, options, lineinfos, types]
|
||||||
|
|
||||||
import packed_ast, ic, bitabs
|
import packed_ast, ic, bitabs
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,24 @@
|
||||||
|
|
||||||
# Unfortunately this cannot be a module yet:
|
# Unfortunately this cannot be a module yet:
|
||||||
#import vmdeps, vm
|
#import vmdeps, vm
|
||||||
from math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
from std/math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
||||||
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
||||||
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
||||||
lgamma
|
lgamma
|
||||||
|
|
||||||
when declared(math.copySign):
|
when declared(math.copySign):
|
||||||
from math import copySign
|
from std/math import copySign
|
||||||
|
|
||||||
when declared(math.signbit):
|
when declared(math.signbit):
|
||||||
from math import signbit
|
from std/math import signbit
|
||||||
|
|
||||||
from os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
|
from std/os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
|
||||||
getAppFilename, raiseOSError, osLastError
|
getAppFilename, raiseOSError, osLastError
|
||||||
|
|
||||||
from md5 import getMD5
|
from std/md5 import getMD5
|
||||||
from times import cpuTime
|
from std/times import cpuTime
|
||||||
from hashes import hash
|
from std/hashes import hash
|
||||||
from osproc import nil
|
from std/osproc import nil
|
||||||
|
|
||||||
from sighashes import symBodyDigest
|
from sighashes import symBodyDigest
|
||||||
|
|
||||||
|
|
|
||||||
4
koch.nim
4
koch.nim
|
|
@ -534,7 +534,9 @@ proc runCI(cmd: string) =
|
||||||
echo "runCI: ", cmd
|
echo "runCI: ", cmd
|
||||||
echo hostInfo()
|
echo hostInfo()
|
||||||
# boot without -d:nimHasLibFFI to make sure this still works
|
# boot without -d:nimHasLibFFI to make sure this still works
|
||||||
kochExecFold("Boot in release mode", "boot -d:release -d:nimStrictMode")
|
# `--lib:lib` is needed for bootstrap on openbsd, for reasons described in
|
||||||
|
# https://github.com/nim-lang/Nim/pull/14291 (`getAppFilename` bugsfor older nim on openbsd).
|
||||||
|
kochExecFold("Boot in release mode", "boot -d:release -d:nimStrictMode --lib:lib")
|
||||||
|
|
||||||
when false: # debugging: when you need to run only 1 test in CI, use something like this:
|
when false: # debugging: when you need to run only 1 test in CI, use something like this:
|
||||||
execFold("debugging test", "nim r tests/stdlib/tosproc.nim")
|
execFold("debugging test", "nim r tests/stdlib/tosproc.nim")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
##[
|
##[
|
||||||
avoid code duplication in CI pipelines.
|
avoid code duplication in CI pipelines.
|
||||||
For now, this is only used for openbsd, but there is a lot of other code
|
For now, this is only used for openbsd + freebsd, but there is a lot of other code
|
||||||
duplication that could be removed.
|
duplication that could be removed.
|
||||||
|
|
||||||
## usage
|
## usage
|
||||||
|
|
@ -10,22 +10,14 @@ nim r tools/ci_generate.nim
|
||||||
```
|
```
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/strformat
|
import std/[strformat, os]
|
||||||
|
|
||||||
proc genCIopenbsd(batch: int, num: int): string =
|
proc genCiBsd(header: string, batch: int, num: int): string =
|
||||||
result = fmt"""
|
result = fmt"""
|
||||||
## do not edit directly; auto-generated by `nim r tools/ci_generate.nim`
|
## DO NO EDIT DIRECTLY! auto-generated by `nim r tools/ci_generate.nim`
|
||||||
|
|
||||||
|
{header}
|
||||||
|
|
||||||
image: openbsd/latest
|
|
||||||
packages:
|
|
||||||
- gmake
|
|
||||||
- sqlite3
|
|
||||||
- node
|
|
||||||
- boehm-gc
|
|
||||||
- pcre
|
|
||||||
- sfml
|
|
||||||
- sdl2
|
|
||||||
- libffi
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/nim-lang/Nim
|
- https://github.com/nim-lang/Nim
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -36,9 +28,10 @@ tasks:
|
||||||
set -e
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||||
$nim_csources c koch
|
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
- test: |
|
- test: |
|
||||||
|
set -e
|
||||||
cd Nim
|
cd Nim
|
||||||
if ! ./koch runCI; then
|
if ! ./koch runCI; then
|
||||||
nim r tools/ci_testresults.nim
|
nim r tools/ci_testresults.nim
|
||||||
|
|
@ -51,14 +44,39 @@ triggers:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc main()=
|
proc main()=
|
||||||
|
let dir = ".builds"
|
||||||
# not too large to be resource friendly, refs bug #17107
|
# not too large to be resource friendly, refs bug #17107
|
||||||
let num = 2
|
let num = 2
|
||||||
# if you reduce this, make sure to remove files that shouldn't be generated,
|
# if you reduce this, make sure to remove files that shouldn't be generated,
|
||||||
# or better, do the cleanup logic here e.g.: `rm .builds/openbsd_*`
|
# or better, do the cleanup logic here e.g.: `rm .builds/openbsd_*`
|
||||||
|
let headerFreebsd = """
|
||||||
|
# see https://man.sr.ht/builds.sr.ht/compatibility.md#freebsd
|
||||||
|
image: freebsd/latest
|
||||||
|
packages:
|
||||||
|
- databases/sqlite3
|
||||||
|
- devel/boehm-gc-threaded
|
||||||
|
- devel/pcre
|
||||||
|
- devel/sdl20
|
||||||
|
- devel/sfml
|
||||||
|
- www/node
|
||||||
|
- devel/gmake
|
||||||
|
"""
|
||||||
|
|
||||||
|
let headerOpenbsd = """
|
||||||
|
image: openbsd/latest
|
||||||
|
packages:
|
||||||
|
- gmake
|
||||||
|
- sqlite3
|
||||||
|
- node
|
||||||
|
- boehm-gc
|
||||||
|
- pcre
|
||||||
|
- sfml
|
||||||
|
- sdl2
|
||||||
|
- libffi
|
||||||
|
"""
|
||||||
for i in 0..<num:
|
for i in 0..<num:
|
||||||
let file = fmt".builds/openbsd_{i}.yml"
|
writeFile(dir / fmt"openbsd_{i}.yml", genCiBsd(headerOpenbsd, i, num))
|
||||||
let code = genCIopenbsd(i, num)
|
writeFile(dir / "freebsd.yml", genCiBsd(headerFreebsd, 0, 1))
|
||||||
writeFile(file, code)
|
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue