// file      : INSTALL.cli
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

"
Unless you specifically only need the \c{build2} build system and not the
complete \c{build2} toolchain, you should use the \c{build2-toolchain}
distribution instead.

The instructions outlined below are essentially a summary of the first three
steps of the manual bootstrap process described in \c{build2-toolchain}. Also,
below we only show commands for UNIX-like operating systems. For other
operating systems and for more details on each step, refer to the
\c{build2-toolchain} documentation.

\c{build2} requires a C++14 compiler. GCC 4.8 or later and Clang 3.4 or later
are known to work. The build system is self-hosted, which means that unless
you have obtained a pre-built binary from somewhere else, you will need to
bootstrap it. To accomplish this, we use the \c{bootstrap.sh} shell script (or
equivalent batch files for Windows) found in the root directory of the
\c{build2} distribution. The following is the recommended sequence of steps:


\dl|

\li|\b{0. Prerequisites}\n

Get \c{libbutl} (normally from the same place where you got \c{build2}) and
place it \i{inside} \c{build2}, so that you have:

\
build2-X.Y.Z
|
`-- libbutl-X.Y.Z
\

|

\li|\n\b{1. Bootstrap, Phase 1}\n

First, we build a minimal build system using \c{bootstrap.sh} (run
\c{bootstrap.sh -h} for options):

\
$ cd build2-X.Y.Z
$ ./bootstrap.sh g++

$ build2/b-boot --version
\

|

\li|\n\b{2. Bootstrap, Phase 2}\n

Then, we rebuild the build system with the result of Phase 1 linking
libraries statically.

\
$ build2/b-boot config.cxx=g++ config.bin.lib=static
$ mv build2/b build2/b-boot

$ build2/b-boot --version
\

|

\li|\n\b{3. Build and Install}\n

Finally, we configure, build, and optionally install the \"final\" version
using shared libraries:

\
$ build2/b-boot configure         \
  config.cxx=g++                  \
  config.cc.coptions=-O3          \
  config.bin.rpath=/usr/local/lib \
  config.install.root=/usr/local  \
  config.install.sudo=sudo

$ build2/b-boot
\

I you are not planning to install the result you can omit the
\c{config.install.*} values as well as \c{.rpath}.


To install:

\
$ build2/b-boot install
$ which b
$ b --version
\

To uninstall:

\
$ b uninstall
$ which b
\

||
"