|
|
@ -47,18 +47,17 @@ class GnomeModule: |
|
|
|
girtarget = args[0] |
|
|
|
girtarget = args[0] |
|
|
|
while hasattr(girtarget, 'held_object'): |
|
|
|
while hasattr(girtarget, 'held_object'): |
|
|
|
girtarget = girtarget.held_object |
|
|
|
girtarget = girtarget.held_object |
|
|
|
if not isinstance(girtarget, build.Executable): |
|
|
|
if not (isinstance(girtarget, build.Executable) or isinstance(girtarget, build.SharedLibrary)): |
|
|
|
raise MesonException('Gir target must be an executable') |
|
|
|
raise MesonException('Gir target must be an executable or shared library') |
|
|
|
pkgstr = subprocess.check_output(['pkg-config', '--cflags', 'gobject-introspection-1.0']) |
|
|
|
pkgstr = subprocess.check_output(['pkg-config', '--cflags', 'gobject-introspection-1.0']) |
|
|
|
pkgargs = pkgstr.decode().strip().split() |
|
|
|
pkgargs = pkgstr.decode().strip().split() |
|
|
|
ns = kwargs.pop('namespace') |
|
|
|
ns = kwargs.pop('namespace') |
|
|
|
nsversion = kwargs.pop('nsversion') |
|
|
|
nsversion = kwargs.pop('nsversion') |
|
|
|
libsources = kwargs.pop('sources') |
|
|
|
libsources = kwargs.pop('sources') |
|
|
|
girfile = '%s-%s.gir' % (ns, nsversion) |
|
|
|
girfile = '%s-%s.gir' % (ns, nsversion) |
|
|
|
scan_name = girtarget.name + '-gir' |
|
|
|
scan_command = ['g-ir-scanner', '@INPUT@'] |
|
|
|
scan_command = ['g-ir-scanner', '@INPUT@', '--program', girtarget] |
|
|
|
|
|
|
|
scan_command += pkgargs |
|
|
|
scan_command += pkgargs |
|
|
|
scan_command += ['--namespace='+ns, '--nsversion=' + nsversion, |
|
|
|
scan_command += ['--namespace='+ns, '--nsversion=' + nsversion, '--warn-all', |
|
|
|
'--output', '@OUTPUT@'] |
|
|
|
'--output', '@OUTPUT@'] |
|
|
|
if 'includes' in kwargs: |
|
|
|
if 'includes' in kwargs: |
|
|
|
includes = kwargs.pop('includes') |
|
|
|
includes = kwargs.pop('includes') |
|
|
@ -72,15 +71,36 @@ class GnomeModule: |
|
|
|
scan_command += ['--cflags-begin'] |
|
|
|
scan_command += ['--cflags-begin'] |
|
|
|
scan_command += state.global_args['c'] |
|
|
|
scan_command += state.global_args['c'] |
|
|
|
scan_command += ['--cflags-end'] |
|
|
|
scan_command += ['--cflags-end'] |
|
|
|
|
|
|
|
if kwargs.get('symbol_prefix'): |
|
|
|
|
|
|
|
sym_prefix = kwargs.pop('symbol_prefix') |
|
|
|
|
|
|
|
if not isinstance(sym_prefix, str): |
|
|
|
|
|
|
|
raise MesonException('Gir symbol prefix must be str') |
|
|
|
|
|
|
|
scan_command += ['--symbol-prefix=%s' % sym_prefix] |
|
|
|
|
|
|
|
if kwargs.get('identifier_prefix'): |
|
|
|
|
|
|
|
identifier_prefix = kwargs.pop('identifier_prefix') |
|
|
|
|
|
|
|
if not isinstance(identifier_prefix, str): |
|
|
|
|
|
|
|
raise MesonException('Gir identifier prefix must be str') |
|
|
|
|
|
|
|
scan_command += ['--identifier-prefix=%s' % identifier_prefix] |
|
|
|
|
|
|
|
if kwargs.get('export_packages'): |
|
|
|
|
|
|
|
pkgs = kwargs.pop('export_packages') |
|
|
|
|
|
|
|
if isinstance(pkgs, str): |
|
|
|
|
|
|
|
scan_command += ['--pkg-export=%s' % pkgs] |
|
|
|
|
|
|
|
elif isinstance(pkgs, list): |
|
|
|
|
|
|
|
scan_command += ['--pkg-export=%s' % pkg for pkg in pkgs] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
raise MesonException('Gir export packages must be str or list') |
|
|
|
|
|
|
|
if isinstance(girtarget, build.Executable): |
|
|
|
|
|
|
|
scan_command += ['--program', girtarget] |
|
|
|
|
|
|
|
elif isinstance(girtarget, build.SharedLibrary): |
|
|
|
|
|
|
|
scan_command += ['--library', girtarget.get_basename()] |
|
|
|
scankwargs = {'output' : girfile, |
|
|
|
scankwargs = {'output' : girfile, |
|
|
|
'input' : libsources, |
|
|
|
'input' : libsources, |
|
|
|
'command' : scan_command} |
|
|
|
'command' : scan_command} |
|
|
|
if kwargs.get('install'): |
|
|
|
if kwargs.get('install'): |
|
|
|
scankwargs['install'] = kwargs['install'] |
|
|
|
scankwargs['install'] = kwargs['install'] |
|
|
|
scankwargs['install_dir'] = os.path.join(state.environment.get_datadir(), 'gir-1.0') |
|
|
|
scankwargs['install_dir'] = os.path.join(state.environment.get_datadir(), 'gir-1.0') |
|
|
|
scan_target = GirTarget(scan_name, state.subdir, scankwargs) |
|
|
|
scan_target = GirTarget(girfile, state.subdir, scankwargs) |
|
|
|
|
|
|
|
|
|
|
|
typelib_name = girtarget.name + '-typelib' |
|
|
|
|
|
|
|
typelib_output = '%s-%s.typelib' % (ns, nsversion) |
|
|
|
typelib_output = '%s-%s.typelib' % (ns, nsversion) |
|
|
|
typelib_cmd = ['g-ir-compiler', scan_target, '--output', '@OUTPUT@'] |
|
|
|
typelib_cmd = ['g-ir-compiler', scan_target, '--output', '@OUTPUT@'] |
|
|
|
kwargs['output'] = typelib_output |
|
|
|
kwargs['output'] = typelib_output |
|
|
@ -88,7 +108,7 @@ class GnomeModule: |
|
|
|
# Note that this can't be libdir, because e.g. on Debian it points to |
|
|
|
# Note that this can't be libdir, because e.g. on Debian it points to |
|
|
|
# lib/x86_64-linux-gnu but the girepo dir is always under lib. |
|
|
|
# lib/x86_64-linux-gnu but the girepo dir is always under lib. |
|
|
|
kwargs['install_dir'] = 'lib/girepository-1.0' |
|
|
|
kwargs['install_dir'] = 'lib/girepository-1.0' |
|
|
|
typelib_target = TypelibTarget(typelib_name, state.subdir, kwargs) |
|
|
|
typelib_target = TypelibTarget(typelib_output, state.subdir, kwargs) |
|
|
|
return [scan_target, typelib_target] |
|
|
|
return [scan_target, typelib_target] |
|
|
|
|
|
|
|
|
|
|
|
def compile_schemas(self, state, args, kwargs): |
|
|
|
def compile_schemas(self, state, args, kwargs): |
|
|
|