easyblock = 'ConfigureMake'

name = 'git'
version = '2.16.1'

homepage = 'http://git-scm.com/'
description = """Git is a free and open source distributed version control system designed
to handle everything from small to very large projects with speed and efficiency."""

toolchain = {'name': 'foss', 'version': '2017b'}

sources = ['v%(version)s.tar.gz']
source_urls = ['https://github.com/git/git/archive']
checksums = ['e3f13e3c86981f64b1920749c07be11841bbf5a3434ec9b5611959dfd7c7398e']

builddependencies = [
    ('Autotools', '20170619'),
]
dependencies = [
    ('cURL', '7.60.0'),
    ('expat', '2.2.5'),
    ('gettext', '0.19.8.1', '-libxml2-2.9.7'),
    ('Perl', '5.26.1'),
]

# asciidoc and xmlto are required for git man/doc build
osdependencies = ['asciidoc', 'xmlto']

preconfigopts = 'make configure && '

# Work around git build system bug.  If LIBS contains -lpthread, then configure
# will not append -lpthread to LDFLAGS, but Makefile ignores LIBS.
configopts = "--with-perl=${EBROOTPERL}/bin/perl --enable-pthreads='-lpthread'"

# required to also install documentation
buildopts = "doc"
installopts = "install-doc"

sanity_check_paths = {
    'files': ['bin/git'],
    'dirs': ['share/man'],
}

moduleclass = 'tools'
