[jhbuild] meson: Check for alternative names for ninja binary
- From: Jonh Wendell <jwendell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] meson: Check for alternative names for ninja binary
- Date: Mon, 3 Oct 2016 11:14:09 +0000 (UTC)
commit c49b12f0366fd84efc382532b3c4121a7bdf356e
Author: Jonh Wendell <jonh wendell redhat com>
Date: Sun Oct 2 17:56:11 2016 -0300
meson: Check for alternative names for ninja binary
On Fedora 24 it's called ninja-build.
https://bugzilla.gnome.org/show_bug.cgi?id=772346
jhbuild/modtypes/meson.py | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/modtypes/meson.py b/jhbuild/modtypes/meson.py
index 557f7c9..e678d5d 100644
--- a/jhbuild/modtypes/meson.py
+++ b/jhbuild/modtypes/meson.py
@@ -32,6 +32,7 @@ __all__ = [ 'MesonModule' ]
class MesonModule(MakeModule, DownloadableModule):
"""Base type for modules that use Meson build system."""
type = 'meson'
+ ninja_binary = ''
PHASE_CHECKOUT = DownloadableModule.PHASE_CHECKOUT
PHASE_FORCE_CHECKOUT = DownloadableModule.PHASE_FORCE_CHECKOUT
@@ -50,6 +51,14 @@ class MesonModule(MakeModule, DownloadableModule):
self.force_non_srcdir_builds = True
self.supports_install_destdir = True
+ def find_ninja(self):
+ for f in ['ninja', 'ninja-build']:
+ if inpath(f, os.environ['PATH'].split(os.pathsep)):
+ self.ninja_binary = f
+ return
+
+ raise CommandError(_('%s not found') % 'ninja')
+
def eval_args(self, args):
args = Package.eval_args(self, args)
args = args.replace('${libsuffix}', '')
@@ -86,6 +95,7 @@ class MesonModule(MakeModule, DownloadableModule):
prefix = os.path.expanduser(buildscript.config.prefix)
if not inpath('meson', os.environ['PATH'].split(os.pathsep)):
raise CommandError(_('%s not found') % 'meson')
+ self.find_ninja()
baseargs = '--prefix %s --libdir %s' % (prefix, self.get_libdir())
mesonargs = self.get_mesonargs()
cmd = 'meson %s %s %s' % (baseargs, mesonargs, srcdir)
@@ -116,14 +126,14 @@ class MesonModule(MakeModule, DownloadableModule):
def do_clean(self, buildscript):
buildscript.set_action(_('Cleaning'), self)
builddir = self.get_builddir(buildscript)
- buildscript.execute('ninja clean', cwd=builddir, extra_env=self.extra_env)
+ buildscript.execute(self.ninja_binary + ' clean', cwd=builddir, extra_env=self.extra_env)
do_clean.depends = [PHASE_CONFIGURE]
do_clean.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
def do_build(self, buildscript):
buildscript.set_action(_('Building'), self)
builddir = self.get_builddir(buildscript)
- buildscript.execute('ninja', cwd=builddir, extra_env=self.extra_env)
+ buildscript.execute(self.ninja_binary, cwd=builddir, extra_env=self.extra_env)
do_build.depends = [PHASE_CONFIGURE]
do_build.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
@@ -136,7 +146,7 @@ class MesonModule(MakeModule, DownloadableModule):
destdir = self.prepare_installroot(buildscript)
extra_env = (self.extra_env or {}).copy()
extra_env['DESTDIR'] = destdir
- buildscript.execute('ninja install', cwd=builddir, extra_env=extra_env)
+ buildscript.execute(self.ninja_binary + ' install', cwd=builddir, extra_env=extra_env)
self.process_install(buildscript, self.get_revision())
do_install.depends = [PHASE_BUILD]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]