easyblock = 'EB_GCC'

name = 'GCCcore'
version = '5.4.0'

homepage = 'http://gcc.gnu.org/'
description = """The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada,
 as well as libraries for these languages (libstdc++, libgcj,...)."""

toolchain = {'name': 'system', 'version': ''}

mpfr_version = '3.1.4'

source_urls = [
    # GCC auto-resolving HTTP mirror
    'http://ftpmirror.gnu.org/gcc/gcc-%(version)s',
    'http://ftpmirror.gnu.org/gmp',  # idem for GMP
    'http://ftpmirror.gnu.org/mpfr',  # idem for MPFR
    'http://www.multiprecision.org/mpc/download',  # MPC official
    #'ftp://gcc.gnu.org/pub/gcc/infrastructure/',  # GCC dependencies
    'https://mirror.math.princeton.edu/pub/gcc/infrastructure/',
    'http://gcc.cybermirror.org/infrastructure/',  # HTTP mirror for GCC dependencies
]

sources = [
    'gcc-%(version)s.tar.bz2',
    'gmp-6.1.0.tar.bz2',
    'mpfr-%s.tar.gz' % mpfr_version,
    'mpc-1.0.3.tar.gz',
    'isl-0.15.tar.bz2',
]

patches = [
    ('mpfr-%s-allpatches-20160601.patch' %
     mpfr_version,
     '../mpfr-%s' %
     mpfr_version)]

builddependencies = [
    ('binutils', '2.26'),
    ('M4', '1.4.18'),
]

checksums = [
    '4c626ac2a83ef30dfb9260e6f59c2b30',     # gcc-5.4.0.tar.bz2
    '86ee6e54ebfc4a90b643a65e402c4048',     # gmp-6.1.0.tar.bz2
    '482ab3c120ffc959f631b4ba9ec59a46',     # mpfr-3.1.4.tar.gz
    'd6a1d5f8ddea3abd2cc3e98f58352d26',     # mpc-1.0.3.tar.gz
    '8428efbbc6f6e2810ce5c1ba73ecf98c',     # isl-0.15.tar.bz2
    '22164533561142b70fda09af4e775acc',     # mpfr-3.1.4-allpatches-20150603.patch
]

languages = ['c', 'c++', 'fortran']

withisl = True

# building GCC sometimes fails if make parallelism is too high, so let's
# limit it
maxparallel = 4

moduleclass = 'compiler'
