Debian and Ubuntu

Easiest way to install build2 package (b, bpkg and bdep tools) is to wget and install masterspline-archive-keyring package, but at first I will show manual repository setup.

Create file /etc/apt/sources.list.d/masterspline.list with content like:

# this is for debian testing
deb [signed-by=/usr/share/keyrings/masterspline-archive-keyring.gpg] https://packages.masterspline.eu/debian/ testing main
# for debian stable
#deb [signed-by=/usr/share/keyrings/masterspline-archive-keyring.gpg] https://packages.masterspline.eu/debian/ stable main
# for ubuntu trusty
#deb [signed-by=/usr/share/keyrings/masterspline-archive-keyring.gpg] https://packages.masterspline.eu/ubuntu/ trusty main
# ...

Create preferences file in /etc/apt/preferences.d/masterspline.pref with content:

Package: *
Pin: origin packages.masterspline.eu
Pin-Priority: 100

and put gpg keys to /usr/share/keyrings/ (this keyring will be used only for packages from https://packages.masterspline.eu/) except ubuntu trusty and xenial (it need key added globally).

# all except trusty
sudo wget -O /usr/share/keyrings/masterspline-archive-keyring.gpg https://packages.masterspline.eu/masterspline-archive-keyring.gpg
# for trusty
# sudo wget -O- https://packages.masterspline.eu/masterspline-archive-keyring.gpg | apt-key add -

Now You can install build2-toolchain

sudo apt update
sudo apt install build2-toolchain

Next batch setup

Debian stretch (stable)

sudo apt update
sudo apt install -y wget apt-transport-https
wget https://packages.masterspline.eu/debian/pool/main/m/masterspline-archive-keyring/masterspline-archive-keyring_2-9stretch.1_all.deb
sudo dpkg -i masterspline-archive-keyring_2-9stretch.1_all.deb
sudo apt update
sudo apt install -y build2-toolchain

Debian buster (testing) and sid (unstable)

sudo apt update
sudo apt install -y wget apt-transport-https
wget https://packages.masterspline.eu/debian/pool/main/m/masterspline-archive-keyring/masterspline-archive-keyring_2-10buster.1_all.deb
sudo dpkg -i masterspline-archive-keyring_2-10buster.1_all.deb
sudo apt update
sudo apt install -y build2-toolchain

Ubuntu bionic (18.04) and newer

sudo apt update
sudo apt install -y wget apt-transport-https
wget https://packages.masterspline.eu/ubuntu/pool/main/m/masterspline-archive-keyring/masterspline-archive-keyring_2-18bionic.1_all.deb
sudo dpkg -i masterspline-archive-keyring_2-18bionic.1_all.deb
sudo apt update
sudo apt install -y build2-toolchain

Ubuntu xenial (16.04)

Xenial need libstdc++ from ppa:ubuntu-toolchain-r/test, so it also will be added. Also xenial do not support [signed-by=/usr/share/keyrings/masterspline-archive-keyring.gpg] in sources.list, so keys will be added as globally trusted.

sudo apt update
sudo apt install -y wget apt-transport-https
wget https://packages.masterspline.eu/ubuntu/pool/main/m/masterspline-archive-keyring/masterspline-archive-keyring_2-16xenial.1_all.deb
sudo dpkg -i masterspline-archive-keyring_2-16xenial.1_all.deb
sudo gpg --keyring /usr/share/keyrings/masterspline-archive-keyring.gpg --export packages@masterspline.eu | apt-key add -

# add ppa:ubuntu-toolchain-r/test repository
apt install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test # here <Enter> need to be pressed

sudo apt update
sudo apt install -y build2-toolchain

Ubuntu trusty (14.04)

Trusty need libstdc++ from ppa:ubuntu-toolchain-r/test, so it also will be added. Also trusty do not support [signed-by=/usr/share/keyrings/masterspline-archive-keyring.gpg] in sources.list, so keys will be added as globally trusted.

sudo apt update
sudo apt install -y wget apt-transport-https
wget https://packages.masterspline.eu/ubuntu/pool/main/m/masterspline-archive-keyring/masterspline-archive-keyring_2-14trusty.1_all.deb
sudo dpkg -i masterspline-archive-keyring_2-14trusty.1_all.deb
sudo gpg --keyring /usr/share/keyrings/masterspline-archive-keyring.gpg --export packages@masterspline.eu | apt-key add -

# add ppa:ubuntu-toolchain-r/test repository
apt install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt update
sudo apt install -y build2-toolchain