Pull dependency directly from GIR's target library.

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

@ -193,25 +193,33 @@ 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:
deps = kwargs.pop('dependencies')
if not isinstance(deps, list): if not isinstance(deps, list):
deps = [deps] deps = [deps]
deps = (girtarget.get_all_link_deps() + girtarget.get_external_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,
dep.include_directories)
for lib in dep.libraries:
scan_command += self.get_link_args(state, lib.held_object,
depends)
for source in dep.sources:
if isinstance(source.held_object, GirTarget): if isinstance(source.held_object, GirTarget):
scan_command += ["--add-include-path=%s" % scan_command += [
"--add-include-path=%s" % (
os.path.join(state.environment.get_build_dir(), os.path.join(state.environment.get_build_dir(),
source.held_object.get_subdir())] source.held_object.get_subdir()),
elif isinstance(dep.held_object, dependencies.PkgConfigDependency): )
scan_command += dep.held_object.get_compile_args() ]
for lib in dep.held_object.libs: elif isinstance(dep, dependencies.PkgConfigDependency):
if os.path.isabs(lib) and dep.held_object.is_libtool: scan_command += dep.get_compile_args()
for lib in dep.libs:
if os.path.isabs(lib) and dep.is_libtool:
scan_command += ["-L%s" % os.path.dirname(lib)] scan_command += ["-L%s" % os.path.dirname(lib)]
libname = os.path.basename(lib) libname = os.path.basename(lib)
if libname.startswith("lib"): if libname.startswith("lib"):
@ -223,9 +231,9 @@ class GnomeModule:
continue continue
scan_command += [lib] scan_command += [lib]
girdir = dep.held_object.get_variable ("girdir") girdir = dep.get_variable("girdir")
if girdir: if girdir:
scan_command += ["--add-include-path=%s" % girdir] scan_command += ["--add-include-path=%s" % (girdir, )]
else: else:
mlog.log('dependency %s not handled to build gir files' % dep) mlog.log('dependency %s not handled to build gir files' % dep)
continue continue
@ -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 isinstance(dep.held_object, dependencies.InternalDependency): if hasattr(dep, 'held_object'):
for source in dep.held_object.sources: dep = dep.held_object
if isinstance(dep, dependencies.InternalDependency):
for source in dep.sources:
if isinstance(source.held_object, GirTarget): if isinstance(source.held_object, GirTarget):
typelib_cmd += ["--includedir=%s" % typelib_cmd += [
"--includedir=%s" % (
os.path.join(state.environment.get_build_dir(), os.path.join(state.environment.get_build_dir(),
source.held_object.get_subdir())] source.held_object.get_subdir()),
elif isinstance(dep.held_object, dependencies.PkgConfigDependency): )
girdir = dep.held_object.get_variable ("girdir") ]
elif isinstance(dep, dependencies.PkgConfigDependency):
girdir = dep.get_variable("girdir")
if girdir: if girdir:
typelib_cmd += ["--includedir=%s" % 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