From aeaefce81e91232512e0a56ce6a1a83a14c84bb4 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 26 Jul 2017 17:11:48 +0800 Subject: modules/gnome.py: Use a filelist for generate_gir() On Windows, one will face the issue of the 8192-character limit for each command line, so this will cause an issue when one is building items like GTK+ with introspection, because the g-ir-scanner command line will likely get too long, which will clearly break the build. This will affect all Windows builds. Make use of the --filelist option that is already in g-ir-scanner, and generate such a file list from the sources that are fed to generate_gir(), named as $(builddir)/$(target_id)/__gir_filelist and using it during the build. --- mesonbuild/modules/gnome.py | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 37ba453..fd05d13 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -425,20 +425,44 @@ class GnomeModule(ExtensionModule): nsversion = kwargs.pop('nsversion') libsources = kwargs.pop('sources') girfile = '%s-%s.gir' % (ns, nsversion) + srcdir = os.path.join(state.environment.get_source_dir(), state.subdir) + builddir = os.path.join(state.environment.get_build_dir(), state.subdir) depends = [girtarget] gir_inc_dirs = [] - scan_command = [giscanner, '@INPUT@'] + scan_command = [giscanner] scan_command += pkgargs scan_command += ['--no-libtool', '--namespace=' + ns, '--nsversion=' + nsversion, '--warn-all', '--output', '@OUTPUT@'] extra_args = mesonlib.stringlistify(kwargs.pop('extra_args', [])) scan_command += extra_args - scan_command += ['-I' + os.path.join(state.environment.get_source_dir(), state.subdir), - '-I' + os.path.join(state.environment.get_build_dir(), state.subdir)] + scan_command += ['-I' + srcdir, + '-I' + builddir] scan_command += get_include_args(girtarget.get_include_dirs()) + gir_filelist_dir = state.backend.get_target_private_dir_abs(girtarget) + if not os.path.isdir(gir_filelist_dir): + os.mkdir(gir_filelist_dir) + gir_filelist_filename = os.path.join(gir_filelist_dir, '%s_%s_gir_filelist' % (ns, nsversion)) + + with open(gir_filelist_filename, 'w', encoding='utf-8') as gir_filelist: + for s in libsources: + if hasattr(s, 'held_object'): + s = s.held_object + if isinstance(s, build.CustomTarget): + gir_filelist.write(os.path.join(state.environment.get_build_dir(), + state.backend.get_target_dir(s), + s.get_outputs()[0]) + '\n') + elif isinstance(s, mesonlib.File): + gir_filelist.write(s.rel_to_builddir(state.build_to_src) + '\n') + elif isinstance(s, build.GeneratedList): + for gen_src in s.get_outputs(): + gir_filelist.write(os.path.join(srcdir, gen_src) + '\n') + else: + gir_filelist.write(os.path.join(srcdir, s) + '\n') + scan_command += ['--filelist=' + gir_filelist_filename] + if 'link_with' in kwargs: link_with = kwargs.pop('link_with') if not isinstance(link_with, list): @@ -592,7 +616,6 @@ class GnomeModule(ExtensionModule): scan_command.append('-L' + d) scan_command += ['--library', libname] scankwargs = {'output': girfile, - 'input': libsources, 'command': scan_command, 'depends': depends} if kwargs.get('install'): -- cgit v1.1