python/build/meson.py: move two functions to the top level
This commit is contained in:
@@ -2,13 +2,7 @@ import os.path, subprocess, sys
|
|||||||
|
|
||||||
from build.project import Project
|
from build.project import Project
|
||||||
|
|
||||||
class MesonProject(Project):
|
def make_cross_file(toolchain):
|
||||||
def __init__(self, url, md5, installed, configure_args=[],
|
|
||||||
**kwargs):
|
|
||||||
Project.__init__(self, url, md5, installed, **kwargs)
|
|
||||||
self.configure_args = configure_args
|
|
||||||
|
|
||||||
def _make_cross_file(self, toolchain):
|
|
||||||
if toolchain.is_windows:
|
if toolchain.is_windows:
|
||||||
system = 'windows'
|
system = 'windows'
|
||||||
else:
|
else:
|
||||||
@@ -71,10 +65,8 @@ endian = '%s'
|
|||||||
system, cpu_family, cpu, endian))
|
system, cpu_family, cpu, endian))
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def configure(self, toolchain):
|
def configure(toolchain, src, build, args=()):
|
||||||
src = self.unpack(toolchain)
|
cross_file = make_cross_file(toolchain)
|
||||||
cross_file = self._make_cross_file(toolchain)
|
|
||||||
build = self.make_build_path(toolchain)
|
|
||||||
configure = [
|
configure = [
|
||||||
'meson',
|
'meson',
|
||||||
src, build,
|
src, build,
|
||||||
@@ -91,9 +83,20 @@ endian = '%s'
|
|||||||
'--default-library=static',
|
'--default-library=static',
|
||||||
|
|
||||||
'--cross-file', cross_file,
|
'--cross-file', cross_file,
|
||||||
] + self.configure_args
|
] + args
|
||||||
|
|
||||||
subprocess.check_call(configure, env=toolchain.env)
|
subprocess.check_call(configure, env=toolchain.env)
|
||||||
|
|
||||||
|
class MesonProject(Project):
|
||||||
|
def __init__(self, url, md5, installed, configure_args=[],
|
||||||
|
**kwargs):
|
||||||
|
Project.__init__(self, url, md5, installed, **kwargs)
|
||||||
|
self.configure_args = configure_args
|
||||||
|
|
||||||
|
def configure(self, toolchain):
|
||||||
|
src = self.unpack(toolchain)
|
||||||
|
build = self.make_build_path(toolchain)
|
||||||
|
configure(toolchain, src, build, self.configure_args)
|
||||||
return build
|
return build
|
||||||
|
|
||||||
def build(self, toolchain):
|
def build(self, toolchain):
|
||||||
|
Reference in New Issue
Block a user