Use target name to decide generated Vala .h & .vapi filenames

Previously Meson would use the name of the first .vala source file. This
doesn't work for some projects. Tracker is one example: it has
several libraries that mix Vala and C code. In such cases, none of the
.vala files tend to bear the name of the library we actually want to
generate.
This commit is contained in:
Sam Thursfield 2016-06-14 01:03:43 +01:00
parent f7eef79c0d
commit a661708b54
1 changed files with 2 additions and 2 deletions

View File

@ -772,7 +772,7 @@ int dummy;
if hasattr(i, 'fname'): if hasattr(i, 'fname'):
i = i.fname i = i.fname
if i.endswith('vala'): if i.endswith('vala'):
vapiname = os.path.splitext(os.path.split(i)[1])[0] + '.vapi' vapiname = dep.name + '.vapi'
fullname = os.path.join(self.get_target_dir(dep), vapiname) fullname = os.path.join(self.get_target_dir(dep), vapiname)
result.append(fullname) result.append(fullname)
break break
@ -790,7 +790,7 @@ int dummy;
vala_input_files.append(s.rel_to_builddir(self.build_to_src)) vala_input_files.append(s.rel_to_builddir(self.build_to_src))
if len(src) == 0: if len(src) == 0:
raise InvalidArguments('Vala library has no Vala source files.') raise InvalidArguments('Vala library has no Vala source files.')
namebase = os.path.splitext(os.path.split(src[0].fname)[1])[0] namebase = target.name
base_h = namebase + '.h' base_h = namebase + '.h'
base_vapi = namebase + '.vapi' base_vapi = namebase + '.vapi'
hname = os.path.normpath(os.path.join(self.get_target_dir(target), base_h)) hname = os.path.normpath(os.path.join(self.get_target_dir(target), base_h))