aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2017-07-26 17:11:48 +0800
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-31 21:39:47 +0300
commitaeaefce81e91232512e0a56ce6a1a83a14c84bb4 (patch)
treef4c570aa6b97f399967da08ce9ef125c0da9dca7
parent35ef236c43cb196b706d6b3e62022c1b94b016f0 (diff)
downloadmeson-aeaefce81e91232512e0a56ce6a1a83a14c84bb4.zip
meson-aeaefce81e91232512e0a56ce6a1a83a14c84bb4.tar.gz
meson-aeaefce81e91232512e0a56ce6a1a83a14c84bb4.tar.bz2
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)/<NameSpace>_<NameSpaceVersion>_gir_filelist and using it during the build.
-rw-r--r--mesonbuild/modules/gnome.py31
1 files 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'):