easyblock = 'ConfigureMake'

name = 'libpng'
version = '1.6.18'

homepage = 'http://www.libpng.org/pub/png/libpng.html'
description = "libpng is the official PNG reference library"

toolchain = {'name': 'goolf', 'version': '1.7.20'}
toolchainopts = {'pic': True}

source_urls = [SOURCEFORGE_SOURCE]
sources = [SOURCELOWER_TAR_GZ]

dependencies = [('zlib', '1.2.8')]

configopts = "--with-pic"

majminver = ''.join(version.split('.')[:2])
sanity_check_paths = {
    'files': ['include/pngconf.h', 'include/png.h', 'include/pnglibconf.h', 'lib/libpng.a',
              'lib/libpng.%s' % SHLIB_EXT, 'lib/libpng%s.a' % majminver, 'lib/libpng%s.%s' % (majminver, SHLIB_EXT)],
    'dirs': ['bin', 'include/libpng%s' % majminver, 'share/man'],
}

moduleclass = 'lib'
