diff options
-rw-r--r-- | authors.txt | 1 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 77 | ||||
-rw-r--r-- | mesonbuild/coredata.py | 1 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 5 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 22 | ||||
-rw-r--r-- | test cases/common/95 dep fallback/meson.build | 3 |
6 files changed, 61 insertions, 48 deletions
diff --git a/authors.txt b/authors.txt index 72606e9..2f36256 100644 --- a/authors.txt +++ b/authors.txt @@ -62,3 +62,4 @@ Matthieu Gautier Kseniia Vasilchuk Philipp Geier Mike Sinkovsky +Dima Krasner diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 8d5d2e0..a22e0ab 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1232,15 +1232,16 @@ int dummy; return rule = 'rule STATIC%s_LINKER\n' % crstr if mesonlib.is_windows(): - command_templ = ''' command = %s @$out.rsp + command_template = ''' command = {executable} @$out.rsp rspfile = $out.rsp - rspfile_content = $LINK_ARGS %s $in + rspfile_content = $LINK_ARGS {output_args} $in ''' else: - command_templ = ' command = %s $LINK_ARGS %s $in\n' - command = command_templ % ( - ' '.join(static_linker.get_exelist()), - ' '.join(static_linker.get_output_args('$out'))) + command_template = ' command = {executable} $LINK_ARGS {output_args} $in\n' + command = command_template.format( + executable=' '.join(static_linker.get_exelist()), + output_args=' '.join(static_linker.get_output_args('$out')) + ) description = ' description = Static linking library $out\n\n' outfile.write(rule) outfile.write(command) @@ -1273,16 +1274,17 @@ int dummy; pass rule = 'rule %s%s_LINKER\n' % (langname, crstr) if mesonlib.is_windows(): - command_template = ''' command = %s @$out.rsp + command_template = ''' command = {executable} @$out.rsp rspfile = $out.rsp - rspfile_content = %s $ARGS %s $in $LINK_ARGS $aliasing + rspfile_content = $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing ''' else: - command_template = ' command = %s %s $ARGS %s $in $LINK_ARGS $aliasing\n' - command = command_template % ( - ' '.join(compiler.get_linker_exelist()), - ' '.join(cross_args), - ' '.join(compiler.get_linker_output_args('$out'))) + command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n' + command = command_template.format( + executable=' '.join(compiler.get_linker_exelist()), + cross_args=' '.join(cross_args), + output_args=' '.join(compiler.get_linker_output_args('$out')) + ) description = ' description = Linking target $out' outfile.write(rule) outfile.write(command) @@ -1386,17 +1388,18 @@ rule FORTRAN_DEP_HACK if getattr(self, 'created_llvm_ir_rule', False): return rule = 'rule llvm_ir{}_COMPILER\n'.format('_CROSS' if is_cross else '') - args = [' '.join([ninja_quote(i) for i in compiler.get_exelist()]), - ' '.join(self.get_cross_info_lang_args(compiler.language, is_cross)), - ' '.join(compiler.get_output_args('$out')), - ' '.join(compiler.get_compile_only_args())] if mesonlib.is_windows(): - command_template = ' command = {} @$out.rsp\n' \ + command_template = ' command = {executable} @$out.rsp\n' \ ' rspfile = $out.rsp\n' \ - ' rspfile_content = {} $ARGS {} {} $in\n' + ' rspfile_content = {cross_args} $ARGS {output_args} {compile_only_args} $in\n' else: - command_template = ' command = {} {} $ARGS {} {} $in\n' - command = command_template.format(*args) + command_template = ' command = {executable} {cross_args} $ARGS {output_args} {compile_only_args} $in\n' + command = command_template.format( + executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]), + cross_args=' '.join(self.get_cross_info_lang_args(compiler.language, is_cross)), + output_args=' '.join(compiler.get_output_args('$out')), + compile_only_args=' '.join(compiler.get_compile_only_args()) + ) description = ' description = Compiling LLVM IR object $in.\n' outfile.write(rule) outfile.write(command) @@ -1448,18 +1451,19 @@ rule FORTRAN_DEP_HACK quoted_depargs.append(d) cross_args = self.get_cross_info_lang_args(langname, is_cross) if mesonlib.is_windows(): - command_template = ''' command = %s @$out.rsp + command_template = ''' command = {executable} @$out.rsp rspfile = $out.rsp - rspfile_content = %s $ARGS %s %s %s $in + rspfile_content = {cross_args} $ARGS {dep_args} {output_args} {compile_only_args} $in ''' else: - command_template = ' command = %s %s $ARGS %s %s %s $in\n' - command = command_template % ( - ' '.join([ninja_quote(i) for i in compiler.get_exelist()]), - ' '.join(cross_args), - ' '.join(quoted_depargs), - ' '.join(compiler.get_output_args('$out')), - ' '.join(compiler.get_compile_only_args())) + command_template = ' command = {executable} {cross_args} $ARGS {dep_args} {output_args} {compile_only_args} $in\n' + command = command_template.format( + executable=' '.join([ninja_quote(i) for i in compiler.get_exelist()]), + cross_args=' '.join(cross_args), + dep_args=' '.join(quoted_depargs), + output_args=' '.join(compiler.get_output_args('$out')), + compile_only_args=' '.join(compiler.get_compile_only_args()) + ) description = ' description = Compiling %s object $out\n' % langname if compiler.get_id() == 'msvc': deps = ' deps = msvc\n' @@ -1497,12 +1501,13 @@ rule FORTRAN_DEP_HACK output = '' else: output = ' '.join(compiler.get_output_args('$out')) - command = " command = %s %s $ARGS %s %s %s $in\n" % ( - ' '.join(compiler.get_exelist()), - ' '.join(cross_args), - ' '.join(quoted_depargs), - output, - ' '.join(compiler.get_compile_only_args())) + command = " command = {executable} {cross_args} $ARGS {dep_args} {output_args} {compile_only_args} $in\n".format( + executable=' '.join(compiler.get_exelist()), + cross_args=' '.join(cross_args), + dep_args=' '.join(quoted_depargs), + output_args=output, + compile_only_args=' '.join(compiler.get_compile_only_args()) + ) description = ' description = Precompiling header %s\n' % '$in' if compiler.get_id() == 'msvc': deps = ' deps = msvc\n' diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index d39f161..0e6685c 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -304,7 +304,6 @@ forbidden_target_names = {'clean': None, 'PHONY': None, 'all': None, 'test': None, - 'test:': None, 'benchmark': None, 'install': None, 'uninstall': None, diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 007a7d5..4466f22 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1576,9 +1576,10 @@ class Interpreter(InterpreterBase): @stringArgs def func_project(self, node, args, kwargs): - if self.environment.first_invocation and ('default_options' in kwargs or + default_options = kwargs.get('default_options', []) + if self.environment.first_invocation and (len(default_options) > 0 or len(self.default_project_options) > 0): - self.parse_default_options(kwargs['default_options']) + self.parse_default_options(default_options) if not self.is_subproject(): self.build.project_name = args[0] if os.path.exists(self.option_file): diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 89dfa99..2a54f3a 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -255,8 +255,9 @@ can not be used with the current version of glib-compiled-resources, due to return dep_files, depends, subdirs - def _get_link_args(self, state, lib, depends=None, include_rpath=False): - if gir_has_extra_lib_arg(): + def _get_link_args(self, state, lib, depends=None, include_rpath=False, + use_gir_args=False): + if gir_has_extra_lib_arg() and use_gir_args: link_command = ['--extra-library=%s' % lib.name] else: link_command = ['-l%s' % lib.name] @@ -269,7 +270,8 @@ can not be used with the current version of glib-compiled-resources, due to depends.append(lib) return link_command - def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False): + def _get_dependencies_flags(self, deps, state, depends=None, include_rpath=False, + use_gir_args=False): cflags = set() ldflags = set() gi_includes = set() @@ -283,11 +285,13 @@ can not be used with the current version of glib-compiled-resources, due to cflags.update(get_include_args(state.environment, dep.include_directories)) for lib in dep.libraries: ldflags.update(self._get_link_args(state, lib.held_object, depends, include_rpath)) - libdepflags = self._get_dependencies_flags(lib.held_object.get_external_deps(), state, depends, include_rpath) + libdepflags = self._get_dependencies_flags(lib.held_object.get_external_deps(), state, depends, include_rpath, + use_gir_args) cflags.update(libdepflags[0]) ldflags.update(libdepflags[1]) gi_includes.update(libdepflags[2]) - extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath) + extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath, + use_gir_args) cflags.update(extdepflags[0]) ldflags.update(extdepflags[1]) gi_includes.update(extdepflags[2]) @@ -314,7 +318,7 @@ can not be used with the current version of glib-compiled-resources, due to # Hack to avoid passing some compiler options in if lib.startswith("-W"): continue - if gir_has_extra_lib_arg(): + if gir_has_extra_lib_arg() and use_gir_args: lib = lib.replace('-l', '--extra-library=') ldflags.update([lib]) @@ -378,7 +382,8 @@ can not be used with the current version of glib-compiled-resources, due to if not isinstance(link_with, list): link_with = [link_with] for link in link_with: - scan_command += self._get_link_args(state, link.held_object, depends) + scan_command += self._get_link_args(state, link.held_object, depends, + use_gir_args=True) if 'includes' in kwargs: includes = kwargs.pop('includes') @@ -478,7 +483,8 @@ can not be used with the current version of glib-compiled-resources, due to # ldflags will be misinterpreted by gir scanner (showing # spurious dependencies) but building GStreamer fails if they # are not used here. - cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends) + cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends, + use_gir_args=True) scan_command += list(cflags) # need to put our output directory first as we need to use the # generated libraries instead of any possibly installed system/prefix diff --git a/test cases/common/95 dep fallback/meson.build b/test cases/common/95 dep fallback/meson.build index 212c64f..9358d29 100644 --- a/test cases/common/95 dep fallback/meson.build +++ b/test cases/common/95 dep fallback/meson.build @@ -1,6 +1,7 @@ project('dep fallback', 'c') -bob = dependency('boblib', fallback : ['boblib', 'bob_dep'], required: false) +bob = dependency('boblib', fallback : ['boblib', 'bob_dep'], required: false, + default_options : 'warning_level=1') if not bob.found() error('Bob is actually needed') endif |