Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update MesonNinja easyblock for Meson >=0.64.0 #2861

Merged
merged 2 commits into from
Jan 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion easybuild/easyblocks/generic/mesonninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
@author: Kenneth Hoste (Ghent University)
"""

from distutils.version import LooseVersion
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, create_unused_dir, which
from easybuild.tools.modules import get_software_version
from easybuild.tools.run import run_cmd

DEFAULT_CONFIGURE_CMD = 'meson'


class MesonNinja(EasyBlock):
"""
Expand All @@ -45,6 +49,7 @@ def extra_options(extra_vars=None):
"""Define extra easyconfig parameters specific to MesonNinja."""
extra_vars = EasyBlock.extra_options(extra_vars)
extra_vars.update({
'configure_cmd': [DEFAULT_CONFIGURE_CMD, "Configure command to use", CUSTOM],
'separate_build_dir': [True, "Perform build in a separate directory", CUSTOM],
})
return extra_vars
Expand Down Expand Up @@ -73,8 +78,16 @@ def configure_step(self, cmd_prefix=''):
if no_Dlibdir and no_libdir:
self.cfg.update('configopts', '-Dlibdir=lib')

cmd = "%(preconfigopts)s meson --prefix %(installdir)s %(configopts)s %(sourcedir)s" % {
configure_cmd = self.cfg.get('configure_cmd') or DEFAULT_CONFIGURE_CMD
# Meson >= 0.64.0 has a deprecatation warning for running `meson [options]`
# instead of `meson setup [options]`
if (LooseVersion(get_software_version('Meson')) >= LooseVersion('0.64.0') and
configure_cmd == DEFAULT_CONFIGURE_CMD):
configure_cmd += ' setup'

cmd = "%(preconfigopts)s %(configure_cmd)s --prefix %(installdir)s %(configopts)s %(sourcedir)s" % {
'configopts': self.cfg['configopts'],
'configure_cmd': configure_cmd,
'installdir': self.installdir,
'preconfigopts': self.cfg['preconfigopts'],
'sourcedir': self.start_dir,
Expand Down