From 69c3c7577e4bb385539a0876b8258adbf9bf695c Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Thu, 30 Jan 2020 15:09:50 -0800 Subject: [PATCH] build_all.sh: building csources 5X faster thanks to make -j --- build_all.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build_all.sh b/build_all.sh index e22facc1b22b..73af90429cb0 100644 --- a/build_all.sh +++ b/build_all.sh @@ -1,6 +1,7 @@ #! /bin/sh -# build development version of the compiler; can be rerun safely +# build development version of the compiler; can be rerun safely. +# arguments can be passed, eg `--cpu i386` set -u # error on undefined variables set -e # exit on first error @@ -10,14 +11,20 @@ echo_run(){ "$@" } -[ -d csources ] || echo_run git clone --depth 1 https://github.com/nim-lang/csources.git +[ -d csources ] || echo_run git clone -q --depth 1 https://github.com/nim-lang/csources.git nim_csources=bin/nim_csources build_nim_csources(){ ## avoid changing dir in case of failure ( - echo_run cd csources - echo_run sh build.sh $@ + if [[ $# -ne 0 ]]; then + # some args were passed (eg: `--cpu i386`), need to call build.sh + echo_run cd csources + echo_run sh build.sh $@ + else + # no args, use multhreaded (5X faster on 16 cores: 10s instead of 50s) + echo_run make -C csources -j + fi ) # keep $nim_csources in case needed to investigate bootstrap issues # without having to rebuild from csources