aedi: use base meson target for glib

This commit is contained in:
alexey.lysiuk 2023-03-27 11:01:27 +03:00
parent 4b129332af
commit 19ee55a995
1 changed files with 8 additions and 46 deletions

View File

@ -135,7 +135,7 @@ class GettextTarget(base.ConfigureMakeStaticDependencyTarget):
super().configure(state)
class GlibTarget(base.BuildTarget):
class GlibTarget(base.MesonTarget):
def __init__(self, name='glib'):
super().__init__(name)
@ -149,54 +149,16 @@ class GlibTarget(base.BuildTarget):
return state.has_source_file('glib.doap')
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)
environment = state.environment
environment['LDFLAGS'] += ' -framework CoreFoundation -framework Foundation'
c_compiler = state.c_compiler()
assert c_compiler
cxx_compiler = state.cxx_compiler()
assert cxx_compiler
cpu = state.architecture()
cpu_family = 'arm' if 'arm64' == cpu else cpu
cross_file = state.build_path / (state.architecture() + '.txt')
with open(cross_file, 'w') as f:
f.write(f'''
[binaries]
c = '{c_compiler}'
cpp = '{cxx_compiler}'
objc = '{c_compiler}'
objcpp = '{cxx_compiler}'
pkgconfig = '{state.prefix_path}/bin/pkg-config'
strip = '/usr/bin/strip'
[host_machine]
system = 'darwin'
cpu_family = '{cpu_family}'
cpu = '{cpu}'
endian = 'little'
''')
args = (
state.bin_path / 'meson',
f'--prefix={state.install_path}',
'--buildtype=release',
'--default-library=static',
f'--cross-file={cross_file}',
state.source
)
subprocess.run(args, check=True, cwd=state.build_path, env=environment)
def build(self, state: BuildState):
args = ('ninja',)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
def post_build(self, state: BuildState):
self.install(state, tool='ninja')
super().post_build(state)
self.make_platform_header(state, '../lib/glib-2.0/include/glibconfig.h')
@staticmethod