Created
September 16, 2014 10:48
-
-
Save sinefabula/9fbed00315f5338c9fb1 to your computer and use it in GitHub Desktop.
Script to install devtoolset-based environment on Scientific Linux 6.x or CentOS 6.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script is written for Scientific Linux 6.5 x64. | |
# Should also work for CentOS 6.5 (see below). | |
# It should be run as root (not sure whether sudo is fine also). | |
# boost version to install | |
boost_ver="1.55.0" | |
# This is only required with "Minimal" installation variant (for wget & scp). | |
yum -y install wget openssh-clients | |
# download devtoolset repo information and store it | |
wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo | |
# for CentOS we need to import a GPG key: | |
if [ -f /etc/centos-release ] | |
then | |
rpm --import http://www.scientificlinux.org/documentation/gpg/RPM-GPG-KEY-cern | |
fi | |
# update repositories and software (not necessary) | |
yum -y update | |
# install devtoolset and needed packages (-y means don't ask user) | |
yum -y install \ | |
devtoolset-2-binutils devtoolset-2-gcc-c++ devtoolset-2-gdb \ | |
cmake subversion subversion-devel \ | |
zlib-devel readline-devel ncurses-devel libpcap-devel openssl-devel lua-devel | |
# download boost | |
boost_name="boost_$(echo $boost_ver | sed -e 's/\./_/g')" | |
wget http://downloads.sourceforge.net/project/boost/boost/$boost_ver/$boost_name.tar.gz | |
# unpack boost | |
tar -zxf $boost_name.tar.gz | |
cd $boost_name | |
# change building environment to the one provided by devtoolset | |
source /opt/rh/devtoolset-2/enable | |
export X_SCLS="`scl enable devtoolset-2 'echo $X_SCLS'`" | |
# build and install boost | |
# prepare | |
./bootstrap.sh | |
# build and install; this command can take quite long | |
./b2 install link=static threading=multi variant=release cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment