Created
June 10, 2012 19:04
-
-
Save mtholder/2906937 to your computer and use it in GitHub Desktop.
Script to download and build gcc 4.7 and its dependencies on mac - it took about 40 minutes on my machine (and the "make check" in the gcc build failed for lack of an "autogen" script"), but the compiler seems to work.
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 | |
# You might want to modify the first line to specify your own install location. | |
# In theory the rest should not need tweaking... | |
export GCC_PREFIX="$HOME/gcc4.7" | |
# Hopefully, you can tweak these as they get out of date, but the download URL's | |
# may not be stable to text substitution. | |
GMP_DOWNLOAD_VERSION=gmp-5.0.5 | |
MPFR_DOWNLOAD_VERSION=mpfr-3.1.0 | |
MPC_DOWNLOAD_VERSION=mpc-0.8.2 | |
GCC_DOWNLOAD_VERSION=gcc-4.7.1-RC-20120606 | |
# Downloads, builds, then install gmp, mpfr, mpc, and gcc 4.7 to GCC_PREFIX | |
set -x | |
echo "Thanks to http://solarianprogrammer.com/2012/02/20/living-on-the-edge-building-gcc-4-7-on-mac-osx-lion/ !" | |
export PATH="${GCC_PREFIX}/bin:${PATH}" | |
export LD_LIBRARY_PATH="${GCC_PREFIX}/lib:${LD_LIBRARY_PATH}" | |
export DYLD_LIBRARY_PATH="${GCC_PREFIX}/lib:${DYLD_LIBRARY_PATH}" | |
if ! test -d "${GMP_DOWNLOAD_VERSION}" | |
then | |
if ! test -f "${GMP_DOWNLOAD_VERSION}.tar.bz2" | |
then | |
wget "ftp://ftp.gmplib.org/pub/$GMP_DOWNLOAD_VERSION/${GMP_DOWNLOAD_VERSION}.tar.bz2" || exit | |
tar xfjv "${GMP_DOWNLOAD_VERSION}.tar.bz2" || exit | |
fi | |
fi | |
mkdir "${GMP_DOWNLOAD_VERSION}/build" | |
cd "${GMP_DOWNLOAD_VERSION}/build" || exit | |
../configure --prefix="${GCC_PREFIX}" || exit | |
make -j4 || exit | |
make check || exit | |
make install || exit | |
cd - | |
if ! test -d "${MPFR_DOWNLOAD_VERSION}" | |
then | |
if ! test -f "${MPFR_DOWNLOAD_VERSION}.tar.gz" | |
then | |
wget "http://www.mpfr.org/mpfr-current/${MPFR_DOWNLOAD_VERSION}.tar.gz" || exit | |
tar xfvz "${MPFR_DOWNLOAD_VERSION}.tar.gz" || exit | |
fi | |
fi | |
mkdir "${MPFR_DOWNLOAD_VERSION}/build" | |
cd "${MPFR_DOWNLOAD_VERSION}/build" || exit | |
../configure --prefix="${GCC_PREFIX}" --with-gmp="${GCC_PREFIX}" || exit | |
make -j4 || exit | |
make check || exit | |
make install || exit | |
cd - | |
if ! test -d "${MPC_DOWNLOAD_VERSION}" | |
then | |
if ! test -f "${MPC_DOWNLOAD_VERSION}.tar.gz" | |
then | |
wget "http://www.multiprecision.org/mpc/download/${MPC_DOWNLOAD_VERSION}.tar.gz" || exit | |
tar xfvz "${MPC_DOWNLOAD_VERSION}.tar.gz" || exit | |
fi | |
fi | |
mkdir "${MPC_DOWNLOAD_VERSION}/build" | |
cd "${MPC_DOWNLOAD_VERSION}/build" || exit | |
../configure --prefix="${GCC_PREFIX}" --with-gmp="${GCC_PREFIX}" --with-mpfr="${GCC_PREFIX}" || exit | |
make -j4 || exit | |
make check || exit | |
make install || exit | |
cd - | |
if ! test -d "${GCC_DOWNLOAD_VERSION}" | |
then | |
if ! test -f "${GCC_DOWNLOAD_VERSION}.tar.bz2" | |
then | |
wget "wget http://gcc.petsads.us/snapshots/4.7.1-RC-20120606/${GCC_DOWNLOAD_VERSION}.tar.bz2" || exit | |
tar xfvj "${GCC_DOWNLOAD_VERSION}.tar.gz" || exit | |
fi | |
fi | |
mkdir "${GCC_DOWNLOAD_VERSION}/build" | |
cd "${GCC_DOWNLOAD_VERSION}/build" || exit | |
../configure --prefix="${GCC_PREFIX}" --with-gmp="${GCC_PREFIX}" --with-mpfr="${GCC_PREFIX}" --with-mpc="${GCC_PREFIX}" --enable-checking=release --enable-languages=c,c++,fortran || exit | |
make -j4 || exit | |
make check || exit | |
make install || exit | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it always output the message
--11:57:42-- ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2
=> `gmp-5.0.5.tar.bz2'
Resolving ftp.gmplib.org... 130.237.222.241
Connecting to ftp.gmplib.org[130.237.222.241]:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/gmp-5.0.5 ... done.
==> PORT ...
Invalid PORT.
Retrying.