easyblock = 'EB_GCC'

name = 'GCCcore'
version = '6.3.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 = SYSTEM

local_mpfr_version = '3.1.5'

source_urls = [
    # GCC auto-resolving HTTP mirror
#    'https://ftp.gnu.org/gnu/gcc/gcc-%(version)/',
    'http://ftpmirror.gnu.org/gcc/gcc-%(version)s',
#    'https://ftp.gnu.org/gnu/gmp/',
    'http://ftpmirror.gnu.org/gmp',  # idem for GMP
#    'https://ftp.gnu.org/gnu/mpfr/',
    'http://ftpmirror.gnu.org/mpfr',  # idem for MPFR
#    'https://ftp.gnu.org/gnu/mpc/',
    'http://www.multiprecision.org/mpc/download',  # MPC official
    'http://ftp.nluug.nl/languages/gcc/infrastructure/',
#    'ftp://gcc.gnu.org/pub/gcc/infrastructure/',  # GCC dependencies
    'http://gcc.cybermirror.org/infrastructure/',  # HTTP mirror for GCC dependencies
    'http://isl.gforge.inria.fr/',  # original HTTP source for ISL
]

sources = [
    'gcc-%(version)s.tar.bz2',
    'gmp-6.1.1.tar.bz2',
    'mpfr-%s.tar.bz2' % local_mpfr_version,
    'mpc-1.0.3.tar.gz',
    'isl-0.16.1.tar.bz2',
]

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

patches = [
    ('mpfr-%s-allpatches-20161215.patch' %
     local_mpfr_version,
     '../mpfr-%s' %
     local_mpfr_version),
    'GCCcore-6.2.0-fix-find-isl.patch',
]

checksums = [
    'f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f',     # gcc-6.3.0.tar.bz2
    'a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6',     # gmp-6.1.1.tar.bz2
    'ca498c1c7a74dd37a576f353312d1e68d490978de4395fa28f1cbd46a364e658',     # mpfr-3.1.5.tar.gz
    '617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3',     # mpc-1.0.3.tar.gz
    '412538bb65c799ac98e17e8cfcdacbb257a57362acfaaff254b0fcae970126d2',     # isl-0.16.1.tar.bz2
    '1621958531f863152971a55bfc6fd7bebbf55b390ac472d1168c8b87efc56cc9', #mpfr-3.1.5-allpatches-20161215.patch
    '5ad909606d17d851c6ad629b4fddb6c1621844218b8d139fed18c502a7696c68', #GCCcore-6.2.0-fix-find-isl.patch
]

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

modextravars = {
    'CC': '%(installdir)s/bin/gcc',
    'CXX': '%(installdir)s/bin/g++',
    'F90': '%(installdir)s/bin/gfortran',
    'F77': '%(installdir)s/bin/gfortran',
    'FC': '%(installdir)s/bin/gfortran',
    'F9X': '%(installdir)s/bin/gfortran',
    'OPTFLAGS': '-O3 -march=native',
    'DEBUGFLAGS': '-O0 -g'
}

withisl = True

moduleclass = 'compiler'
