new variable: QUICK_AND_DIRTY_COMPILER

Don't re-build the Nim compiler multiple times until we get identical
binaries, like "build_all.sh" does. Don't build any tools either.

Disabled by default, useful in CI.
This commit is contained in:
Ștefan Talpalaru 2020-12-26 16:04:58 +01:00 committed by zah
parent e2de003ce6
commit f7c732a150
4 changed files with 42 additions and 7 deletions

View File

@ -138,6 +138,13 @@ Link PCRE, defaults to 1.
`make LINK_PCRE=0`
### QUICK_AND_DIRTY_COMPILER
Skip multiple Nim compiler bootstrap iterations and tool building. Useful in
CI. Defaults to 0.
`make QUICK_AND_DIRTY_COMPILER=1 build-nim`
## Make targets
### build

View File

@ -76,6 +76,7 @@ build-nim: | sanity-checks
CC=$(CC) \
MAKE="$(MAKE)" \
ARCH_OVERRIDE=$(ARCH_OVERRIDE) \
QUICK_AND_DIRTY_COMPILER=$(QUICK_AND_DIRTY_COMPILER) \
"$(CURDIR)/$(BUILD_SYSTEM_DIR)/scripts/build_nim.sh" "$(NIM_DIR)" ../Nim-csources ../nimble "$(CI_CACHE)"
#- for each submodule, delete checked out files (that might prevent a fresh checkout); skip dotfiles

View File

@ -112,3 +112,6 @@ CI_CACHE :=
# bypassing the shipped Nim, usually for testing new Nim devel versions
USE_SYSTEM_NIM := 0
# Skip multiple bootstrap iterations and tool building.
QUICK_AND_DIRTY_COMPILER := 0

View File

@ -31,6 +31,7 @@ CI_CACHE="$4"
UCPU=""
[[ "$ARCH_OVERRIDE" == "x86" ]] && UCPU="ucpu=i686"
[[ -z "$NIM_BUILD_MSG" ]] && NIM_BUILD_MSG="Building the Nim compiler"
[[ -z "$QUICK_AND_DIRTY_COMPILER" ]] && QUICK_AND_DIRTY_COMPILER=0
# Windows detection
if uname | grep -qiE "mingw|msys"; then
@ -119,13 +120,36 @@ build_nim() {
else
cp -a bin/nim bin/nim_csources
fi
sed \
-e 's/koch$/--warnings:off --hints:off koch/' \
-e 's/koch boot/koch boot --warnings:off --hints:off/' \
-e 's/koch tools/koch --stable tools --warnings:off --hints:off/' \
build_all.sh > build_all_custom.sh
sh build_all_custom.sh
rm build_all_custom.sh
if [[ "$QUICK_AND_DIRTY_COMPILER" == "0" ]]; then
sed \
-e 's/koch$/--warnings:off --hints:off koch/' \
-e 's/koch boot/koch boot --warnings:off --hints:off/' \
-e 's/koch tools/koch --stable tools --warnings:off --hints:off/' \
build_all.sh > build_all_custom.sh
sh build_all_custom.sh
rm build_all_custom.sh
else
# Don't re-build it multiple times until we get identical
# binaries, like "build_all.sh" does. Don't build any tools
# either. This is all about build speed, not developer comfort.
bin/nim_csources \
c \
--compileOnly \
--nimcache:nimcache \
-d:release \
--skipUserCfg \
--skipParentCfg \
--warnings:off \
--hints:off \
compiler/nim.nim
bin/nim_csources \
jsonscript \
--nimcache:nimcache \
--skipUserCfg \
--skipParentCfg \
compiler/nim.nim
cp -a compiler/nim bin/nim
fi
# record the last commit's timestamp
git log --pretty=format:%cd -n 1 ${GIT_TIMESTAMP_ARG} > bin/timestamp