1#!/usr/bin/env bash
2
3# Before install
4
5sudo add-apt-repository -y ppa:kalakris/cmake
6if [ "$STD" = "c++11" ]; then
7    sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
8    if [ "$CXX" = "clang++" ]; then
9        wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
10        sudo add-apt-repository -y "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main"
11    fi
12fi
13sudo apt-get update -qq
14
15# Install
16sudo apt-get install -qq cmake
17if [ "$STD" = "c++11" ] && [ "$CXX" = "g++" ]; then
18    sudo apt-get install -qq gcc-4.8 g++-4.8
19    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90
20    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
21elif [ "$CXX" = "clang++" ]; then
22    sudo apt-get install -qq clang-3.6
23    sudo update-alternatives --install /usr/local/bin/clang   clang   /usr/bin/clang-3.6 90
24    sudo update-alternatives --install /usr/local/bin/clang++ clang++ /usr/bin/clang++-3.6 90
25    export PATH=/usr/local/bin:$PATH
26fi
27