libgridxc: remove custom phases, make it a Makefile package

This commit is contained in:
Massimiliano Culpo 2022-04-08 21:15:32 +02:00 committed by Harmen Stoppels
parent d0ad644ea6
commit 495dd61218

View File

@ -8,9 +8,10 @@
from spack import * from spack import *
class Libgridxc(Package): class Libgridxc(MakefilePackage):
"""A library to compute the exchange and correlation energy and potential """A library to compute the exchange and correlation energy and potential
in spherical (i.e. an atom) or periodic systems.""" in spherical (i.e. an atom) or periodic systems.
"""
homepage = "https://gitlab.com/siesta-project/libraries/libgridxc" homepage = "https://gitlab.com/siesta-project/libraries/libgridxc"
git = "https://gitlab.com/siesta-project/libraries/libgridxc.git" git = "https://gitlab.com/siesta-project/libraries/libgridxc.git"
@ -31,26 +32,23 @@ class Libgridxc(Package):
depends_on('m4', type='build') depends_on('m4', type='build')
depends_on('libxc@:4.3.4', when='@0.8.0:') depends_on('libxc@:4.3.4', when='@0.8.0:')
phases = ['configure', 'build', 'install'] build_directory = 'build'
def configure(self, spec, prefix): parallel = False
def edit(self, spec, prefix):
sh = which('sh') sh = which('sh')
with working_dir('build', create=True): with working_dir('build', create=True):
sh('../src/config.sh') sh('../src/config.sh')
copy('../extra/fortran.mk', 'fortran.mk') copy('../extra/fortran.mk', 'fortran.mk')
def build(self, spec, prefix): @property
with working_dir('build'): def build_targets(self):
if self.version < Version('0.8.0'): args = ['PREFIX={0}'.format(self.prefix), 'FC=fc']
make('PREFIX=%s' % self.prefix, if self.spec.satisfies('@0.8.0:'):
'FC=fc', args += ['WITH_LIBXC=1',
parallel=False) 'LIBXC_ROOT={0}'.format(self.spec['libxc'].prefix)]
else: return args
make('PREFIX=%s' % self.prefix,
'FC=fc',
'WITH_LIBXC=1',
'LIBXC_ROOT=%s' % self.spec['libxc'].prefix,
parallel=False)
def install(self, spec, prefix): def install(self, spec, prefix):
mkdirp(join_path(self.prefix, 'share', 'org.siesta-project')) mkdirp(join_path(self.prefix, 'share', 'org.siesta-project'))