easyblock = 'EB_GCC'

name = 'GCCcore'
version = '10.3.0'

homepage = 'https://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

source_urls = [
    'https://ftpmirror.gnu.org/gnu/gcc/gcc-%(version)s',  # GCC auto-resolving HTTP mirror
    'https://ftpmirror.gnu.org/gnu/gmp',  # idem for GMP
    'https://ftpmirror.gnu.org/gnu/mpfr',  # idem for MPFR
    'https://ftpmirror.gnu.org/gnu/mpc',  # idem for MPC
    '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
    'https://sourceware.org/pub/newlib/',  # for newlib
    'https://github.com/MentorEmbedded/nvptx-tools/archive',  # for nvptx-tools
]
sources = [
    'gcc-%(version)s.tar.gz',
    'gmp-6.2.1.tar.bz2',
    'mpfr-4.1.0.tar.bz2',
    'mpc-1.2.1.tar.gz',
    'isl-0.23.tar.bz2',
    'newlib-4.1.0.tar.gz',
    {'download_filename': 'd0524fb.tar.gz', 'filename': 'nvptx-tools-20210115.tar.gz'},
]
patches = [
    'GCCcore-6.2.0-fix-find-isl.patch',
    'GCCcore-9.3.0_gmp-c99.patch',
    'GCCcore-9.3.0_nvptx_sm_35_default.patch',
    'gcc-10.3.0_fix-ice-in-tsubst.patch',
    'GCCcore-9.x-11.x_fix-unsigned-fpe-traps.patch',
    'GCCcore-10_libsanitizer_linux-5.12.patch',
]
checksums = [
    '8fcf994811ad4e5c7ac908e8cf62af2c1982319e5551f62ae72016064dacdf16',  # gcc-10.3.0.tar.gz
    'eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c',  # gmp-6.2.1.tar.bz2
    'feced2d430dd5a97805fa289fed3fc8ff2b094c02d05287fd6133e7f1f0ec926',  # mpfr-4.1.0.tar.bz2
    '17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459',  # mpc-1.2.1.tar.gz
    'c58922c14ae7d0791a77932f377840890f19bc486b653fa64eba7f1026fb214d',  # isl-0.23.tar.bz2
    'f296e372f51324224d387cc116dc37a6bd397198756746f93a2b02e9a5d40154',  # newlib-4.1.0.tar.gz
    '466abe1cef9cf294318ecb3c221593356f7a9e1674be987d576bc70d833d84a2',  # nvptx-tools-20210115.tar.gz
    '5ad909606d17d851c6ad629b4fddb6c1621844218b8d139fed18c502a7696c68',  # GCCcore-6.2.0-fix-find-isl.patch
    '0e135e1cc7cec701beea9d7d17a61bab34cfd496b4b555930016b98db99f922e',  # GCCcore-9.3.0_gmp-c99.patch
    '8d8b9834a570b5789d47296311953b6307d4427957a73e102de43cca7a6fa108',  # GCCcore-9.3.0_nvptx_sm_35_default.patch
    '74e6e019458aa2feb36ae3c45f45e164725ca5edd66f4fe9f873c8ee78c35717',  # gcc-10.3.0_fix-ice-in-tsubst.patch
    '03a2e4aeda78d398edd680d6a1ba842b8ceb29c126ebb7fe2e3541ddfe4fbed4',  # GCCcore-9.x-11.x_fix-unsigned-fpe-traps.patch
]

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

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

withisl = True
withnvptx = True

# Perl is only required when building with NVPTX support
if withnvptx:
    osdependencies = ['perl']

moduleclass = 'compiler'
