# Based off the 2017 version by John Dey jfdey@fredhutch.org
# https://github.com/easybuilders/easybuild-easyconfigs/pull/5085

easyblock = 'Tarball'

name = 'texlive'
version = '20210325'
local_version_year = version[:4]

homepage = 'https://tug.org'
description = """TeX is a typesetting language. Instead of visually formatting your text, you enter your manuscript
 text intertwined with TeX commands in a plain text file. You then run TeX to produce formatted output, such as a
 PDF file. Thus, in contrast to standard word processors, your document is a separate file that does not pretend to
 be a representation of the final typeset output, and so can be easily edited and manipulated."""

toolchain = {'name': 'GCC', 'version': '10.2.0'}

source_urls = [
    'ftp://tug.org/texlive/historic/%s/' % local_version_year,
    'https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/%s/' % local_version_year,
]
sources = [
    {
        'download_filename': 'install-tl-unx.tar.gz',
        'filename': 'install-tl-unx-%(version)s.tar.gz',
    }
]
checksums = ['74eac0855e1e40c8db4f28b24ef354bd7263c1f76031bdc02b52156b572b7a1d']

dependencies = [
    ('X11', '20201008'),
    ('libpng', '1.6.37'),
    ('libGLU', '9.0.1'),
    ('Perl', '5.32.0'),
    ('HarfBuzz', '2.6.7'),
    #('poppler', '21.06.1'),
    ('cairo', '1.16.0'),
    ('fontconfig', '2.13.92'),
    ('zlib', '1.2.11'),
    ('graphite2', '1.3.14'),
]

postinstallcmds = [
    'echo "TEXDIR         %(installdir)s/" > %(installdir)s/texlive.profile && '
    'echo "TEXMFLOCAL     %(installdir)s/texmf-local" >> %(installdir)s/texlive.profile && '
    'echo "TEXMFSYSCONFIG %(installdir)s/texmf-config" >> %(installdir)s/texlive.profile && '
    'echo "TEXMFSYSVAR    %(installdir)s/texmf-var" >> %(installdir)s/texlive.profile && '
    '%(builddir)s/install-tl-%(version)s/install-tl -profile %(installdir)s/texlive.profile'
    ' -repository ' + 'https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/%s/tlnet-final' % local_version_year
]

modextrapaths = {
    'PATH': 'bin/%(arch)s-linux',
    'INFOPATH': 'texmf-dist/doc/info',
    'MANPATH': 'texmf-dist/doc/man',
}
modextravars = {
    'TEXMFHOME': '%(installdir)s/texmf-dist'
}

sanity_check_paths = {
    'files': ['bin/%(arch)s-linux/tex', 'bin/%(arch)s-linux/latex'],
    'dirs': ['bin/%(arch)s-linux', 'texmf-dist'],
}

moduleclass = 'devel'

