This commit is contained in:
alexey.lysiuk 2023-03-28 15:07:15 +03:00
commit e7c04c1bd7
2 changed files with 15 additions and 46 deletions

View file

@ -514,20 +514,18 @@ class SingleExeCTarget(MakeTarget):
class MesonTarget(BuildTarget):
def __init__(self, name=None):
super().__init__(name)
self.configure_prefix = True
def configure(self, state: BuildState):
super().configure(state)
args = [
state.bin_path / 'meson',
'setup',
f'--prefix={state.install_path}',
'--buildtype=release',
'--default-library=static',
]
if self.configure_prefix:
args.append(f'--prefix={state.install_path}')
if state.xcode:
args.append('--backend=xcode')
else:
@ -539,45 +537,21 @@ class MesonTarget(BuildTarget):
args.append(state.build_path)
args.append(state.source)
# subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
self._run_meson(args, state)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
def build(self, state: BuildState):
if state.xcode:
args = ['open', f'{self.name}.xcodeproj']
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
else:
# args = ['ninja']
#
# if state.verbose:
# args.append('--verbose')
#
# subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
args = [
'compile',
f'-C={state.build_path}',
]
args = [state.bin_path / 'meson', 'compile']
if state.verbose:
args.append('--verbose')
self._run_meson(args, state)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
def post_build(self, state: BuildState):
if state.xcode:
return
# self.install(state, tool='ninja')
args = [
'install',
f'-C={state.build_path}'
]
if not self.configure_prefix:
args.append(f'--destdir={state.install_path}')
self._run_meson(args, state)
self.install(state, tool=state.bin_path / 'meson')
@staticmethod
def _write_cross_file(path: Path, state: BuildState):
@ -606,10 +580,3 @@ cpu_family = '{cpu_family}'
cpu = '{cpu}'
endian = 'little'
''')
@staticmethod
def _run_meson(_args: typing.Sequence[typing.Union[str, Path]], state: BuildState):
args = [state.bin_path / 'meson']
args.extend(_args)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)

View file

@ -148,12 +148,14 @@ class GlibTarget(base.MesonTarget):
def detect(self, state: BuildState) -> bool:
return state.has_source_file('glib.doap')
# def configure(self, state: BuildState):
# environment = state.environment
# assert 'LDFLAGS' not in environment
# environment['LDFLAGS'] = '-framework CoreFoundation -framework Foundation'
#
# super().configure(state)
def configure(self, state: BuildState):
# Additional frameworks are needed for proper detection of libintl
ld_key = 'LDFLAGS'
ld_value = '-framework CoreFoundation -framework Foundation'
env = state.environment
env[ld_key] = (env[ld_key] + ' ' + ld_value) if ld_key in env else ld_value
super().configure(state)
def post_build(self, state: BuildState):
super().post_build(state)