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 cerbero.build.oven import Oven
from cerbero.build.cookbook 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):
self.BUILD_TOOLS.append('cmake')
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,
DistroVersion.DEBIAN_STRETCH):
self.BUILD_TOOLS.append('nasm')
# We require cmake 3 for out-of-source-tree builds.
if self.config.distro_version in (DistroVersion.REDHAT_6, DistroVersion.REDHAT_7,
DistroVersion.AMAZON_LINUX):
self.BUILD_TOOLS.append('cmake')
# 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:
self.BUILD_TOOLS.append('cmake')
tool, found, newer = shell.check_tool_version('nasm', '2.13.02', env=None)
if not newer:
self.BUILD_TOOLS.append('nasm')
if self.config.target_platform == Platform.IOS:
self.BUILD_TOOLS.append('gas-preprocessor')
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'])
try:
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 = re.search('v[0-9]+\.[0-9]+(\.[0-9]+)?', out)
if not m:
raise FatalError('Could not detect perl version')
found = m.group()[1:]
newer = StrictVersion(found) >= StrictVersion(needed)
return perl, found, newer
if m:
found = m.group()[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):
@modify_environment
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