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 \
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