diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 7338205fa..4687e81bc 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -105,7 +105,13 @@ can not be used with the current version of glib-compiled-resources, due to ifile = args[1] if isinstance(ifile, mesonlib.File): - ifile = os.path.join(ifile.subdir, ifile.fname) + # glib-compile-resources will be run inside the source dir, + # so we need either 'src_to_build' or the absolute path. + # Absolute path is the easiest choice. + if ifile.is_built: + ifile = os.path.join(state.environment.get_build_dir(), ifile.subdir, ifile.fname) + else: + ifile = os.path.join(ifile.subdir, ifile.fname) elif isinstance(ifile, str): ifile = os.path.join(state.subdir, ifile) elif isinstance(ifile, (interpreter.CustomTargetHolder, @@ -206,9 +212,10 @@ can not be used with the current version of glib-compiled-resources, due to cmd += ['--sourcedir', os.path.join(state.subdir, source_dir)] cmd += ['--sourcedir', state.subdir] # Current dir - pc, stdout = Popen_safe(cmd, cwd=state.environment.get_source_dir())[0:2] + pc, stdout, stderr = Popen_safe(cmd, cwd=state.environment.get_source_dir()) if pc.returncode != 0: - mlog.warning('glib-compile-resources has failed to get the dependencies for {}'.format(cmd[1])) + m = 'glib-compile-resources failed to get dependencies for {}:\n{}' + mlog.warning(m.format(cmd[1], stderr)) raise subprocess.CalledProcessError(pc.returncode, cmd) dep_files = stdout.split('\n')[:-1] diff --git a/test cases/frameworks/7 gnome/resources/copyfile.py b/test cases/frameworks/7 gnome/resources/copyfile.py new file mode 100644 index 000000000..7e44c48dd --- /dev/null +++ b/test cases/frameworks/7 gnome/resources/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copy(sys.argv[1], sys.argv[2]) diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build index 2e7250134..fdf6f6332 100644 --- a/test cases/frameworks/7 gnome/resources/meson.build +++ b/test cases/frameworks/7 gnome/resources/meson.build @@ -1,8 +1,15 @@ # There are two tests here, because the 2nd one depends on a version of -# GLib (2.48.2) that is very recent at the time of writing. +# GLib (2.51.1) that is very recent at the time of writing. + +copyfile = find_program('copyfile.py') + +simple_gresource = configure_file( + input : 'simple.gresource.xml', + output : 'simple-gen.gresource.xml', + command : [copyfile, '@INPUT@', '@OUTPUT@']) simple_resources = gnome.compile_resources('simple-resources', - 'simple.gresource.xml', + simple_gresource, install_header : true, export : true, source_dir : '../resources-data',