Add 469782 to NEWS
[valgrind.git] / drd / scripts / download-and-build-gcc
blob025a507cf67e7b7e46887eaf57bc452c41a9eb64
1 #!/usr/bin/env bash
3 GCC_VERSION=13.3.0
4 if [[ $# -eq 1 ]] ; then
5 GCC_VERSION=$1
6 fi
7 GIT_REPO=git://gcc.gnu.org/git/gcc.git
8 SRCDIR=${HOME}/software
9 REPO=${SRCDIR}/gcc
10 BUILD=${REPO}/build
11 PREFIX=${HOME}/gcc-${GCC_VERSION}
12 export LC_ALL=C
14 OS=$(uname -s)
15 case ${OS} in
16 Linux)
17 MAKE=make
18 MAKEFLAGS="-j$(($(grep -c '^processor' /proc/cpuinfo) + 1))"
20 FreeBSD)
21 MAKE=gmake
22 MAKEFLAGS="-j$(sysctl -n hw.ncpu)"
25 echo "Unsupported OS"
26 exit 1
28 esac
29 export MAKEFLAGS
31 rm -rf ${BUILD} || exit $?
32 rm -rf ${PREFIX} || exit $?
33 mkdir -p ${SRCDIR} || exit $?
35 if [ ! -e ${REPO} ]; then
36 cd ${SRCDIR}
37 git clone ${GIT_REPO} gcc || exit $?
40 cd ${REPO} || exit $?
41 git checkout releases/gcc-${GCC_VERSION} || exit $?
42 rm -rf gmp* mpfr* mpc* isl* || exit $?
43 ./contrib/download_prerequisites
44 mkdir -p ${BUILD} || exit $?
45 cd ${BUILD} || exit $?
47 ${REPO}/configure \
48 --disable-linux-futex \
49 --disable-mudflap \
50 --disable-nls \
51 --enable-languages=c,c++ \
52 --enable-threads=posix \
53 --enable-tls \
54 --prefix=$PREFIX
56 time { ${MAKE} -s && ${MAKE} -s install; }