diff options
author | Igor Gnatenko <i.gnatenko.brain@gmail.com> | 2015-03-24 16:33:21 +0300 |
---|---|---|
committer | Igor Gnatenko <i.gnatenko.brain@gmail.com> | 2015-03-26 02:29:12 +0300 |
commit | c3f426cd21998aa61eda43e60cb8d458992f14de (patch) | |
tree | d545d740599ca089cec50b59e9a3843961cd87f4 /modules | |
parent | 13e3b5f32a8a51b41eb3753012a622e0a9b2d43b (diff) | |
download | meson-c3f426cd21998aa61eda43e60cb8d458992f14de.zip meson-c3f426cd21998aa61eda43e60cb8d458992f14de.tar.gz meson-c3f426cd21998aa61eda43e60cb8d458992f14de.tar.bz2 |
modules/gnome: allow argument for gir to be SharedLibrary. Closes #76
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gnome.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/gnome.py b/modules/gnome.py index 539ed27..80fef7c 100644 --- a/modules/gnome.py +++ b/modules/gnome.py @@ -47,16 +47,15 @@ class GnomeModule: girtarget = args[0] while hasattr(girtarget, 'held_object'): girtarget = girtarget.held_object - if not isinstance(girtarget, build.Executable): - raise MesonException('Gir target must be an executable') + if not (isinstance(girtarget, build.Executable) or isinstance(girtarget, build.SharedLibrary)): + raise MesonException('Gir target must be an executable or shared library') pkgstr = subprocess.check_output(['pkg-config', '--cflags', 'gobject-introspection-1.0']) pkgargs = pkgstr.decode().strip().split() ns = kwargs.pop('namespace') nsversion = kwargs.pop('nsversion') libsources = kwargs.pop('sources') girfile = '%s-%s.gir' % (ns, nsversion) - scan_name = girtarget.name + '-gir' - scan_command = ['g-ir-scanner', '@INPUT@', '--program', girtarget] + scan_command = ['g-ir-scanner', '@INPUT@'] scan_command += pkgargs scan_command += ['--namespace='+ns, '--nsversion=' + nsversion, '--output', '@OUTPUT@'] @@ -72,15 +71,18 @@ class GnomeModule: scan_command += ['--cflags-begin'] scan_command += state.global_args['c'] scan_command += ['--cflags-end'] + if isinstance(girtarget, build.Executable): + scan_command += ['--program', girtarget] + elif isinstance(girtarget, build.SharedLibrary): + scan_command += ['--library', girtarget.get_basename()] scankwargs = {'output' : girfile, 'input' : libsources, 'command' : scan_command} if kwargs.get('install'): scankwargs['install'] = kwargs['install'] 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_cmd = ['g-ir-compiler', scan_target, '--output', '@OUTPUT@'] kwargs['output'] = typelib_output @@ -88,7 +90,7 @@ class GnomeModule: # 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. 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] def compile_schemas(self, state, args, kwargs): |