libint: add debug/fma variants, fix tests for v2.6 (#24665)

This commit is contained in:
Tiziano Müller 2021-07-19 18:28:31 +02:00 committed by GitHub
parent 7845939722
commit d74b296752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,8 @@ class Libint(AutotoolsPackage):
homepage = "https://github.com/evaleev/libint" homepage = "https://github.com/evaleev/libint"
url = "https://github.com/evaleev/libint/archive/v2.1.0.tar.gz" url = "https://github.com/evaleev/libint/archive/v2.1.0.tar.gz"
maintainers = ['dev-zero']
version('2.6.0', sha256='4ae47e8f0b5632c3d2a956469a7920896708e9f0e396ec10071b8181e4c8d9fa') version('2.6.0', sha256='4ae47e8f0b5632c3d2a956469a7920896708e9f0e396ec10071b8181e4c8d9fa')
version('2.4.2', sha256='86dff38065e69a3a51d15cfdc638f766044cb87e5c6682d960c14f9847e2eac3') version('2.4.2', sha256='86dff38065e69a3a51d15cfdc638f766044cb87e5c6682d960c14f9847e2eac3')
version('2.4.1', sha256='0513be124563fdbbc7cd3c7043e221df1bda236a037027ba9343429a27db8ce4') version('2.4.1', sha256='0513be124563fdbbc7cd3c7043e221df1bda236a037027ba9343429a27db8ce4')
@ -37,11 +39,16 @@ class Libint(AutotoolsPackage):
version('1.1.6', sha256='f201b0c621df678cfe8bdf3990796b8976ff194aba357ae398f2f29b0e2985a6') version('1.1.6', sha256='f201b0c621df678cfe8bdf3990796b8976ff194aba357ae398f2f29b0e2985a6')
version('1.1.5', sha256='ec8cd4a4ba1e1a98230165210c293632372f0e573acd878ed62e5ec6f8b6174b') version('1.1.5', sha256='ec8cd4a4ba1e1a98230165210c293632372f0e573acd878ed62e5ec6f8b6174b')
variant('debug', default=False,
description='Enable building with debug symbols')
variant('fortran', default=False, variant('fortran', default=False,
description='Build & install Fortran bindings') description='Build & install Fortran bindings')
variant('tune', default='none', multi=False, variant('tune', default='none', multi=False,
values=TUNE_VARIANTS, values=TUNE_VARIANTS,
description='Tune libint for use with the given package') description='Tune libint for use with the given package')
variant('fma', default=False,
description=('Generate code utilizing FMA'
' (requires capable CPU and recent enough compiler)'))
# Build dependencies # Build dependencies
depends_on('autoconf@2.52:', type='build') depends_on('autoconf@2.52:', type='build')
@ -120,6 +127,9 @@ def configure_args(self):
if '@2.6.0:' in self.spec: if '@2.6.0:' in self.spec:
config_args += ['--with-libint-exportdir=generated'] config_args += ['--with-libint-exportdir=generated']
config_args += self.enable_or_disable(
'debug', activation_value=lambda x: 'opt')
config_args += self.enable_or_disable('fma')
tune_value = self.spec.variants['tune'].value tune_value = self.spec.variants['tune'].value
if tune_value.startswith('cp2k'): if tune_value.startswith('cp2k'):
@ -168,30 +178,41 @@ def build_targets(self):
return [] return []
@when('@2.6.0:') @when('@2.6.0:')
def install(self, spec, prefix): def build(self, spec, prefix):
""" """
Starting from libint 2.6.0 we're using the 2-stage build Starting from libint 2.6.0 we're using the 2-stage build
to get support for the Fortran bindings, required by some to get support for the Fortran bindings, required by some
packages (CP2K notably). packages (CP2K notably).
""" """
super(Libint, self).build(spec, prefix)
# upstream says that using configure/make for the generated code # upstream says that using configure/make for the generated code
# is deprecated and one should use CMake, but with the currently # is deprecated and one should use CMake, but with the currently
# recent 2.7.0.b1 it still doesn't work # recent 2.7.0.b1 it still doesn't work
with working_dir(os.path.join(self.build_directory, 'generated')): with working_dir(os.path.join(self.build_directory, 'generated')):
# straight from the AutotoolsPackage class: # straight from the AutotoolsPackage class:
options = [ config_args = [
'--prefix={0}'.format(prefix), '--prefix={0}'.format(prefix),
'--enable-shared', '--enable-shared',
'--with-cxx-optflags={0}'.format(self.optflags), '--with-cxx-optflags={0}'.format(self.optflags),
] ]
config_args += self.enable_or_disable(
if '+fortran' in spec: 'debug', activation_value=lambda x: 'opt')
options += ['--enable-fortran'] config_args += self.enable_or_disable('fortran')
configure = Executable('./configure') configure = Executable('./configure')
configure(*options) configure(*config_args)
make() make()
@when('@2.6.0:')
def check(self):
with working_dir(os.path.join(self.build_directory, 'generated')):
make('check')
@when('@2.6.0:')
def install(self, spec, prefix):
with working_dir(os.path.join(self.build_directory, 'generated')):
make('install') make('install')
def patch(self): def patch(self):