Commit f12e5ed2 authored by Stéphane Cerveau's avatar Stéphane Cerveau 🤸🏻 Committed by GStreamer Marge Bot
Browse files

buildtools: test minimum version for cmake and nasm

cmake and nasm needs minimum version.
Add a test to build it if needed.

Part-of: <gstreamer/cerbero!483>
parent c28fd1d1
......@@ -23,7 +23,7 @@ from cerbero.bootstrap import BootstrapperBase
from import Oven
from import CookBook
from cerbero.commands.fetch import Fetch
from cerbero.utils import _
from cerbero.utils import _, shell
from cerbero.errors import FatalError, ConfigurationError
......@@ -51,14 +51,13 @@ class BuildTools (BootstrapperBase, Fetch):
if self.config.platform == Platform.LINUX:
# dav1d requires nasm >=2.13.02
if self.config.distro_version in (DistroVersion.REDHAT_6, DistroVersion.REDHAT_7,
DistroVersion.AMAZON_LINUX, DistroVersion.UBUNTU_XENIAL,
# We require cmake 3 for out-of-source-tree builds.
if self.config.distro_version in (DistroVersion.REDHAT_6, DistroVersion.REDHAT_7,
# We require cmake > 3.10.2 for out-of-source-tree builds.
tool, found, newer = shell.check_tool_version('cmake' ,'3.10.2', env=None)
if not newer:
tool, found, newer = shell.check_tool_version('nasm', '2.13.02', env=None)
if not newer:
if self.config.target_platform == Platform.IOS:
if self.config.target_platform != Platform.LINUX and not \
......@@ -673,18 +673,22 @@ def which(pgm, path=None):
if os.path.exists(pext):
return pext
def check_perl_version(needed, env):
perl = which('perl', env['PATH'])
def check_tool_version(tool_name, needed, env):
found = False
newer = False
if env is None:
env = os.environ.copy()
tool = which(tool_name, env['PATH'])
out = check_output([perl, '--version'], env=env)
out = check_output([tool, '--version'], env=env)
except FatalError:
return None, None, None
return None, False, False
m ='v[0-9]+\.[0-9]+(\.[0-9]+)?', out)
if not m:
raise FatalError('Could not detect perl version')
found =[1:]
newer = StrictVersion(found) >= StrictVersion(needed)
return perl, found, newer
if m:
found =[1:]
newer = StrictVersion(found) >= StrictVersion(needed)
return tool, found, newer
def windows_proof_rename(from_name, to_name):
......@@ -113,7 +113,7 @@ class Recipe(recipe.Recipe):
async def configure(self):
if self.config.platform == Platform.WINDOWS:
perl, found, newer = shell.check_perl_version('5.10.0', env=self.env)
perl, found, newer = shell.check_tool_version('perl','5.10.0', env=self.env)
m = 'please run bootstrap again'
if newer is None:
raise FatalError('Perl not found, ' + m)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment