From: Kefu Chai Date: Sun, 12 Nov 2017 05:07:35 +0000 (+0800) Subject: install-deps.sh: use gcc-7 on trusty X-Git-Tag: v13.0.2~867^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18863%2Fhead;p=ceph.git install-deps.sh: use gcc-7 on trusty * always install gcc-7 on trusty * point g++ to g++-7 if not yet Signed-off-by: Kefu Chai --- diff --git a/install-deps.sh b/install-deps.sh index 0c3e9b09c8b..871a9f81a0e 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -26,6 +26,30 @@ function munge_ceph_spec_in { sed -e 's/@//g' -e 's/%bcond_with make_check/%bcond_without make_check/g' < ceph.spec.in > $OUTFILE } +function ensure_decent_gcc { + # point gcc to the one offered by g++-7 if the used one is not + # new enough + old=$(gcc -dumpversion) + new=$1 + if dpkg --compare-versions $old ge 5.1; then + return + fi + + $SUDO update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-\${new} + + $SUDO update-alternatives \ + --install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \ + --slave /usr/bin/g++ g++ /usr/bin/g++-\${old} + + $SUDO update-alternatives --auto gcc + + # cmake uses the latter by default + $SUDO ln -nsf /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc + $SUDO ln -nsf /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++ +} + if [ x`uname`x = xFreeBSDx ]; then $SUDO pkg install -yq \ devel/babeltrace \ @@ -81,7 +105,18 @@ else debian|ubuntu|devuan) echo "Using apt-get to install dependencies" $SUDO apt-get install -y lsb-release devscripts equivs - $SUDO apt-get install -y dpkg-dev gcc + $SUDO apt-get install -y dpkg-dev + case "$VERSION" in + *Trusty*) + $SUDO add-apt-repository ppa:ubuntu-toolchain-r/test + $SUDO apt-get update + $SUDO apt-get install -y gcc-7 + ensure_decent_gcc 7 + ;; + *) + $SUDO apt-get install -y gcc + ;; + esac if ! test -r debian/control ; then echo debian/control is not a readable file exit 1