# GNU C Compiler
# Mostly required to support languages different then C or C++
[buildout]
extends =
  ../m4/buildout.cfg
  ../gmp/buildout.cfg
  ../zip/buildout.cfg

parts =
  gcc

[mpfr]
recipe = slapos.recipe.cmmi
url = http://www.mpfr.org/mpfr-3.0.1/mpfr-3.0.1.tar.bz2
md5sum = bfbecb2eacb6d48432ead5cfc3f7390a
configure-options =
  --with-gmp=${gmp:location}
  --disable-static
environment =
  LDFLAGS=-Wl,-rpath=${gmp:location}/lib

[mpc]
recipe = slapos.recipe.cmmi
url = http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz
md5sum = 0d6acab8d214bd7d1fbbc593e83dd00d
configure-options =
  --with-gmp=${gmp:location}
  --with-mpfr=${mpfr:location}
  --disable-static
environment =
  LDFLAGS=-Wl,-rpath=${mpfr:location}/lib -Wl,-rpath=${gmp:location}/lib

[ppl]
recipe = slapos.recipe.cmmi
# we should use version 0.10.x for gcc-4.5
url = http://bugseng.com/products/ppl/download/ftp/releases/0.10.2/ppl-0.10.2.tar.bz2
md5sum = 5667111f53150618b0fa522ffc53fc3e
configure-options =
  --with-libgmp-prefix=${gmp:location}
  --with-libgmpxx-prefix=${gmp:location}
  --disable-static
environment =
  PATH=${m4:location}/bin:%(PATH)s
  LDFLAGS=-Wl,-rpath=${gmp:location}/lib

[cloog-ppl]
recipe = slapos.recipe.cmmi
url = ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-0.15.9.tar.gz
md5sum = 806e001d1b1a6b130069ff6274900af5
configure-options =
  --with-gmp=${gmp:location}
  --with-ppl=${ppl:location}
  --disable-static
environment =
  PATH=${m4:location}/bin:%(PATH)s
  LDFLAGS=-Wl,-rpath=${gmp:location}/lib -Wl,-rpath=${ppl:location}/lib

[gcc-download]
hack-revision = ${gcc-interconnection-workaround:hack-revision}
recipe = hexagonit.recipe.download
url = http://www.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.5.3/gcc-4.5.3.tar.bz2
md5sum = 8e0b5c12212e185f3e4383106bfa9cc6
strip-top-level-dir = True
destination = ${gcc-source:location}

[gcc-source]
hack-revision = ${gcc-interconnection-workaround:hack-revision}
location = ${buildout:parts-directory}/${:_buildout_section_name_}

[gcc-multiarch.patch]
recipe = hexagonit.recipe.download
md5sum = 819e6735270c8a432b0512b49f40219f
url = ${:_profile_base_location_}/${:filename}
filename = ${:_buildout_section_name_}
download-only = true

[gcc]
hack-revision = ${gcc-interconnection-workaround:hack-revision}
depends =
  ${gcc-download:location}
recipe = slapos.recipe.cmmi
path = ${gcc-source:location}
md5sum = bb3265edf0fa7543e50cedb93e04e427
patches =
  ${gcc-multiarch.patch:location}/${gcc-multiarch.patch:filename}
patch-options = -p2
configure-command = make clean \\; make distclean \\; ./configure
configure-options =
  --disable-bootstrap
  --enable-languages="c,c++"
  --disable-multilib
  --with-gmp=${gmp:location}
  --with-mpfr=${mpfr:location}
  --with-mpc=${mpc:location}
  --with-ppl=${ppl:location}
  --with-cloog=${cloog-ppl:location}
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
environment =
  LDFLAGS=-Wl,-rpath=${mpfr:location}/lib -Wl,-rpath=${gmp:location}/lib -Wl,-rpath=${mpc:location}/lib -Wl,-rpath=${ppl:location}/lib -Wl,-rpath=${cloog-ppl:location}/lib
# make install does not work when several core are used
make-targets = install -j1

[gcc-minimal]
recipe = slapos.recipe.cmmi
url = http://ftp.gnu.org/gnu/gcc/gcc-4.5.4/gcc-core-4.5.4.tar.bz2
md5sum = ca62e442629a9a7710f5d797bf1b521c
patches =
  ${gcc-multiarch.patch:location}/${gcc-multiarch.patch:filename}
patch-options = -p2
configure-options =
  --disable-bootstrap
  --enable-languages=c
  --disable-multilib
  --with-gmp=${gmp:location}
  --with-mpfr=${mpfr:location}
  --with-mpc=${mpc:location}
  --without-ppl
  --without-cloog
environment =
  LDFLAGS=-Wl,-rpath=${mpfr:location}/lib -Wl,-rpath=${gmp:location}/lib -Wl,-rpath=${mpc:location}/lib
# make install does not work when several core are used
make-targets = install -j1

[gcc-interconnection-workaround]
# gcc parts are interconnected, so buildout is not capable to clean them up
# until gcc will be simplified by using more robust build recipe (like
# slapos.recipe.build) each time any of parts which reuses this one gets updated
# the hack-revision have to be increased
hack-revision = 2