forked from gambit/gambit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-gnu-gcc-osx
executable file
·63 lines (49 loc) · 1.35 KB
/
install-gnu-gcc-osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
# This shell script can be used to install the GNU gcc compiler on an
# OS X computer. The GNU gcc compiler is usually better at compiling
# C code produced by the Gambit Scheme compiler than the clang (LLVM)
# compiler which is provided with Apple's Xcode.
# After executing:
#
# ./install-gnu-gcc-osx
#
# you should add this line to your ~/.profile and ~/.bashrc files:
#
# export PATH=/usr/gcc-4.8.0/bin:$PATH
# The shell script assumes that the homebrew system (see
# http://http://mxcl.github.com/homebrew) and Xcode have been
# installed.
VERSION=4.8.0
PREFIX=/usr/gcc-$VERSION
LANGUAGES=c,c++
MAKE="make -j 4"
brew_path() { brew info $1 | head -n3 | tail -n1 | cut -d' ' -f1; }
# Prerequisites
brew install gmp
brew install mpfr
brew install libmpc
# Download & install the latest GCC
mkdir temp-gcc
cd temp-gcc
wget ftp://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.gz
tar xfz gcc-$VERSION.tar.gz
#rm gcc-$VERSION.tar.gz
cd gcc-$VERSION
mkdir build
cd build
../configure \
--prefix=$PREFIX \
--with-gmp=$(brew_path gmp) \
--with-mpfr=$(brew_path mpfr) \
--with-mpc=$(brew_path libmpc) \
--enable-languages=$LANGUAGES \
--with-system-zlib \
--enable-stage1-checking \
--enable-plugin \
--enable-lto \
--disable-multilib
$MAKE bootstrap
sudo mkdir -p $PREFIX
sudo make install
cd ../../..
rm -r temp-gcc