Skip to content

Commit

Permalink
install-deps.sh: use gcc-7 on trusty
Browse files Browse the repository at this point in the history
* always install gcc-7 on trusty
* point g++ to g++-7 if not yet

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Dec 5, 2017
1 parent 246c27a commit 24d0f93
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion install-deps.sh
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24d0f93

Please sign in to comment.