Pull dependency directly from GIR's target library.

pull/739/head
Elliott Sales de Andrade 8 years ago
parent d0b6f0b7a4
commit 3ae327a2ac
  1. 108
      mesonbuild/modules/gnome.py

@ -193,42 +193,50 @@ class GnomeModule:
else: else:
raise MesonException('Gir export packages must be str or list') raise MesonException('Gir export packages must be str or list')
deps = None deps = kwargs.pop('dependencies', [])
if 'dependencies' in kwargs: if not isinstance(deps, list):
deps = kwargs.pop('dependencies') deps = [deps]
if not isinstance (deps, list): deps = (girtarget.get_all_link_deps() + girtarget.get_external_deps() +
deps = [deps] deps)
for dep in deps: for dep in deps:
if isinstance(dep.held_object, dependencies.InternalDependency): if hasattr(dep, 'held_object'):
scan_command += self.get_include_args(state, dep.held_object.include_directories) dep = dep.held_object
for lib in dep.held_object.libraries: if isinstance(dep, dependencies.InternalDependency):
scan_command += self.get_link_args(state, lib.held_object, depends) scan_command += self.get_include_args(
for source in dep.held_object.sources: state,
if isinstance(source.held_object, GirTarget): dep.include_directories)
scan_command += ["--add-include-path=%s" % for lib in dep.libraries:
os.path.join(state.environment.get_build_dir(), scan_command += self.get_link_args(state, lib.held_object,
source.held_object.get_subdir())] depends)
elif isinstance(dep.held_object, dependencies.PkgConfigDependency): for source in dep.sources:
scan_command += dep.held_object.get_compile_args() if isinstance(source.held_object, GirTarget):
for lib in dep.held_object.libs: scan_command += [
if os.path.isabs(lib) and dep.held_object.is_libtool: "--add-include-path=%s" % (
scan_command += ["-L%s" % os.path.dirname(lib)] os.path.join(state.environment.get_build_dir(),
libname = os.path.basename(lib) source.held_object.get_subdir()),
if libname.startswith("lib"): )
libname = libname[3:] ]
libname = libname.split(".so")[0] elif isinstance(dep, dependencies.PkgConfigDependency):
lib = "-l%s" % libname scan_command += dep.get_compile_args()
# Hack to avoid passing some compiler options in for lib in dep.libs:
if lib.startswith("-W"): if os.path.isabs(lib) and dep.is_libtool:
continue scan_command += ["-L%s" % os.path.dirname(lib)]
scan_command += [lib] libname = os.path.basename(lib)
if libname.startswith("lib"):
girdir = dep.held_object.get_variable ("girdir") libname = libname[3:]
if girdir: libname = libname.split(".so")[0]
scan_command += ["--add-include-path=%s" % girdir] lib = "-l%s" % libname
else: # Hack to avoid passing some compiler options in
mlog.log('dependency %s not handled to build gir files' % dep) if lib.startswith("-W"):
continue continue
scan_command += [lib]
girdir = dep.get_variable("girdir")
if girdir:
scan_command += ["--add-include-path=%s" % (girdir, )]
else:
mlog.log('dependency %s not handled to build gir files' % dep)
continue
inc_dirs = None inc_dirs = None
if kwargs.get('include_directories'): if kwargs.get('include_directories'):
@ -264,18 +272,22 @@ class GnomeModule:
for incd in inc_dirs: for incd in inc_dirs:
typelib_cmd += ['--includedir=%s' % inc for inc in typelib_cmd += ['--includedir=%s' % inc for inc in
incd.held_object.get_incdirs()] incd.held_object.get_incdirs()]
if deps: for dep in deps:
for dep in deps: if hasattr(dep, 'held_object'):
if isinstance(dep.held_object, dependencies.InternalDependency): dep = dep.held_object
for source in dep.held_object.sources: if isinstance(dep, dependencies.InternalDependency):
if isinstance(source.held_object, GirTarget): for source in dep.sources:
typelib_cmd += ["--includedir=%s" % if isinstance(source.held_object, GirTarget):
os.path.join(state.environment.get_build_dir(), typelib_cmd += [
source.held_object.get_subdir())] "--includedir=%s" % (
elif isinstance(dep.held_object, dependencies.PkgConfigDependency): os.path.join(state.environment.get_build_dir(),
girdir = dep.held_object.get_variable ("girdir") source.held_object.get_subdir()),
if girdir: )
typelib_cmd += ["--includedir=%s" % girdir] ]
elif isinstance(dep, dependencies.PkgConfigDependency):
girdir = dep.get_variable("girdir")
if girdir:
typelib_cmd += ["--includedir=%s" % (girdir, )]
kwargs['output'] = typelib_output kwargs['output'] = typelib_output
kwargs['command'] = typelib_cmd kwargs['command'] = typelib_cmd

Loading…
Cancel
Save