Skip to content

Commit f73c0a1

Browse files
authored
Merge pull request #843 from mesonbuild/tingping/gir-dir
gnome.generate_gir(): Fix install_dir and add install_dir_gir and install_dir_typelib
2 parents 7256e10 + dd9dfa7 commit f73c0a1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

mesonbuild/modules/gnome.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def get_dependencies_flags(self, deps, state, depends=None):
195195
def generate_gir(self, state, args, kwargs):
196196
if len(args) != 1:
197197
raise MesonException('Gir takes one argument')
198+
if kwargs.get('install_dir'):
199+
raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"')
198200
girtarget = args[0]
199201
while hasattr(girtarget, 'held_object'):
200202
girtarget = girtarget.held_object
@@ -311,7 +313,8 @@ def generate_gir(self, state, args, kwargs):
311313
}
312314
if kwargs.get('install'):
313315
scankwargs['install'] = kwargs['install']
314-
scankwargs['install_dir'] = os.path.join(state.environment.get_datadir(), 'gir-1.0')
316+
scankwargs['install_dir'] = kwargs.get('install_dir_gir',
317+
os.path.join(state.environment.get_datadir(), 'gir-1.0'))
315318
scan_target = GirTarget(girfile, state.subdir, scankwargs)
316319

317320
typelib_output = '%s-%s.typelib' % (ns, nsversion)
@@ -335,10 +338,15 @@ def generate_gir(self, state, args, kwargs):
335338
if girdir:
336339
typelib_cmd += ["--includedir=%s" % (girdir, )]
337340

338-
kwargs['output'] = typelib_output
339-
kwargs['command'] = typelib_cmd
340-
kwargs['install_dir'] = os.path.join(state.environment.get_libdir(), 'girepository-1.0')
341-
typelib_target = TypelibTarget(typelib_output, state.subdir, kwargs)
341+
typelib_kwargs = {
342+
'output': typelib_output,
343+
'command': typelib_cmd,
344+
}
345+
if kwargs.get('install'):
346+
typelib_kwargs['install'] = kwargs['install']
347+
typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib',
348+
os.path.join(state.environment.get_libdir(), 'girepository-1.0'))
349+
typelib_target = TypelibTarget(typelib_output, state.subdir, typelib_kwargs)
342350
return [scan_target, typelib_target]
343351

344352
def compile_schemas(self, state, args, kwargs):

0 commit comments

Comments
 (0)