mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
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:
@@ -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
|
||||
image: freebsd/latest
|
||||
packages:
|
||||
@@ -8,9 +10,12 @@ packages:
|
||||
- devel/sfml
|
||||
- www/node
|
||||
- devel/gmake
|
||||
|
||||
|
||||
sources:
|
||||
- https://github.com/nim-lang/Nim
|
||||
environment:
|
||||
NIM_TESTAMENT_BATCH: "0_1"
|
||||
CC: /usr/bin/clang
|
||||
tasks:
|
||||
- setup: |
|
||||
@@ -20,9 +25,10 @@ tasks:
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim c -r tools/ci_testresults.nim
|
||||
nim r tools/ci_testresults.nim
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
packages:
|
||||
@@ -10,6 +10,8 @@ packages:
|
||||
- sfml
|
||||
- sdl2
|
||||
- libffi
|
||||
|
||||
|
||||
sources:
|
||||
- https://github.com/nim-lang/Nim
|
||||
environment:
|
||||
@@ -20,9 +22,10 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c koch
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
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
|
||||
packages:
|
||||
@@ -10,6 +10,8 @@ packages:
|
||||
- sfml
|
||||
- sdl2
|
||||
- libffi
|
||||
|
||||
|
||||
sources:
|
||||
- https://github.com/nim-lang/Nim
|
||||
environment:
|
||||
@@ -20,9 +22,10 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c koch
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## Dead code elimination (=DCE) for IC.
|
||||
|
||||
import intsets, tables
|
||||
import std/[intsets, tables]
|
||||
import ".." / [ast, options, lineinfos, types]
|
||||
|
||||
import packed_ast, ic, bitabs
|
||||
|
||||
@@ -9,24 +9,24 @@
|
||||
|
||||
# Unfortunately this cannot be a module yet:
|
||||
#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,
|
||||
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
||||
lgamma
|
||||
|
||||
when declared(math.copySign):
|
||||
from math import copySign
|
||||
from std/math import copySign
|
||||
|
||||
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
|
||||
|
||||
from md5 import getMD5
|
||||
from times import cpuTime
|
||||
from hashes import hash
|
||||
from osproc import nil
|
||||
from std/md5 import getMD5
|
||||
from std/times import cpuTime
|
||||
from std/hashes import hash
|
||||
from std/osproc import nil
|
||||
|
||||
from sighashes import symBodyDigest
|
||||
|
||||
|
||||
4
koch.nim
4
koch.nim
@@ -534,7 +534,9 @@ proc runCI(cmd: string) =
|
||||
echo "runCI: ", cmd
|
||||
echo hostInfo()
|
||||
# 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:
|
||||
execFold("debugging test", "nim r tests/stdlib/tosproc.nim")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
##[
|
||||
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.
|
||||
|
||||
## 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"""
|
||||
## 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:
|
||||
- https://github.com/nim-lang/Nim
|
||||
environment:
|
||||
@@ -36,9 +28,10 @@ tasks:
|
||||
set -e
|
||||
cd Nim
|
||||
. ci/funs.sh && nimBuildCsourcesIfNeeded
|
||||
$nim_csources c koch
|
||||
$nim_csources c --skipUserCfg --skipParentCfg koch
|
||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||
- test: |
|
||||
set -e
|
||||
cd Nim
|
||||
if ! ./koch runCI; then
|
||||
nim r tools/ci_testresults.nim
|
||||
@@ -51,14 +44,39 @@ triggers:
|
||||
"""
|
||||
|
||||
proc main()=
|
||||
let dir = ".builds"
|
||||
# not too large to be resource friendly, refs bug #17107
|
||||
let num = 2
|
||||
# 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_*`
|
||||
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:
|
||||
let file = fmt".builds/openbsd_{i}.yml"
|
||||
let code = genCIopenbsd(i, num)
|
||||
writeFile(file, code)
|
||||
writeFile(dir / fmt"openbsd_{i}.yml", genCiBsd(headerOpenbsd, i, num))
|
||||
writeFile(dir / "freebsd.yml", genCiBsd(headerFreebsd, 0, 1))
|
||||
|
||||
when isMainModule:
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user