add build_all.sh to allow 1-liner to build development version of the compiler (#8546)

This commit is contained in:
Timothee Cour 2018-08-08 07:47:17 -07:00 • committed by Andreas Rumpf
commit 506418ef53
2 changed files with 39 additions and 8 deletions

22
build_all.sh Normal file
View file

@ -0,0 +1,22 @@
#! /bin/sh
# build development version of the compiler; can be rerun safely
set -u # error on undefined variables
set -e # exit on first error
echo_run(){
echo "\n$@"
"$@"
}
[ -d csources ] || echo_run git clone --depth 1 https://github.com/nim-lang/csources.git
(
## avoid changing dir in case of failure
echo_run cd csources
echo_run sh build.sh
)
echo_run bin/nim c koch
echo_run ./koch boot -d:release
echo_run ./koch tools # Compile Nimble and other tools.

View file

@ -50,24 +50,33 @@ Next, to build from source you will need:
other distros as well). other distros as well).
Then, if you are on a \*nix system or Windows, the following steps should compile Then, if you are on a \*nix system or Windows, the following steps should compile
Nim from source using ``gcc``, ``git`` and the ``koch`` build tool (in the place Nim from source using ``gcc``, ``git`` and the ``koch`` build tool.
of ``sh build.sh`` you should substitute ``build.bat`` on x86 Windows or
``build64.bat`` on x86_64 Windows):
**Note: The following commands are for the development version of the compiler.** **Note: The following commands are for the development version of the compiler.**
For most users, installing the latest stable version is enough. Check out For most users, installing the latest stable version is enough. Check out
the installation instructions on the website to do so: https://nim-lang.org/install.html. the installation instructions on the website to do so: https://nim-lang.org/install.html.
``` ```
# step 1:
git clone https://github.com/nim-lang/Nim.git git clone https://github.com/nim-lang/Nim.git
cd Nim cd Nim
# step 2 (posix) clones `csources.git`, bootstraps Nim compiler and compiles tools
sh build_all.sh
# step 2 (windows)
git clone --depth 1 https://github.com/nim-lang/csources.git git clone --depth 1 https://github.com/nim-lang/csources.git
cd csources cd csources
sh build.sh # requires `gcc` in your PATH, see also https://nim-lang.org/install_windows.html
cd ../ build.bat # x86 Windows
bin/nim c koch build64.bat # x86_64 Windows
./koch boot -d:release cd ..
./koch tools # Compile Nimble and other tools.
bin\nim c koch
koch boot -d:release
koch tools # Compile Nimble and other tools
# end of step 2 (windows)
``` ```
Finally, once you have finished the build steps (on Windows, Mac or Linux) you Finally, once you have finished the build steps (on Windows, Mac or Linux) you