Skip to content

Instantly share code, notes, and snippets.

@henry0312
Created November 27, 2011 06:17
Show Gist options
  • Save henry0312/1397081 to your computer and use it in GitHub Desktop.
Save henry0312/1397081 to your computer and use it in GitHub Desktop.
Build GCC on Mac OS X Lion
#!/bin/sh
# 初期設定
WORK=$HOME/Builds/GCC
PREFIX=$HOME/local
export PATH="$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
# ソースコードのダウンロード
if [ ! -d $WORK/src ] ; then
mkdir src
fi
cd $WORK/src
curl -O ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.6.3/gcc-4.6.3.tar.bz2
#curl -O ftp://gcc.gnu.org/pub/gdb/releases/gdb-7.3.1.tar.bz2
# ソースコードの展開
cd $WORK
tar xjf src/gcc-*
cd gcc-*
mkdir build
# GCC
## Prerequisites for GCC
## http://gcc.gnu.org/install/prerequisites.html
## Installing GCC: Configuration
## http://gcc.gnu.org/install/configure.html
cd $WORK/gcc-*/build
../configure\
--with-pkgversion='henry - GCC 4.6.3'\
--prefix=$PREFIX/gcc-4.6.3\
--with-local-prefix=$PREFIX/gcc-4.6.3\
--disable-debug\
--disable-multilib\
--enable-threads\
--enable-languages=c,c++,objc,obj-c++\
--enable-stage1-checking\
--disable-nls\
--enable-lto\
--with-system-zlib\
--with-gmp=$PREFIX\
--with-mpfr=$PREFIX\
--with-mpc=$PREFIX\
--enable-fully-dynamic-string
make clean && make bootstrap -j4 && make install-strip
cd $WORK
rm -fr gcc-*
# GDB
## gdb requires special privileges to access Mach ports.
## You will need to codesign the binary. For instructions, see:
## http://sourceware.org/gdb/wiki/BuildingOnDarwin
#../gdb-7.3.1/configure\
# --with-pkgversion='henry - GDB 7.3.1'\
# --prefix=$HOME/local/gcc-4.6.2\
# --with-local-prefix=$HOME/local/gcc-4.6.2\
# --disable-debug
@henry0312
Copy link
Author

Update for gcc-4.6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment