mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-04 07:41:11 +01:00
meson: Simplify the use of built tools
The Meson build has fallen a bit behind the Autotools one, when it comes to the internally built tools like glib-mkenums and glib-genmarshals. We don't need to generate gmarshal.strings any more, and since the glib-genmarshal tool is now written in Python it can also be used when cross-compiling, and without indirection, just like we use glib-mkenums. We can also coalesce various rules into a simple array iteration, with minimal changes to glib-mkenums, thus making the build a bit more resilient and without unnecessary duplication.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# FIXME: where does the #include "marshalers.h" go?
|
||||
|
||||
import sys, subprocess
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: {0} <listname> <outputfile>')
|
||||
sys.exit(0)
|
||||
|
||||
glib_genmarshal = sys.argv[1]
|
||||
listname = sys.argv[2]
|
||||
outname = sys.argv[3]
|
||||
|
||||
if outname.endswith('.h'):
|
||||
arg = '--header'
|
||||
else:
|
||||
arg = '--body'
|
||||
|
||||
output = subprocess.check_output([glib_genmarshal, '--prefix=test', '--valist-marshallers', arg, listname])
|
||||
open(outname, 'wb').write(output)
|
||||
@@ -44,26 +44,37 @@ foreach test_name : gobject_tests
|
||||
test(test_name, exe, env : test_env)
|
||||
endforeach
|
||||
|
||||
# The marshalers test requires running a binary, so we cannot build it when
|
||||
# cross-compiling
|
||||
if not meson.has_exe_wrapper()
|
||||
genmarshal = find_program('gobject_test_marshal.py')
|
||||
marshalers_h = custom_target('marshalers_h',
|
||||
output : 'marshalers.h',
|
||||
input : 'marshalers.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test',
|
||||
'--valist-marshallers',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--header',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
marshalers_c = custom_target('marshalers_c',
|
||||
output : 'marshalers.c',
|
||||
input : 'marshalers.list',
|
||||
command : [
|
||||
python, glib_genmarshal,
|
||||
'--prefix=test',
|
||||
'--valist-marshallers',
|
||||
'--include-header=marshalers.h',
|
||||
'--output=@OUTPUT@',
|
||||
'--quiet',
|
||||
'--body',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
marshalers_h = custom_target('marshalers_h',
|
||||
output : 'marshalers.h',
|
||||
input : 'marshalers.list',
|
||||
command : [genmarshal, glib_genmarshal, '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
marshalers_c = custom_target('marshalers_c',
|
||||
output : 'marshalers.c',
|
||||
input : 'marshalers.list',
|
||||
command : [genmarshal, glib_genmarshal, '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
|
||||
exe = executable('signals',
|
||||
'signals.c', marshalers_h, marshalers_c,
|
||||
c_args : ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"'],
|
||||
dependencies : deps,
|
||||
)
|
||||
test('signals', exe, env : test_env)
|
||||
endif
|
||||
exe = executable('signals',
|
||||
'signals.c', marshalers_h, marshalers_c,
|
||||
c_args : ['-DHAVE_CONFIG_H=1', '-DG_LOG_DOMAIN="GLib-GObject"'],
|
||||
dependencies : deps,
|
||||
)
|
||||
test('signals', exe, env : test_env)
|
||||
|
||||
Reference in New Issue
Block a user