diff options
82 files changed, 1035 insertions, 452 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index 05578c7..55352aa 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -36,7 +36,7 @@ Installation options are all relative to the prefix, except: | sysconfdir | etc | Sysconf data directory | | localstatedir | var | Localstate data directory | | sharedstatedir | com | Architecture-independent data directory | -| werror | false | Treat warnings as erros | +| werror | false | Treat warnings as errors | | warnlevel {1, 2, 3} | 1 | Set the warning level. From 1 = lowest to 3 = highest | | layout {mirror,flat} | mirror | Build directory layout. | | default-library {shared, static, both} | shared | Default library type. | diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md index cc85d87..8bf1b57 100644 --- a/docs/markdown/Gnome-module.md +++ b/docs/markdown/Gnome-module.md @@ -334,6 +334,7 @@ of the module. * `mkdb_args`: a list of arguments to pass to `gtkdoc-mkdb` * `scan_args`: a list of arguments to pass to `gtkdoc-scan` * `scanobjs_args`: a list of arguments to pass to `gtkdoc-scangobj` +* `c_args`: (*Added 0.48.0*) additional compile arguments to pass * `src_dir`: include_directories to include This creates a `$module-doc` target that can be ran to build docs and diff --git a/docs/markdown/Pkgconfig-module.md b/docs/markdown/Pkgconfig-module.md index 77db809..b727f1a 100644 --- a/docs/markdown/Pkgconfig-module.md +++ b/docs/markdown/Pkgconfig-module.md @@ -17,13 +17,13 @@ keyword arguments. - `description` a string describing the library - `extra_cflags` a list of extra compiler flags to be added to the `Cflags` field after the header search path -- `filebase`, the base name to use for the pkg-config file, as an - example the value of `libfoo` would produce a pkg-config file called +- `filebase` the base name to use for the pkg-config file; as an + example, the value of `libfoo` would produce a pkg-config file called `libfoo.pc` - `install_dir` the directory to install to, defaults to the value of option `libdir` followed by `/pkgconfig` - `libraries` a list of built libraries (usually results of - shared_library) that the user needs to link against. Arbitraty strings can + shared_library) that the user needs to link against. Arbitrary strings can also be provided and they will be added into the `Libs` field. Since 0.45.0 dependencies of built libraries will be automatically added to `Libs.private` field. If a dependency is provided by pkg-config then it will be added in diff --git a/docs/markdown/Python-module.md b/docs/markdown/Python-module.md index 51721f0..2bcad78 100644 --- a/docs/markdown/Python-module.md +++ b/docs/markdown/Python-module.md @@ -45,7 +45,9 @@ Keyword arguments are the following: abort if no python installation can be found. If `required` is set to `false`, Meson will continue even if no python installation was found. You can then use the `.found()` method on the returned object to check - whether it was found or not. + whether it was found or not. Since *0.48.0* the value of a + [`feature`](Build-options.md#features) option can also be passed to the + `required` keyword argument. **Returns**: a [python installation][`python_installation` object] diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 907ceda..b616d3e 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1094,7 +1094,7 @@ Project supports the following keyword arguments. `meson.project_license()`. - `meson_version` takes a string describing which Meson version the - project requires. Usually something like `>0.28.0`. + project requires. Usually something like `>=0.28.0`. - `subproject_dir` specifies the top level directory name that holds Meson subprojects. This is only meant as a compatibility option diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md index 38e1ab2..0977921 100644 --- a/docs/markdown/Wrap-dependency-system-manual.md +++ b/docs/markdown/Wrap-dependency-system-manual.md @@ -109,6 +109,13 @@ the end of your wrap file: push-url=git@git.example.com:projects/someproject.git # Supported since version 0.37.0 ``` +If the git repo contains submodules, you can tell Meson to clone them +automatically by adding the following *(since 0.48.0)*: + +```ini +clone-recursive=true +``` + ## Using wrapped projects To use a subproject simply do this in your top level `meson.build`. diff --git a/docs/images/buildtime.png b/docs/markdown/images/buildtime.png Binary files differindex 2a44422..2a44422 100644 --- a/docs/images/buildtime.png +++ b/docs/markdown/images/buildtime.png diff --git a/docs/images/conftime.png b/docs/markdown/images/conftime.png Binary files differindex 63754db..63754db 100644 --- a/docs/images/conftime.png +++ b/docs/markdown/images/conftime.png diff --git a/docs/images/emptytime.png b/docs/markdown/images/emptytime.png Binary files differindex d80eab9..d80eab9 100644 --- a/docs/images/emptytime.png +++ b/docs/markdown/images/emptytime.png diff --git a/docs/images/glib_build.png b/docs/markdown/images/glib_build.png Binary files differindex ddb9947..ddb9947 100644 --- a/docs/images/glib_build.png +++ b/docs/markdown/images/glib_build.png diff --git a/docs/images/glib_conf.png b/docs/markdown/images/glib_conf.png Binary files differindex 5de60d5..5de60d5 100644 --- a/docs/images/glib_conf.png +++ b/docs/markdown/images/glib_conf.png diff --git a/docs/images/glib_empty.png b/docs/markdown/images/glib_empty.png Binary files differindex 5976e7f..5976e7f 100644 --- a/docs/images/glib_empty.png +++ b/docs/markdown/images/glib_empty.png diff --git a/docs/images/glib_link.png b/docs/markdown/images/glib_link.png Binary files differindex 23d9044..23d9044 100644 --- a/docs/images/glib_link.png +++ b/docs/markdown/images/glib_link.png diff --git a/docs/images/gtksample.png b/docs/markdown/images/gtksample.png Binary files differindex b6557c4..b6557c4 100644 --- a/docs/images/gtksample.png +++ b/docs/markdown/images/gtksample.png diff --git a/docs/images/py3-install-1.png b/docs/markdown/images/py3-install-1.png Binary files differindex 74f0819..74f0819 100644 --- a/docs/images/py3-install-1.png +++ b/docs/markdown/images/py3-install-1.png diff --git a/docs/images/py3-install-2.png b/docs/markdown/images/py3-install-2.png Binary files differindex 9a8f1fe..9a8f1fe 100644 --- a/docs/images/py3-install-2.png +++ b/docs/markdown/images/py3-install-2.png diff --git a/docs/images/py3-install-3.png b/docs/markdown/images/py3-install-3.png Binary files differindex b702910..b702910 100644 --- a/docs/images/py3-install-3.png +++ b/docs/markdown/images/py3-install-3.png diff --git a/docs/markdown/snippets/version_comparison.md b/docs/markdown/snippets/version_comparison.md new file mode 100644 index 0000000..861a3ee --- /dev/null +++ b/docs/markdown/snippets/version_comparison.md @@ -0,0 +1,15 @@ +## Version comparison + +`dependency(version:)` and other version constraints now handle versions +containing non-numeric characters better, comparing versions using the rpmvercmp +algorithm (as using the `pkg-config` autoconf macro `PKG_CHECK_MODULES` does). + +This is a breaking change for exact comparison constraints which rely on the +previous comparison behaviour of extending the compared versions with `'0'` +elements, up to the same length of `'.'`-separated elements. + +For example, a version of `'0.11.0'` would previously match a version constraint +of `'==0.11'`, but no longer does, being instead considered strictly greater. + +Instead, use a version constraint which exactly compares with the precise +version required, e.g. `'==0.11.0'`. diff --git a/docs/markdown/snippets/wrap_clone_recursive.md b/docs/markdown/snippets/wrap_clone_recursive.md new file mode 100644 index 0000000..7c1c0da --- /dev/null +++ b/docs/markdown/snippets/wrap_clone_recursive.md @@ -0,0 +1,7 @@ +## Git wraps can now clone submodules automatically + +To enable this, the following needs to be added to the `.wrap` file: + +```ini +clone-recursive=true +```
\ No newline at end of file diff --git a/docs/meson.build b/docs/meson.build index c83d5f8..32aab07 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -17,6 +17,5 @@ documentation = hotdoc.generate_doc(meson.project_name(), ) run_target('upload', - command: [find_program('hotdoc'), 'run', '--conf-file', documentation.config_path(), - '--git-upload'] -)
\ No newline at end of file + command: [find_program('hotdoc'), 'run', '--conf-file', documentation.config_path()] +) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 5538dfc..eb0e294 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -962,7 +962,6 @@ You probably should put it in link_with instead.''') raise InvalidArguments('Tried to mix cross built and native libraries in target {!r}'.format(self.name)) self.link_targets.append(t) - def link_whole(self, target): for t in listify(target, unholder=True): if not isinstance(t, StaticLibrary): diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py index bb6c9a9..677301e 100644 --- a/mesonbuild/compilers/__init__.py +++ b/mesonbuild/compilers/__init__.py @@ -14,16 +14,7 @@ # Public symbols for compilers sub-package when using 'from . import compilers' __all__ = [ - 'CLANG_OSX', - 'CLANG_STANDARD', - 'CLANG_WIN', - 'GCC_CYGWIN', - 'GCC_MINGW', - 'GCC_OSX', - 'GCC_STANDARD', - 'ICC_OSX', - 'ICC_STANDARD', - 'ICC_WIN', + 'CompilerType', 'all_languages', 'base_options', @@ -94,16 +85,7 @@ __all__ = [ # Bring symbols from each module into compilers sub-package namespace from .compilers import ( - GCC_OSX, - GCC_MINGW, - GCC_CYGWIN, - GCC_STANDARD, - CLANG_OSX, - CLANG_WIN, - CLANG_STANDARD, - ICC_OSX, - ICC_WIN, - ICC_STANDARD, + CompilerType, all_languages, base_options, clib_langs, diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 1d531a6..c226a09 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -30,7 +30,7 @@ from ..mesonlib import ( from .c_function_attributes import C_FUNC_ATTRIBUTES from .compilers import ( - GCC_MINGW, + CompilerType, get_largefile_args, gnu_winlibs, msvc_winlibs, @@ -121,7 +121,8 @@ class CCompiler(Compiler): # The default behavior is this, override in MSVC @functools.lru_cache(maxsize=None) def build_rpath_args(self, build_dir, from_dir, rpath_paths, build_rpath, install_rpath): - if self.id == 'clang' and self.clang_type == compilers.CLANG_OSX: + if getattr(self, 'compiler_type', False) and self.compiler_type.is_osx_compiler: + # Clang, GCC and ICC on macOS all use the same rpath arguments return self.build_osx_rpath_args(build_dir, rpath_paths, build_rpath) return self.build_unix_rpath_args(build_dir, from_dir, rpath_paths, build_rpath, install_rpath) @@ -160,15 +161,8 @@ class CCompiler(Compiler): ''' Get args for allowing undefined symbols when linking to a shared library ''' - if self.id == 'clang': - if self.clang_type == compilers.CLANG_OSX: - # Apple ld - return ['-Wl,-undefined,dynamic_lookup'] - else: - # GNU ld and LLVM lld - return ['-Wl,--allow-shlib-undefined'] - elif self.id == 'gcc': - if self.gcc_type == compilers.GCC_OSX: + if self.id in ('clang', 'gcc'): + if self.compiler_type.is_osx_compiler: # Apple ld return ['-Wl,-undefined,dynamic_lookup'] else: @@ -1064,9 +1058,9 @@ class CCompiler(Compiler): class ClangCCompiler(ClangCompiler, CCompiler): - def __init__(self, exelist, version, clang_type, is_cross, exe_wrapper=None, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) - ClangCompiler.__init__(self, clang_type) + ClangCompiler.__init__(self, compiler_type) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -1092,7 +1086,7 @@ class ClangCCompiler(ClangCompiler, CCompiler): def get_linker_always_args(self): basic = super().get_linker_always_args() - if self.clang_type == compilers.CLANG_OSX: + if self.compiler_type.is_osx_compiler: return basic + ['-Wl,-headerpad_max_install_names'] return basic @@ -1126,9 +1120,9 @@ class ArmclangCCompiler(ArmclangCompiler, CCompiler): class GnuCCompiler(GnuCompiler, CCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) - GnuCompiler.__init__(self, gcc_type, defines) + GnuCompiler.__init__(self, compiler_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -1140,7 +1134,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): ['none', 'c89', 'c99', 'c11', 'gnu89', 'gnu99', 'gnu11'], 'none')}) - if self.gcc_type == GCC_MINGW: + if self.compiler_type == CompilerType.GCC_MINGW: opts.update({ 'c_winlibs': coredata.UserArrayOption('c_winlibs', 'Standard Win libraries to link against', gnu_winlibs), }) @@ -1154,7 +1148,7 @@ class GnuCCompiler(GnuCompiler, CCompiler): return args def get_option_link_args(self, options): - if self.gcc_type == GCC_MINGW: + if self.compiler_type == CompilerType.GCC_MINGW: return options['c_winlibs'].value[:] return [] @@ -1166,9 +1160,9 @@ class GnuCCompiler(GnuCompiler, CCompiler): class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): - GnuCCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) - ElbrusCompiler.__init__(self, gcc_type, defines) + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuCCompiler.__init__(self, exelist, version, compiler_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, compiler_type, defines) # It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports. def get_options(self): @@ -1190,14 +1184,14 @@ class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler): class IntelCCompiler(IntelCompiler, CCompiler): - def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) - IntelCompiler.__init__(self, icc_type) + IntelCompiler.__init__(self, compiler_type) self.lang_header = 'c-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], - '3': default_warn_args + ['-Wextra', '-Wpedantic']} + '3': default_warn_args + ['-Wextra']} def get_options(self): opts = CCompiler.get_options(self) @@ -1220,8 +1214,14 @@ class IntelCCompiler(IntelCompiler, CCompiler): def get_std_shared_lib_link_args(self): return ['-shared'] + def get_std_shared_module_link_args(self, options): + if self.compiler_type.is_osx_compiler: + return ['-bundle', '-Wl,-undefined,dynamic_lookup'] + return ['-shared'] + def has_arguments(self, args, env, code, mode): - return super().has_arguments(args + ['-diag-error', '10006'], env, code, mode) + # -diag-error 10148 is required to catch invalid -W options + return super().has_arguments(args + ['-diag-error', '10006', '-diag-error', '10148'], env, code, mode) class VisualStudioCCompiler(CCompiler): diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 40d6880..6f90c6a 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contextlib, os.path, re, tempfile, shlex +import contextlib, enum, os.path, re, tempfile, shlex import subprocess from ..linkers import StaticLinker @@ -1141,19 +1141,35 @@ class Compiler: raise EnvironmentException( 'Language {} does not support function attributes.'.format(self.get_display_language())) -GCC_STANDARD = 0 -GCC_OSX = 1 -GCC_MINGW = 2 -GCC_CYGWIN = 3 -CLANG_STANDARD = 0 -CLANG_OSX = 1 -CLANG_WIN = 2 -# Possibly clang-cl? +@enum.unique +class CompilerType(enum.Enum): + GCC_STANDARD = 0 + GCC_OSX = 1 + GCC_MINGW = 2 + GCC_CYGWIN = 3 + + CLANG_STANDARD = 10 + CLANG_OSX = 11 + CLANG_MINGW = 12 + # Possibly clang-cl? + + ICC_STANDARD = 20 + ICC_OSX = 21 + ICC_WIN = 22 + + @property + def is_standard_compiler(self): + return self.name in ('GCC_STANDARD', 'CLANG_STANDARD', 'ICC_STANDARD') + + @property + def is_osx_compiler(self): + return self.name in ('GCC_OSX', 'CLANG_OSX', 'ICC_OSX') + + @property + def is_windows_compiler(self): + return self.name in ('GCC_MINGW', 'GCC_CYGWIN', 'CLANG_MINGW', 'ICC_WIN') -ICC_STANDARD = 0 -ICC_OSX = 1 -ICC_WIN = 2 # GNU ld cannot be installed on macOS # https://github.com/Homebrew/homebrew-core/issues/17794#issuecomment-328174395 @@ -1169,14 +1185,14 @@ def get_macos_dylib_install_name(prefix, shlib_name, suffix, soversion): install_name += '.dylib' return '@rpath/' + install_name -def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, soversion, darwin_versions, is_shared_module): - if gcc_type == GCC_STANDARD: +def get_gcc_soname_args(compiler_type, prefix, shlib_name, suffix, soversion, darwin_versions, is_shared_module): + if compiler_type.is_standard_compiler: sostr = '' if soversion is None else '.' + soversion return ['-Wl,-soname,%s%s.%s%s' % (prefix, shlib_name, suffix, sostr)] - elif gcc_type in (GCC_MINGW, GCC_CYGWIN): + elif compiler_type.is_windows_compiler: # For PE/COFF the soname argument has no effect with GNU LD return [] - elif gcc_type == GCC_OSX: + elif compiler_type.is_osx_compiler: if is_shared_module: return [] name = get_macos_dylib_install_name(prefix, shlib_name, suffix, soversion) @@ -1188,20 +1204,21 @@ def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, soversion, darwin_ raise RuntimeError('Not implemented yet.') def get_compiler_is_linuxlike(compiler): - if (getattr(compiler, 'gcc_type', None) == GCC_STANDARD) or \ - (getattr(compiler, 'clang_type', None) == CLANG_STANDARD) or \ - (getattr(compiler, 'icc_type', None) == ICC_STANDARD): - return True - return False + compiler_type = getattr(compiler, 'compiler_type', None) + return compiler_type and compiler_type.is_standard_compiler def get_compiler_uses_gnuld(c): # FIXME: Perhaps we should detect the linker in the environment? # FIXME: Assumes that *BSD use GNU ld, but they might start using lld soon - if (getattr(c, 'gcc_type', None) in (GCC_STANDARD, GCC_MINGW, GCC_CYGWIN)) or \ - (getattr(c, 'clang_type', None) in (CLANG_STANDARD, CLANG_WIN)) or \ - (getattr(c, 'icc_type', None) in (ICC_STANDARD, ICC_WIN)): - return True - return False + compiler_type = getattr(c, 'compiler_type', None) + return compiler_type in ( + CompilerType.GCC_STANDARD, + CompilerType.GCC_MINGW, + CompilerType.GCC_CYGWIN, + CompilerType.CLANG_STANDARD, + CompilerType.CLANG_MINGW, + CompilerType.ICC_STANDARD, + CompilerType.ICC_WIN) def get_largefile_args(compiler): ''' @@ -1262,15 +1279,13 @@ def gnulike_default_include_dirs(compiler, lang): class GnuCompiler: # Functionality that is common to all GNU family compilers. - def __init__(self, gcc_type, defines): + def __init__(self, compiler_type, defines): self.id = 'gcc' - self.gcc_type = gcc_type + self.compiler_type = compiler_type self.defines = defines or {} self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_colorout', 'b_ndebug', 'b_staticpic'] - if self.gcc_type == GCC_OSX: - self.base_options.append('b_bitcode') - else: + if not self.compiler_type.is_osx_compiler: self.base_options.append('b_lundef') self.base_options.append('b_asneeded') # All GCC backends can do assembly @@ -1279,7 +1294,7 @@ class GnuCompiler: # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): - if self.gcc_type == GCC_OSX: + if self.compiler_type.is_osx_compiler: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED @@ -1305,7 +1320,7 @@ class GnuCompiler: return self.defines[define] def get_pic_args(self): - if self.gcc_type in (GCC_CYGWIN, GCC_MINGW, GCC_OSX): + if self.compiler_type.is_osx_compiler or self.compiler_type.is_windows_compiler: return [] # On Window and OS X, pic is always on. return ['-fPIC'] @@ -1319,7 +1334,7 @@ class GnuCompiler: return clike_debug_args[is_debug] def get_buildtype_linker_args(self, buildtype): - if self.gcc_type == GCC_OSX: + if self.compiler_type.is_osx_compiler: return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] @@ -1330,12 +1345,22 @@ class GnuCompiler: return os.path.dirname(fname), fname def get_soname_args(self, *args): - return get_gcc_soname_args(self.gcc_type, *args) + return get_gcc_soname_args(self.compiler_type, *args) def get_std_shared_lib_link_args(self): return ['-shared'] + def get_std_shared_module_link_args(self, options): + if self.compiler_type.is_osx_compiler: + return ['-bundle', '-Wl,-undefined,dynamic_lookup'] + return ['-shared'] + def get_link_whole_for(self, args): + if self.compiler_type.is_osx_compiler: + result = [] + for a in args: + result += ['-Wl,-force_load', a] + return result return ['-Wl,--whole-archive'] + args + ['-Wl,--no-whole-archive'] def gen_vs_module_defs_args(self, defsfile): @@ -1343,13 +1368,13 @@ class GnuCompiler: raise RuntimeError('Module definitions file should be str') # On Windows targets, .def files may be specified on the linker command # line like an object file. - if self.gcc_type in (GCC_CYGWIN, GCC_MINGW): + if self.compiler_type in (CompilerType.GCC_CYGWIN, CompilerType.GCC_MINGW): return [defsfile] # For other targets, discard the .def file. return [] def get_gui_app_args(self, value): - if self.gcc_type in (GCC_CYGWIN, GCC_MINGW) and value: + if self.compiler_type in (CompilerType.GCC_CYGWIN, CompilerType.GCC_MINGW) and value: return ['-mwindows'] return [] @@ -1368,8 +1393,8 @@ class GnuCompiler: class ElbrusCompiler(GnuCompiler): # Elbrus compiler is nearly like GCC, but does not support # PCH, LTO, sanitizers and color output as of version 1.21.x. - def __init__(self, gcc_type, defines): - GnuCompiler.__init__(self, gcc_type, defines) + def __init__(self, compiler_type, defines): + GnuCompiler.__init__(self, compiler_type, defines) self.id = 'lcc' self.base_options = ['b_pgo', 'b_coverage', 'b_ndebug', 'b_staticpic', @@ -1404,12 +1429,12 @@ class ElbrusCompiler(GnuCompiler): return paths class ClangCompiler: - def __init__(self, clang_type): + def __init__(self, compiler_type): self.id = 'clang' - self.clang_type = clang_type + self.compiler_type = compiler_type self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_colorout'] - if self.clang_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: self.base_options.append('b_bitcode') else: self.base_options.append('b_lundef') @@ -1420,13 +1445,13 @@ class ClangCompiler: # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): - if self.clang_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED def get_pic_args(self): - if self.clang_type in (CLANG_WIN, CLANG_OSX): + if self.compiler_type.is_osx_compiler or self.compiler_type.is_windows_compiler: return [] # On Window and OS X, pic is always on. return ['-fPIC'] @@ -1437,7 +1462,7 @@ class ClangCompiler: return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): - if self.clang_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] @@ -1457,15 +1482,7 @@ class ClangCompiler: return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))] def get_soname_args(self, *args): - if self.clang_type == CLANG_STANDARD: - gcc_type = GCC_STANDARD - elif self.clang_type == CLANG_OSX: - gcc_type = GCC_OSX - elif self.clang_type == CLANG_WIN: - gcc_type = GCC_MINGW - else: - raise MesonException('Unreachable code when converting clang type to gcc type.') - return get_gcc_soname_args(gcc_type, *args) + return get_gcc_soname_args(self.compiler_type, *args) def has_multi_arguments(self, args, env): myargs = ['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument'] @@ -1482,17 +1499,17 @@ class ClangCompiler: # visibility to obey OS X and iOS minimum version targets with # -mmacosx-version-min, -miphoneos-version-min, etc. # https://github.com/Homebrew/homebrew-core/issues/3727 - if self.clang_type == CLANG_OSX and version_compare(self.version, '>=8.0'): + if self.compiler_type.is_osx_compiler and version_compare(self.version, '>=8.0'): extra_args.append('-Wl,-no_weak_imports') return super().has_function(funcname, prefix, env, extra_args, dependencies) def get_std_shared_module_link_args(self, options): - if self.clang_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: return ['-bundle', '-Wl,-undefined,dynamic_lookup'] return ['-shared'] def get_link_whole_for(self, args): - if self.clang_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: result = [] for a in args: result += ['-Wl,-force_load', a] @@ -1593,24 +1610,36 @@ class ArmclangCompiler: # Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1 class IntelCompiler: - def __init__(self, icc_type): + def __init__(self, compiler_type): self.id = 'intel' - self.icc_type = icc_type + self.compiler_type = compiler_type self.lang_header = 'none' self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', - 'b_colorout', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded'] + 'b_colorout', 'b_ndebug', 'b_staticpic', 'b_asneeded'] + if not self.compiler_type.is_osx_compiler: + self.base_options.append('b_lundef') # Assembly self.can_compile_suffixes.add('s') def get_pic_args(self): + if self.compiler_type.is_osx_compiler or self.compiler_type.is_windows_compiler: + return [] # On Window and OS X, pic is always on. return ['-fPIC'] def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): + if self.compiler_type.is_osx_compiler: + return apple_buildtype_linker_args[buildtype] return gnulike_buildtype_linker_args[buildtype] + def get_optimization_args(self, optimization_level): + return gnu_optimization_args[optimization_level] + + def get_debug_args(self, is_debug): + return clike_debug_args[is_debug] + def get_pch_suffix(self): return 'pchi' @@ -1625,27 +1654,19 @@ class IntelCompiler: return os.path.dirname(fname), fname def get_soname_args(self, *args): - if self.icc_type == ICC_STANDARD: - gcc_type = GCC_STANDARD - elif self.icc_type == ICC_OSX: - gcc_type = GCC_OSX - elif self.icc_type == ICC_WIN: - gcc_type = GCC_MINGW - else: - raise MesonException('Unreachable code when converting icc type to gcc type.') - return get_gcc_soname_args(gcc_type, *args) + return get_gcc_soname_args(self.compiler_type, *args) # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler def get_asneeded_args(self): - if self.icc_type == CLANG_OSX: + if self.compiler_type.is_osx_compiler: return APPLE_LD_AS_NEEDED else: return GNU_LD_AS_NEEDED def get_std_shared_lib_link_args(self): # FIXME: Don't know how icc works on OSX - # if self.icc_type == ICC_OSX: + # if self.compiler_type.is_osx_compiler: # return ['-bundle'] return ['-shared'] @@ -1661,6 +1682,9 @@ class IntelCompiler: def get_link_whole_for(self, args): return GnuCompiler.get_link_whole_for(self, args) + def gnu_symbol_visibility_args(self, vistype): + return gnu_symbol_visibility_args[vistype] + class ArmCompiler: # Functionality that is common to all ARM family compilers. diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 2173655..6220b93 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -21,7 +21,7 @@ from ..mesonlib import MesonException, version_compare from .c import CCompiler, VisualStudioCCompiler from .compilers import ( - GCC_MINGW, + CompilerType, gnu_winlibs, msvc_winlibs, ClangCompiler, @@ -126,9 +126,9 @@ class CPPCompiler(CCompiler): class ClangCPPCompiler(ClangCompiler, CPPCompiler): - def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) - ClangCompiler.__init__(self, cltype) + ClangCompiler.__init__(self, compiler_type) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -185,9 +185,9 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): class GnuCPPCompiler(GnuCompiler, CPPCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrap, defines, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrap, defines, **kwargs): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) - GnuCompiler.__init__(self, gcc_type, defines) + GnuCompiler.__init__(self, compiler_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -202,7 +202,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): 'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl', 'STL debug mode', False)}) - if self.gcc_type == GCC_MINGW: + if self.compiler_type == CompilerType.GCC_MINGW: opts.update({ 'cpp_winlibs': coredata.UserArrayOption('cpp_winlibs', 'Standard Win libraries to link against', gnu_winlibs), }) @@ -218,7 +218,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): return args def get_option_link_args(self, options): - if self.gcc_type == GCC_MINGW: + if self.compiler_type == CompilerType.GCC_MINGW: return options['cpp_winlibs'].value[:] return [] @@ -230,9 +230,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): - GnuCPPCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) - ElbrusCompiler.__init__(self, gcc_type, defines) + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuCPPCompiler.__init__(self, exelist, version, compiler_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, compiler_type, defines) # It does not support c++/gnu++ 17 and 1z, but still does support 0x, 1y, and gnu++98. def get_options(self): @@ -253,20 +253,23 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler): class IntelCPPCompiler(IntelCompiler, CPPCompiler): - def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrap, **kwargs): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) - IntelCompiler.__init__(self, icc_type) + IntelCompiler.__init__(self, compiler_type) self.lang_header = 'c++-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], - '3': default_warn_args + ['-Wextra', '-Wpedantic']} + '3': default_warn_args + ['-Wextra']} def get_options(self): opts = CPPCompiler.get_options(self) - c_stds = [] - g_stds = ['gnu++98'] + # Every Unix compiler under the sun seems to accept -std=c++03, + # with the exception of ICC. Instead of preventing the user from + # globally requesting C++03, we transparently remap it to C++98 + c_stds = ['c++98', 'c++03'] + g_stds = ['gnu++98', 'gnu++03'] if version_compare(self.version, '>=15.0.0'): c_stds += ['c++11', 'c++14'] g_stds += ['gnu++11'] @@ -286,7 +289,11 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): args = [] std = options['cpp_std'] if std.value != 'none': - args.append('-std=' + std.value) + remap_cpp03 = { + 'c++03': 'c++98', + 'gnu++03': 'gnu++98' + } + args.append('-std=' + remap_cpp03.get(std.value, std.value)) if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args @@ -294,6 +301,10 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): def get_option_link_args(self, options): return [] + def has_arguments(self, args, env, code, mode): + # -diag-error 10148 is required to catch invalid -W options + return super().has_arguments(args + ['-diag-error', '10006', '-diag-error', '10148'], env, code, mode) + class VisualStudioCPPCompiler(VisualStudioCCompiler, CPPCompiler): def __init__(self, exelist, version, is_cross, exe_wrap, is_64): diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 5433b36..e9ceafb 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -17,9 +17,7 @@ import os.path, subprocess from ..mesonlib import EnvironmentException, version_compare, is_windows, is_osx from .compilers import ( - GCC_STANDARD, - GCC_CYGWIN, - GCC_OSX, + CompilerType, d_dmd_buildtype_args, d_gdc_buildtype_args, d_ldc_buildtype_args, @@ -70,12 +68,12 @@ class DCompiler(Compiler): 'mtd': ['-mscrtlib=libcmtd'], } - def __init__(self, exelist, version, is_cross, is_64, **kwargs): + def __init__(self, exelist, version, is_cross, arch, **kwargs): self.language = 'd' super().__init__(exelist, version, **kwargs) self.id = 'unknown' self.is_cross = is_cross - self.is_64 = is_64 + self.arch = arch def sanity_check(self, work_dir, environment): source_name = os.path.join(work_dir, 'sanity.d') @@ -153,12 +151,12 @@ class DCompiler(Compiler): if is_windows(): return [] elif is_osx(): - soname_args = get_gcc_soname_args(GCC_OSX, *args) + soname_args = get_gcc_soname_args(CompilerType.GCC_OSX, *args) if soname_args: return ['-Wl,' + ','.join(soname_args)] return [] - return get_gcc_soname_args(GCC_STANDARD, *args) + return get_gcc_soname_args(CompilerType.GCC_STANDARD, *args) def get_feature_args(self, kwargs, build_to_src): res = [] @@ -276,7 +274,7 @@ class DCompiler(Compiler): # LDC2 on Windows targets to current OS architecture, but # it should follow the target specified by the MSVC toolchain. if is_windows(): - if self.is_64: + if self.arch == 'x86_64': return ['-m64'] return ['-m32'] return [] @@ -308,7 +306,7 @@ class DCompiler(Compiler): for la in linkargs: dcargs.append('-L=' + la.strip()) continue - elif arg.startswith('-link-defaultlib') or arg.startswith('-linker'): + elif arg.startswith(('-link-defaultlib', '-linker', '-link-internally', '-linkonce-templates', '-lib')): # these are special arguments to the LDC linker call, # arguments like "-link-defaultlib-shared" do *not* # denote a library to be linked, but change the default @@ -411,9 +409,12 @@ class DCompiler(Compiler): def get_crt_link_args(self, crt_val, buildtype): return [] + def thread_link_flags(self, env): + return ['-pthread'] + class GnuDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, is_64, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, is_64, **kwargs) + def __init__(self, exelist, version, is_cross, arch, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) self.id = 'gcc' default_warn_args = ['-Wall', '-Wdeprecated'] self.warn_args = {'1': default_warn_args, @@ -467,8 +468,8 @@ class GnuDCompiler(DCompiler): return gnu_optimization_args[optimization_level] class LLVMDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, is_64, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, is_64, **kwargs) + def __init__(self, exelist, version, is_cross, arch, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) self.id = 'llvm' self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt'] @@ -503,11 +504,10 @@ class LLVMDCompiler(DCompiler): class DmdDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, is_64, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, is_64, **kwargs) + def __init__(self, exelist, version, is_cross, arch, **kwargs): + DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) self.id = 'dmd' self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt'] - self.is_msvc = 'VCINSTALLDIR' in os.environ def get_colorout_args(self, colortype): if colortype == 'always': @@ -523,9 +523,9 @@ class DmdDCompiler(DCompiler): if is_windows(): # DMD links against D runtime only when main symbol is found, # so these needs to be inserted when linking static D libraries. - if self.is_64: + if self.arch == 'x86_64': return ['phobos64.lib'] - elif self.is_msvc: + elif self.arch == 'x86_mscoff': return ['phobos32mscoff.lib'] return ['phobos.lib'] return [] @@ -538,9 +538,9 @@ class DmdDCompiler(DCompiler): # Force the target to 64-bit in order to stay consistent # across the different platforms. if is_windows(): - if self.is_64: + if self.arch == 'x86_64': return ['-m64'] - elif self.is_msvc: + elif self.arch == 'x86_mscoff': return ['-m32mscoff'] return ['-m32'] return [] diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 3c7c2f9..b58c4e0 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -14,7 +14,7 @@ from .c import CCompiler from .compilers import ( - ICC_STANDARD, + CompilerType, apple_buildtype_linker_args, gnulike_buildtype_args, gnulike_buildtype_linker_args, @@ -257,9 +257,9 @@ end program prog class GnuFortranCompiler(GnuCompiler, FortranCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs): FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) - GnuCompiler.__init__(self, gcc_type, defines) + GnuCompiler.__init__(self, compiler_type, defines) default_warn_args = ['-Wall'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -279,9 +279,9 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler): class ElbrusFortranCompiler(GnuFortranCompiler, ElbrusCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): - GnuFortranCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) - ElbrusCompiler.__init__(self, gcc_type, defines) + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuFortranCompiler.__init__(self, exelist, version, compiler_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, compiler_type, defines) class G95FortranCompiler(FortranCompiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): @@ -330,7 +330,7 @@ class IntelFortranCompiler(IntelCompiler, FortranCompiler): FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags) # FIXME: Add support for OS X and Windows in detect_fortran_compiler so # we are sent the type of compiler - IntelCompiler.__init__(self, ICC_STANDARD) + IntelCompiler.__init__(self, CompilerType.ICC_STANDARD) self.id = 'intel' default_warn_args = ['-warn', 'general', '-warn', 'truncated_source'] self.warn_args = {'1': default_warn_args, diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index 388e83b..5b2b517 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -51,17 +51,21 @@ class ObjCCompiler(CCompiler): class GnuObjCCompiler(GnuCompiler, ObjCCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None): ObjCCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) - GnuCompiler.__init__(self, gcc_type, defines) + GnuCompiler.__init__(self, compiler_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], '3': default_warn_args + ['-Wextra', '-Wpedantic']} -class ClangObjCCompiler(ClangCompiler, GnuObjCCompiler): - def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): - GnuObjCCompiler.__init__(self, exelist, version, cltype, is_cross, exe_wrapper) - ClangCompiler.__init__(self, cltype) +class ClangObjCCompiler(ClangCompiler, ObjCCompiler): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None): + ObjCCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + ClangCompiler.__init__(self, compiler_type) + default_warn_args = ['-Wall', '-Winvalid-pch'] + self.warn_args = {'1': default_warn_args, + '2': default_warn_args + ['-Wextra'], + '3': default_warn_args + ['-Wextra', '-Wpedantic']} self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index c2e4647..e1b7a7d 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -52,17 +52,21 @@ class ObjCPPCompiler(CPPCompiler): class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None): ObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) - GnuCompiler.__init__(self, gcc_type, defines) + GnuCompiler.__init__(self, compiler_type, defines) default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], '3': default_warn_args + ['-Wextra', '-Wpedantic']} -class ClangObjCPPCompiler(ClangCompiler, GnuObjCPPCompiler): - def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): - GnuObjCPPCompiler.__init__(self, exelist, version, cltype, is_cross, exe_wrapper) - ClangCompiler.__init__(self, cltype) +class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler): + def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None): + ObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + ClangCompiler.__init__(self, compiler_type) + default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'] + self.warn_args = {'1': default_warn_args, + '2': default_warn_args + ['-Wextra'], + '3': default_warn_args + ['-Wextra', '-Wpedantic']} self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 4b32c19..4da5a6d 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -23,7 +23,7 @@ from .wrap import WrapMode import ast import argparse -version = '0.48.0.dev1' +version = '0.47.999' backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'xcode'] default_yielding = False diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index a34ebf7..a80423f 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -870,11 +870,8 @@ class DubDependency(ExternalDependency): mlog.debug('Determining dependency {!r} with DUB executable ' '{!r}'.format(name, self.dubbin.get_path())) - # we need to know the correct architecture on Windows - if self.compiler.is_64: - arch = 'x86_64' - else: - arch = 'x86' + # we need to know the target architecture + arch = self.compiler.arch # Ask dub for the package ret, res = self._call_dubbin(['describe', name, '--arch=' + arch]) @@ -885,8 +882,8 @@ class DubDependency(ExternalDependency): comp = self.compiler.get_id().replace('llvm', 'ldc').replace('gcc', 'gdc') packages = [] - j = json.loads(res) - for package in j['packages']: + description = json.loads(res) + for package in description['packages']: packages.append(package['name']) if package['name'] == name: self.is_found = True @@ -897,14 +894,24 @@ class DubDependency(ExternalDependency): not_lib = False if not_lib: - mlog.error(mlog.bold(name), 'found but it isn\'t a library') + mlog.error(mlog.bold(name), "found but it isn't a library") self.is_found = False return - self.module_path = self._find_right_lib_path(package['path'], comp, j, True, package['targetFileName']) - + self.module_path = self._find_right_lib_path(package['path'], comp, description, True, package['targetFileName']) if not os.path.exists(self.module_path): - mlog.error(mlog.bold(name), 'found but it wasn\'t compiled with', mlog.bold(comp)) + # check if the dependency was built for other archs + archs = [['x86_64'], ['x86'], ['x86', 'x86_mscoff']] + for a in archs: + description_a = copy.deepcopy(description) + description_a['architecture'] = a + arch_module_path = self._find_right_lib_path(package['path'], comp, description_a, True, package['targetFileName']) + if arch_module_path: + mlog.error(mlog.bold(name), "found but it wasn't compiled for", mlog.bold(arch)) + self.is_found = False + return + + mlog.error(mlog.bold(name), "found but it wasn't compiled with", mlog.bold(comp)) self.is_found = False return @@ -943,26 +950,29 @@ class DubDependency(ExternalDependency): for arg in pkgdep.get_link_args(raw=True): self.raw_link_args.append(arg) - for target in j['targets']: + for target in description['targets']: if target['rootPackage'] in packages: add_lib_args('libs', target) add_lib_args('libs-{}'.format(platform.machine()), target) for file in target['buildSettings']['linkerFiles']: - self.link_args.append(self._find_right_lib_path(file, comp, j)) + lib_path = self._find_right_lib_path(file, comp, description) + if lib_path: + self.link_args.append(lib_path) + else: + self.is_found = False def get_compiler(self): return self.compiler - def _find_right_lib_path(self, default_path, comp, j, folder_only=False, file_name=''): - path = '' - - module_build_path = lib_file_name = '' + def _find_right_lib_path(self, default_path, comp, description, folder_only=False, file_name=''): + module_path = lib_file_name = '' if folder_only: - module_build_path = default_path + module_path = default_path lib_file_name = file_name else: - module_build_path = os.path.dirname(default_path) + module_path = os.path.dirname(default_path) lib_file_name = os.path.basename(default_path) + module_build_path = os.path.join(module_path, '.dub', 'build') # Get D version implemented in the compiler # gdc doesn't support this @@ -970,7 +980,6 @@ class DubDependency(ExternalDependency): if ret != 0: mlog.error('Failed to run {!r}', mlog.bold(comp)) - self.is_found = False return d_ver = re.search('v[0-9].[0-9][0-9][0-9].[0-9]', res) # Ex.: v2.081.2 @@ -979,19 +988,21 @@ class DubDependency(ExternalDependency): else: d_ver = '' # gdc + if not os.path.isdir(module_build_path): + return '' + # Ex.: library-debug-linux.posix-x86_64-ldc_2081-EF934983A3319F8F8FF2F0E107A363BA - build_name = 'library-{}-{}-{}-{}_{}'.format(j['buildType'], '.'.join(j['platform']), j['architecture'][0], comp, d_ver) - for entry in os.listdir(os.path.join(module_build_path, '.dub', 'build')): + build_name = 'library-{}-{}-{}-{}_{}'.format(description['buildType'], '.'.join(description['platform']), '.'.join(description['architecture']), comp, d_ver) + for entry in os.listdir(module_build_path): if entry.startswith(build_name): - for file in os.listdir(os.path.join(module_build_path, '.dub', 'build', entry)): + for file in os.listdir(os.path.join(module_build_path, entry)): if file == lib_file_name: if folder_only: - path = os.path.join(module_build_path, '.dub', 'build', entry) + return os.path.join(module_build_path, entry) else: - path = os.path.join(module_build_path, '.dub', 'build', entry, lib_file_name) - break + return os.path.join(module_build_path, entry, lib_file_name) - return path + return '' def _call_dubbin(self, args, env=None): p, out = Popen_safe(self.dubbin.get_command() + args, env=env)[0:2] diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index a46afbb..016eace 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -526,7 +526,7 @@ class SDL2Dependency(ExternalDependency): class WxDependency(ConfigToolDependency): - tools = ['wx-config-3.0', 'wx-config'] + tools = ['wx-config-3.0', 'wx-config', 'wx-config-gtk3'] tool_name = 'wx-config' def __init__(self, environment, kwargs): diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 9e9b5fc..a26787c 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -15,21 +15,14 @@ import configparser, os, platform, re, shlex, shutil, subprocess from . import coredata -from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, LDCLinker +from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker from . import mesonlib from .mesonlib import EnvironmentException, Popen_safe from . import mlog from . import compilers from .compilers import ( - CLANG_OSX, - CLANG_STANDARD, - CLANG_WIN, - GCC_CYGWIN, - GCC_MINGW, - GCC_OSX, - GCC_STANDARD, - ICC_STANDARD, + CompilerType, is_assembly, is_header, is_library, @@ -341,7 +334,6 @@ class Environment: self.vs_static_linker = ['lib'] self.gcc_static_linker = ['gcc-ar'] self.clang_static_linker = ['llvm-ar'] - self.ldc2_static_linker = ['ldc2'] # Various prefixes and suffixes for import libraries, shared libraries, # static libraries, and executables. @@ -452,12 +444,12 @@ class Environment: def get_gnu_compiler_type(defines): # Detect GCC type (Apple, MinGW, Cygwin, Unix) if '__APPLE__' in defines: - return GCC_OSX + return CompilerType.GCC_OSX elif '__MINGW32__' in defines or '__MINGW64__' in defines: - return GCC_MINGW + return CompilerType.GCC_MINGW elif '__CYGWIN__' in defines: - return GCC_CYGWIN - return GCC_STANDARD + return CompilerType.GCC_CYGWIN + return CompilerType.GCC_STANDARD def warn_about_lang_pointing_to_cross(self, compiler_exe, evar): evar_str = os.environ.get(evar, 'WHO_WOULD_CALL_THEIR_COMPILER_WITH_THIS_NAME') @@ -561,14 +553,14 @@ This is probably wrong, it should always point to the native compiler.''' % evar if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue - gtype = self.get_gnu_compiler_type(defines) + compiler_type = self.get_gnu_compiler_type(defines) if guess_gcc_or_lcc == 'lcc': version = self.get_lcc_version_from_defines(defines) cls = ElbrusCCompiler if lang == 'c' else ElbrusCPPCompiler else: version = self.get_gnu_version_from_defines(defines) cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler - return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) + return cls(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines, full_version=full_version) if 'armclang' in out: # The compiler version is not present in the first line of output, @@ -588,13 +580,13 @@ This is probably wrong, it should always point to the native compiler.''' % evar return cls(ccache + compiler, version, is_cross, exe_wrap, full_version=full_version) if 'clang' in out: if 'Apple' in out or mesonlib.for_darwin(want_cross, self): - cltype = CLANG_OSX + compiler_type = CompilerType.CLANG_OSX elif 'windows' in out or mesonlib.for_windows(want_cross, self): - cltype = CLANG_WIN + compiler_type = CompilerType.CLANG_MINGW else: - cltype = CLANG_STANDARD + compiler_type = CompilerType.CLANG_STANDARD cls = ClangCCompiler if lang == 'c' else ClangCPPCompiler - return cls(ccache + compiler, version, cltype, is_cross, exe_wrap, full_version=full_version) + return cls(ccache + compiler, version, compiler_type, is_cross, exe_wrap, full_version=full_version) if 'Microsoft' in out or 'Microsoft' in err: # Latest versions of Visual Studio print version # number to stderr but earlier ones print version @@ -610,10 +602,15 @@ This is probably wrong, it should always point to the native compiler.''' % evar cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler return cls(compiler, version, is_cross, exe_wrap, is_64) if '(ICC)' in out: - # TODO: add microsoft add check OSX - inteltype = ICC_STANDARD + if mesonlib.for_darwin(want_cross, self): + compiler_type = CompilerType.ICC_OSX + elif mesonlib.for_windows(want_cross, self): + # TODO: fix ICC on Windows + compiler_type = CompilerType.ICC_WIN + else: + compiler_type = CompilerType.ICC_STANDARD cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler - return cls(ccache + compiler, version, inteltype, is_cross, exe_wrap, full_version=full_version) + return cls(ccache + compiler, version, compiler_type, is_cross, exe_wrap, full_version=full_version) if 'ARM' in out: cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler return cls(ccache + compiler, version, is_cross, exe_wrap, full_version=full_version) @@ -652,14 +649,14 @@ This is probably wrong, it should always point to the native compiler.''' % evar if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue - gtype = self.get_gnu_compiler_type(defines) + compiler_type = self.get_gnu_compiler_type(defines) if guess_gcc_or_lcc == 'lcc': version = self.get_lcc_version_from_defines(defines) cls = ElbrusFortranCompiler else: version = self.get_gnu_version_from_defines(defines) cls = GnuFortranCompiler - return cls(compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) + return cls(compiler, version, compiler_type, is_cross, exe_wrap, defines, full_version=full_version) if 'G95' in out: return G95FortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) @@ -705,13 +702,13 @@ This is probably wrong, it should always point to the native compiler.''' % evar if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue - gtype = self.get_gnu_compiler_type(defines) + compiler_type = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - return GnuObjCCompiler(ccache + compiler, version, gtype, is_cross, exe_wrap, defines) + return GnuObjCCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines) if out.startswith('Apple LLVM'): - return ClangObjCCompiler(ccache + compiler, version, CLANG_OSX, is_cross, exe_wrap) + return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap) if out.startswith('clang'): - return ClangObjCCompiler(ccache + compiler, version, CLANG_STANDARD, is_cross, exe_wrap) + return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap) self._handle_exceptions(popen_exceptions, compilers) def detect_objcpp_compiler(self, want_cross): @@ -732,13 +729,13 @@ This is probably wrong, it should always point to the native compiler.''' % evar if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue - gtype = self.get_gnu_compiler_type(defines) + compiler_type = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - return GnuObjCPPCompiler(ccache + compiler, version, gtype, is_cross, exe_wrap, defines) + return GnuObjCPPCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines) if out.startswith('Apple LLVM'): - return ClangObjCPPCompiler(ccache + compiler, version, CLANG_OSX, is_cross, exe_wrap) + return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap) if out.startswith('clang'): - return ClangObjCPPCompiler(ccache + compiler, version, CLANG_STANDARD, is_cross, exe_wrap) + return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap) self._handle_exceptions(popen_exceptions, compilers) def detect_java_compiler(self): @@ -837,22 +834,22 @@ This is probably wrong, it should always point to the native compiler.''' % evar version = search_version(out) full_version = out.split('\n', 1)[0] - # Detect which MSVC build environment is currently active. - is_64 = False + # Detect the target architecture, required for proper architecture handling on Windows. c_compiler = {} - if mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ: - # MSVC compiler is required for correct platform detection. - c_compiler = {'c': self.detect_c_compiler(want_cross)} + is_msvc = mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ + if is_msvc: + c_compiler = {'c': self.detect_c_compiler(want_cross)} # MSVC compiler is required for correct platform detection. - if detect_cpu_family(c_compiler) == 'x86_64': - is_64 = True + arch = detect_cpu_family(c_compiler) + if is_msvc and arch == 'x86': + arch = 'x86_mscoff' if 'LLVM D compiler' in out: - return compilers.LLVMDCompiler(exelist, version, is_cross, is_64, full_version=full_version) + return compilers.LLVMDCompiler(exelist, version, is_cross, arch, full_version=full_version) elif 'gdc' in out: - return compilers.GnuDCompiler(exelist, version, is_cross, is_64, full_version=full_version) + return compilers.GnuDCompiler(exelist, version, is_cross, arch, full_version=full_version) elif 'The D Language Foundation' in out or 'Digital Mars' in out: - return compilers.DmdDCompiler(exelist, version, is_cross, is_64, full_version=full_version) + return compilers.DmdDCompiler(exelist, version, is_cross, arch, full_version=full_version) raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_swift_compiler(self): @@ -885,10 +882,11 @@ This is probably wrong, it should always point to the native compiler.''' % evar # Use llvm-ar if available; needed for LTO linkers = [self.clang_static_linker, self.default_static_linker] elif isinstance(compiler, compilers.DCompiler): + # Prefer static linkers over linkers used by D compilers if mesonlib.is_windows(): - linkers = [self.vs_static_linker, self.ldc2_static_linker] + linkers = [self.vs_static_linker, compiler.get_linker_exelist()] else: - linkers = [self.default_static_linker, self.ldc2_static_linker] + linkers = [self.default_static_linker, compiler.get_linker_exelist()] else: linkers = [self.default_static_linker] popen_exceptions = {} @@ -906,8 +904,12 @@ This is probably wrong, it should always point to the native compiler.''' % evar return VisualStudioLinker(linker) if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker): return ArmarLinker(linker) + if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: + return DLinker(linker, compiler.is_64, compiler.is_msvc) if 'LDC - the LLVM D compiler' in out: - return LDCLinker(linker) + return DLinker(linker, compiler.is_64, compiler.is_msvc) + if 'GDC' in out and ' based on D ' in out: + return DLinker(linker, compiler.is_64, compiler.is_msvc) if p.returncode == 0: return ArLinker(linker) if p.returncode == 1 and err.startswith('usage'): # OSX diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 0e6a041..131c24e 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -92,13 +92,15 @@ class FeatureOptionHolder(InterpreterObject, ObjectHolder): def auto_method(self, args, kwargs): return self.held_object.is_auto() -def extract_required_kwarg(kwargs, subproject): +def extract_required_kwarg(kwargs, subproject, feature_check=None): val = kwargs.get('required', True) disabled = False required = False feature = None if isinstance(val, FeatureOptionHolder): - FeatureNew('User option "feature"', '0.47.0').use(subproject) + if not feature_check: + feature_check = FeatureNew('User option "feature"', '0.47.0') + feature_check.use(subproject) option = val.held_object feature = val.name if option.is_disabled(): diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 93106b3..30ca5d8 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .mesonlib import Popen_safe +from .mesonlib import Popen_safe, is_windows from . import mesonlib class StaticLinker: @@ -138,11 +138,12 @@ class ArmarLinker(ArLinker): # armar cann't accept arguments using the @rsp syntax return False -class LDCLinker(StaticLinker): - - def __init__(self, exelist): +class DLinker(StaticLinker): + def __init__(self, exelist, is_64, is_msvc): self.exelist = exelist - self.id = 'ldc2' + self.id = exelist[0] + self.is_64 = is_64 + self.is_msvc = is_msvc def can_linker_accept_rsp(self): return mesonlib.is_windows() @@ -163,6 +164,12 @@ class LDCLinker(StaticLinker): return [] def get_linker_always_args(self): + if is_windows(): + if self.is_64: + return ['-m64'] + elif self.is_msvc and self.id == 'dmd': + return ['-m32mscoff'] + return ['-m32'] return [] def get_coverage_link_args(self): diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 1b9cb42..bbab2ef 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -14,6 +14,7 @@ """A library of random helper functionality.""" +import functools import sys import stat import time @@ -390,33 +391,59 @@ def detect_vcs(source_dir): return vcs return None -def grab_leading_numbers(vstr, strict=False): - result = [] - for x in vstr.rstrip('.').split('.'): - try: - result.append(int(x)) - except ValueError as e: - if strict: - msg = 'Invalid version to compare against: {!r}; only ' \ - 'numeric digits separated by "." are allowed: ' + str(e) - raise MesonException(msg.format(vstr)) - break - return result +# a helper class which implements the same version ordering as RPM +@functools.total_ordering +class Version: + def __init__(self, s): + self._s = s -def make_same_len(listA, listB): - maxlen = max(len(listA), len(listB)) - for i in listA, listB: - for n in range(len(i), maxlen): - i.append(0) + # split into numeric, alphabetic and non-alphanumeric sequences + sequences = re.finditer(r'(\d+|[a-zA-Z]+|[^a-zA-Z\d]+)', s) + # non-alphanumeric separators are discarded + sequences = [m for m in sequences if not re.match(r'[^a-zA-Z\d]+', m.group(1))] + # numeric sequences have leading zeroes discarded + sequences = [re.sub(r'^0+(\d)', r'\1', m.group(1), 1) for m in sequences] + + self._v = sequences + + def __str__(self): + return '%s (V=%s)' % (self._s, str(self._v)) -numpart = re.compile('[0-9.]+') + def __lt__(self, other): + return self.__cmp__(other) == -1 -def version_compare(vstr1, vstr2, strict=False): - match = numpart.match(vstr1.strip()) - if match is None: - msg = 'Uncomparable version string {!r}.' - raise MesonException(msg.format(vstr1)) - vstr1 = match.group(0) + def __eq__(self, other): + return self.__cmp__(other) == 0 + + def __cmp__(self, other): + def cmp(a, b): + return (a > b) - (a < b) + + # compare each sequence in order + for i in range(0, min(len(self._v), len(other._v))): + # sort a non-digit sequence before a digit sequence + if self._v[i].isdigit() != other._v[i].isdigit(): + return 1 if self._v[i].isdigit() else -1 + + # compare as numbers + if self._v[i].isdigit(): + # because leading zeros have already been removed, if one number + # has more digits, it is greater + c = cmp(len(self._v[i]), len(other._v[i])) + if c != 0: + return c + # fallthrough + + # compare lexicographically + c = cmp(self._v[i], other._v[i]) + if c != 0: + return c + + # if equal length, all components have matched, so equal + # otherwise, the version with a suffix remaining is greater + return cmp(len(self._v), len(other._v)) + +def _version_extract_cmpop(vstr2): if vstr2.startswith('>='): cmpop = operator.ge vstr2 = vstr2[2:] @@ -440,10 +467,12 @@ def version_compare(vstr1, vstr2, strict=False): vstr2 = vstr2[1:] else: cmpop = operator.eq - varr1 = grab_leading_numbers(vstr1, strict) - varr2 = grab_leading_numbers(vstr2, strict) - make_same_len(varr1, varr2) - return cmpop(varr1, varr2) + + return (cmpop, vstr2) + +def version_compare(vstr1, vstr2): + (cmpop, vstr2) = _version_extract_cmpop(vstr2) + return cmpop(Version(vstr1), Version(vstr2)) def version_compare_many(vstr1, conditions): if not isinstance(conditions, (list, tuple, frozenset)): @@ -451,28 +480,22 @@ def version_compare_many(vstr1, conditions): found = [] not_found = [] for req in conditions: - if not version_compare(vstr1, req, strict=True): + if not version_compare(vstr1, req): not_found.append(req) else: found.append(req) return not_found == [], not_found, found - +# determine if the minimum version satisfying the condition |condition| exceeds +# the minimum version for a feature |minimum| def version_compare_condition_with_min(condition, minimum): - match = numpart.match(minimum.strip()) - if match is None: - msg = 'Uncomparable version string {!r}.' - raise MesonException(msg.format(minimum)) - minimum = match.group(0) if condition.startswith('>='): cmpop = operator.le condition = condition[2:] elif condition.startswith('<='): - return True - condition = condition[2:] + return False elif condition.startswith('!='): - return True - condition = condition[2:] + return False elif condition.startswith('=='): cmpop = operator.le condition = condition[2:] @@ -483,49 +506,25 @@ def version_compare_condition_with_min(condition, minimum): cmpop = operator.lt condition = condition[1:] elif condition.startswith('<'): - return True - condition = condition[2:] - else: - cmpop = operator.le - varr1 = grab_leading_numbers(minimum, True) - varr2 = grab_leading_numbers(condition, True) - make_same_len(varr1, varr2) - return cmpop(varr1, varr2) - -def version_compare_condition_with_max(condition, maximum): - match = numpart.match(maximum.strip()) - if match is None: - msg = 'Uncomparable version string {!r}.' - raise MesonException(msg.format(maximum)) - maximum = match.group(0) - if condition.startswith('>='): - return False - condition = condition[2:] - elif condition.startswith('<='): - cmpop = operator.ge - condition = condition[2:] - elif condition.startswith('!='): return False - condition = condition[2:] - elif condition.startswith('=='): - cmpop = operator.ge - condition = condition[2:] - elif condition.startswith('='): - cmpop = operator.ge - condition = condition[1:] - elif condition.startswith('>'): - return False - condition = condition[1:] - elif condition.startswith('<'): - cmpop = operator.gt - condition = condition[2:] else: - cmpop = operator.ge - varr1 = grab_leading_numbers(maximum, True) - varr2 = grab_leading_numbers(condition, True) - make_same_len(varr1, varr2) - return cmpop(varr1, varr2) + cmpop = operator.le + + # Declaring a project(meson_version: '>=0.46') and then using features in + # 0.46.0 is valid, because (knowing the meson versioning scheme) '0.46.0' is + # the lowest version which satisfies the constraint '>=0.46'. + # + # But this will fail here, because the minimum version required by the + # version constraint ('0.46') is strictly less (in our version comparison) + # than the minimum version needed for the feature ('0.46.0'). + # + # Map versions in the constraint of the form '0.46' to '0.46.0', to embed + # this knowledge of the meson versioning scheme. + condition = condition.strip() + if re.match('^\d+.\d+$', condition): + condition += '.0' + return cmpop(Version(minimum), Version(condition)) def default_libdir(): if is_debianlike(): diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index b150731..cd925e5 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -43,6 +43,10 @@ def create_parser(): help=argparse.SUPPRESS) p.add_argument('--fatal-meson-warnings', action='store_true', dest='fatal_warnings', help='Make all Meson warnings fatal') + p.add_argument('--reconfigure', action='store_true', + help='Set options and reconfigure the project. Useful when new ' + + 'options have been added to the project and the default value ' + + 'is not working.') p.add_argument('builddir', nargs='?', default=None) p.add_argument('sourcedir', nargs='?', default=None) return p @@ -57,8 +61,10 @@ def wrapmodetype(string): class MesonApp: - def __init__(self, dir1, dir2, handshake, options): - (self.source_dir, self.build_dir) = self.validate_dirs(dir1, dir2, handshake) + def __init__(self, options): + (self.source_dir, self.build_dir) = self.validate_dirs(options.builddir, + options.sourcedir, + options.reconfigure) self.options = options def has_build_file(self, dirname): @@ -66,6 +72,15 @@ class MesonApp: return os.path.exists(fname) def validate_core_dirs(self, dir1, dir2): + if dir1 is None: + if dir2 is None: + if not os.path.exists('meson.build') and os.path.exists('../meson.build'): + dir2 = '..' + else: + raise MesonException('Must specify at least one directory name.') + dir1 = os.getcwd() + if dir2 is None: + dir2 = os.getcwd() ndir1 = os.path.abspath(os.path.realpath(dir1)) ndir2 = os.path.abspath(os.path.realpath(dir2)) if not os.path.exists(ndir1): @@ -86,21 +101,23 @@ class MesonApp: return ndir2, ndir1 raise MesonException('Neither directory contains a build file %s.' % environment.build_filename) - def validate_dirs(self, dir1, dir2, handshake): + def validate_dirs(self, dir1, dir2, reconfigure): (src_dir, build_dir) = self.validate_core_dirs(dir1, dir2) priv_dir = os.path.join(build_dir, 'meson-private/coredata.dat') if os.path.exists(priv_dir): - if not handshake: - print('Directory already configured, exiting Meson. Just run your build command\n' - '(e.g. ninja) and Meson will regenerate as necessary. If ninja fails, run ninja\n' - 'reconfigure to force Meson to regenerate.\n' + if not reconfigure: + print('Directory already configured.\n' + '\nJust run your build command (e.g. ninja) and Meson will regenerate as necessary.\n' + 'If ninja fails, run "ninja reconfigure" or "meson --reconfigure"\n' + 'to force Meson to regenerate.\n' '\nIf build failures persist, manually wipe your build directory to clear any\n' 'stored system data.\n' - '\nTo change option values, run meson configure instead.') - sys.exit(0) + '\nTo change option values, run "meson configure" instead.') + sys.exit(1) else: - if handshake: - raise RuntimeError('Something went terribly wrong. Please file a bug.') + if reconfigure: + print('Directory does not contain a valid build tree:\n{}'.format(build_dir)) + sys.exit(1) return src_dir, build_dir def check_pkgconfig_envvar(self, env): @@ -317,7 +334,11 @@ def run(original_args, mainfile): # No special command? Do the basic setup/reconf. if len(args) >= 2 and args[0] == '--internal': - if args[1] != 'regenerate': + if args[1] == 'regenerate': + # Rewrite "meson --internal regenerate" command line to + # "meson --reconfigure" + args = ['--reconfigure'] + args[2:] + else: script = args[1] try: sys.exit(run_script_command(args[1:])) @@ -325,29 +346,14 @@ def run(original_args, mainfile): mlog.error('\nError in {} helper script:'.format(script)) mlog.exception(e) sys.exit(1) - args = args[2:] - handshake = True - else: - handshake = False parser = create_parser() args = mesonlib.expand_arguments(args) options = parser.parse_args(args) coredata.parse_cmd_line_options(options) - dir1 = options.builddir - dir2 = options.sourcedir try: - if dir1 is None: - if dir2 is None: - if not os.path.exists('meson.build') and os.path.exists('../meson.build'): - dir2 = '..' - else: - raise MesonException('Must specify at least one directory name.') - dir1 = os.getcwd() - if dir2 is None: - dir2 = os.getcwd() - app = MesonApp(dir1, dir2, handshake, options) + app = MesonApp(options) except Exception as e: # Log directory does not exist, so just print # to stdout. diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 3d39950..7802472 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -326,6 +326,7 @@ class GnomeModule(ExtensionModule): for dep in deps: if isinstance(dep, InternalDependency): + cflags.update(dep.compile_args) cflags.update(get_include_args(dep.include_directories)) for lib in dep.libraries: if hasattr(lib, 'held_object'): @@ -881,6 +882,7 @@ This will become a hard error in the future.''') rv = [inscript, pottarget, potarget] return ModuleReturnValue(None, rv) + @FeatureNewKwargs('gnome.gtkdoc', '0.48.0', ['c_args']) @FeatureNewKwargs('gnome.gtkdoc', '0.37.0', ['namespace', 'mode']) @permittedKwargs({'main_xml', 'main_sgml', 'src_dir', 'dependencies', 'install', 'install_dir', 'scan_args', 'scanobjs_args', 'gobject_typesfile', @@ -988,7 +990,9 @@ This will become a hard error in the future.''') def _get_build_args(self, kwargs, state, depends): args = [] deps = extract_as_list(kwargs, 'dependencies', unholder=True) - cflags, internal_ldflags, external_ldflags, gi_includes = \ + cflags = OrderedSet() + cflags.update(mesonlib.stringlistify(kwargs.pop('c_args', []))) + deps_cflags, internal_ldflags, external_ldflags, gi_includes = \ self._get_dependencies_flags(deps, state, depends, include_rpath=True) inc_dirs = mesonlib.extract_as_list(kwargs, 'include_directories') for incd in inc_dirs: @@ -996,6 +1000,7 @@ This will become a hard error in the future.''') raise MesonException( 'Gir include dirs should be include_directories().') + cflags.update(deps_cflags) cflags.update(get_include_args(inc_dirs)) ldflags = OrderedSet() ldflags.update(internal_ldflags) diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 40f73f7..0fc052b 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -92,7 +92,7 @@ class I18nModule(ExtensionModule): outputs = mesonlib.substitute_values([output], values) output = outputs[0] - ct = build.CustomTarget(output + '_merge', state.subdir, state.subproject, kwargs) + ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs) return ModuleReturnValue(ct, [ct]) @FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset']) diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index d9ec562..48352c4 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -25,7 +25,7 @@ from ..interpreterbase import ( InterpreterObject, InvalidArguments, FeatureNew ) -from ..interpreter import ExternalProgramHolder +from ..interpreter import ExternalProgramHolder, extract_required_kwarg from ..interpreterbase import flatten from ..build import known_shmod_kwargs from .. import mlog @@ -477,9 +477,11 @@ class PythonModule(ExtensionModule): @permittedKwargs(['required']) def find_installation(self, interpreter, state, args, kwargs): - required = kwargs.get('required', True) - if not isinstance(required, bool): - raise InvalidArguments('"required" argument must be a boolean.') + feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0') + disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check) + if disabled: + mlog.log('find_installation skipped: feature', mlog.bold(feature), 'disabled') + return ExternalProgramHolder(NonExistingExternalProgram()) if len(args) > 1: raise InvalidArguments('find_installation takes zero or one positional argument.') diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 42808e3..5cc2225 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -208,8 +208,12 @@ class Resolver: subprocess.check_call(['git', 'checkout', revno], cwd=checkoutdir) else: - subprocess.check_call(['git', 'clone', p.get('url'), - p.get('directory')], cwd=self.subdir_root) + if p.values.get('clone-recursive', '').lower() == 'true': + subprocess.check_call(['git', 'clone', '--recursive', p.get('url'), + p.get('directory')], cwd=self.subdir_root) + else: + subprocess.check_call(['git', 'clone', p.get('url'), + p.get('directory')], cwd=self.subdir_root) if revno.lower() != 'head': if subprocess.call(['git', 'checkout', revno], cwd=checkoutdir) != 0: subprocess.check_call(['git', 'fetch', p.get('url'), revno], cwd=checkoutdir) diff --git a/run_project_tests.py b/run_project_tests.py index a373aa0..27e588b 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -158,6 +158,11 @@ def platform_fix_name(fname, compiler, env): if compiler == 'cl': return None + if fname.startswith('?cygwin:'): + fname = fname[8:] + if compiler == 'cl' or not mesonlib.for_cygwin(env.is_cross_build(), env): + return None + return fname def validate_install(srcdir, installdir, compiler, env): @@ -183,17 +188,11 @@ def validate_install(srcdir, installdir, compiler, env): expected[fname] = True for (fname, found) in expected.items(): if not found: - # Ignore missing PDB files if we aren't using cl - if fname.endswith('.pdb') and compiler != 'cl': - continue ret_msg += 'Expected file {0} missing.\n'.format(fname) # Check if there are any unexpected files found = get_relative_files_list_from_dir(installdir) for fname in found: - # Windows-specific tests check for the existence of installed PDB - # files, but common tests do not, for obvious reasons. Ignore any - # extra PDB files found. - if fname not in expected and not fname.endswith('.pdb') and compiler == 'cl': + if fname not in expected: ret_msg += 'Extra file {0} found.\n'.format(fname) return ret_msg diff --git a/run_unittests.py b/run_unittests.py index 79bafcd..80864c9 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -39,7 +39,7 @@ from mesonbuild.interpreter import Interpreter, ObjectHolder from mesonbuild.mesonlib import ( is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd, windows_proof_rmtree, python_command, version_compare, - grab_leading_numbers, BuildDirLock + BuildDirLock, Version ) from mesonbuild.environment import detect_ninja from mesonbuild.mesonlib import MesonException, EnvironmentException @@ -265,7 +265,7 @@ class InternalTests(unittest.TestCase): def test_compiler_args_class_gnuld(self): cargsfunc = mesonbuild.compilers.CompilerArgs ## Test --start/end-group - gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', 0, False) + gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', mesonbuild.compilers.CompilerType.GCC_STANDARD, False) ## Test that 'direct' append and extend works l = cargsfunc(gcc, ['-Lfoodir', '-lfoo']) self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group']) @@ -691,6 +691,114 @@ class InternalTests(unittest.TestCase): PkgConfigDependency.pkgbin_cache = {} PkgConfigDependency.class_pkgbin = None + def test_version_compare(self): + comparefunc = mesonbuild.mesonlib.version_compare_many + for (a, b, result) in [ + ('0.99.beta19', '>= 0.99.beta14', True), + ]: + self.assertEqual(comparefunc(a, b)[0], result) + + for (a, b, result) in [ + # examples from https://fedoraproject.org/wiki/Archive:Tools/RPM/VersionComparison + ("1.0010", "1.9", 1), + ("1.05", "1.5", 0), + ("1.0", "1", 1), + ("2.50", "2.5", 1), + ("fc4", "fc.4", 0), + ("FC5", "fc4", -1), + ("2a", "2.0", -1), + ("1.0", "1.fc4", 1), + ("3.0.0_fc", "3.0.0.fc", 0), + # from RPM tests + ("1.0", "1.0", 0), + ("1.0", "2.0", -1), + ("2.0", "1.0", 1), + ("2.0.1", "2.0.1", 0), + ("2.0", "2.0.1", -1), + ("2.0.1", "2.0", 1), + ("2.0.1a", "2.0.1a", 0), + ("2.0.1a", "2.0.1", 1), + ("2.0.1", "2.0.1a", -1), + ("5.5p1", "5.5p1", 0), + ("5.5p1", "5.5p2", -1), + ("5.5p2", "5.5p1", 1), + ("5.5p10", "5.5p10", 0), + ("5.5p1", "5.5p10", -1), + ("5.5p10", "5.5p1", 1), + ("10xyz", "10.1xyz", -1), + ("10.1xyz", "10xyz", 1), + ("xyz10", "xyz10", 0), + ("xyz10", "xyz10.1", -1), + ("xyz10.1", "xyz10", 1), + ("xyz.4", "xyz.4", 0), + ("xyz.4", "8", -1), + ("8", "xyz.4", 1), + ("xyz.4", "2", -1), + ("2", "xyz.4", 1), + ("5.5p2", "5.6p1", -1), + ("5.6p1", "5.5p2", 1), + ("5.6p1", "6.5p1", -1), + ("6.5p1", "5.6p1", 1), + ("6.0.rc1", "6.0", 1), + ("6.0", "6.0.rc1", -1), + ("10b2", "10a1", 1), + ("10a2", "10b2", -1), + ("1.0aa", "1.0aa", 0), + ("1.0a", "1.0aa", -1), + ("1.0aa", "1.0a", 1), + ("10.0001", "10.0001", 0), + ("10.0001", "10.1", 0), + ("10.1", "10.0001", 0), + ("10.0001", "10.0039", -1), + ("10.0039", "10.0001", 1), + ("4.999.9", "5.0", -1), + ("5.0", "4.999.9", 1), + ("20101121", "20101121", 0), + ("20101121", "20101122", -1), + ("20101122", "20101121", 1), + ("2_0", "2_0", 0), + ("2.0", "2_0", 0), + ("2_0", "2.0", 0), + ("a", "a", 0), + ("a+", "a+", 0), + ("a+", "a_", 0), + ("a_", "a+", 0), + ("+a", "+a", 0), + ("+a", "_a", 0), + ("_a", "+a", 0), + ("+_", "+_", 0), + ("_+", "+_", 0), + ("_+", "_+", 0), + ("+", "_", 0), + ("_", "+", 0), + # other tests + ('0.99.beta19', '0.99.beta14', 1), + ("1.0.0", "2.0.0", -1), + (".0.0", "2.0.0", -1), + ("alpha", "beta", -1), + ("1.0", "1.0.0", -1), + ("2.456", "2.1000", -1), + ("2.1000", "3.111", -1), + ("2.001", "2.1", 0), + ("2.34", "2.34", 0), + ("6.1.2", "6.3.8", -1), + ("1.7.3.0", "2.0.0", -1), + ("2.24.51", "2.25", -1), + ("2.1.5+20120813+gitdcbe778", "2.1.5", 1), + ("3.4.1", "3.4b1", 1), + ("041206", "200090325", -1), + ("0.6.2+git20130413", "0.6.2", 1), + ("2.6.0+bzr6602", "2.6.0", 1), + ("2.6.0", "2.6b2", 1), + ("2.6.0+bzr6602", "2.6b2x", 1), + ("0.6.7+20150214+git3a710f9", "0.6.7", 1), + ("15.8b", "15.8.0.1", -1), + ("1.2rc1", "1.2.0", -1), + ]: + ver_a = Version(a) + ver_b = Version(b) + self.assertEqual(ver_a.__cmp__(ver_b), result) + self.assertEqual(ver_b.__cmp__(ver_a), -result) @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') class DataTests(unittest.TestCase): @@ -1534,30 +1642,30 @@ class AllPlatformTests(BasePlatformTests): if isinstance(cc, gnu): self.assertIsInstance(linker, ar) if is_osx(): - self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_OSX) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.GCC_OSX) elif is_windows(): - self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_MINGW) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.GCC_MINGW) elif is_cygwin(): - self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_CYGWIN) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.GCC_CYGWIN) else: - self.assertEqual(cc.gcc_type, mesonbuild.compilers.GCC_STANDARD) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.GCC_STANDARD) if isinstance(cc, clang): self.assertIsInstance(linker, ar) if is_osx(): - self.assertEqual(cc.clang_type, mesonbuild.compilers.CLANG_OSX) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.CLANG_OSX) elif is_windows(): # Not implemented yet - self.assertEqual(cc.clang_type, mesonbuild.compilers.CLANG_WIN) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.CLANG_MINGW) else: - self.assertEqual(cc.clang_type, mesonbuild.compilers.CLANG_STANDARD) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.CLANG_STANDARD) if isinstance(cc, intel): self.assertIsInstance(linker, ar) if is_osx(): - self.assertEqual(cc.icc_type, mesonbuild.compilers.ICC_OSX) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.ICC_OSX) elif is_windows(): - self.assertEqual(cc.icc_type, mesonbuild.compilers.ICC_WIN) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.ICC_WIN) else: - self.assertEqual(cc.icc_type, mesonbuild.compilers.ICC_STANDARD) + self.assertEqual(cc.compiler_type, mesonbuild.compilers.CompilerType.ICC_STANDARD) if isinstance(cc, msvc): self.assertTrue(is_windows()) self.assertIsInstance(linker, lib) @@ -2552,13 +2660,14 @@ recommended as it is not supported on some platforms''') out = self.init(testdir) # Parent project warns correctly self.assertRegex(out, "WARNING: Project targetting '>=0.45'.*'0.47.0': dict") - # Subproject warns correctly - self.assertRegex(out, "|WARNING: Project targetting '>=0.40'.*'0.44.0': disabler") + # Subprojects warn correctly + self.assertRegex(out, r"\|WARNING: Project targetting '>=0.40'.*'0.44.0': disabler") + self.assertRegex(out, r"\|WARNING: Project targetting '!=0.40'.*'0.44.0': disabler") # Subproject has a new-enough meson_version, no warning self.assertNotRegex(out, "WARNING: Project targetting.*Python") # Ensure a summary is printed in the subproject and the outer project - self.assertRegex(out, "|WARNING: Project specifies a minimum meson_version '>=0.40'") - self.assertRegex(out, "| * 0.44.0: {'disabler'}") + self.assertRegex(out, r"\|WARNING: Project specifies a minimum meson_version '>=0.40'") + self.assertRegex(out, r"\| \* 0.44.0: {'disabler'}") self.assertRegex(out, "WARNING: Project specifies a minimum meson_version '>=0.45'") self.assertRegex(out, " * 0.47.0: {'dict'}") @@ -2656,7 +2765,7 @@ class FailureTests(BasePlatformTests): super().tearDown() windows_proof_rmtree(self.srcdir) - def assertMesonRaises(self, contents, match, extra_args=None, langs=None): + def assertMesonRaises(self, contents, match, extra_args=None, langs=None, meson_version=None): ''' Assert that running meson configure on the specified @contents raises a error message matching regex @match. @@ -2664,7 +2773,10 @@ class FailureTests(BasePlatformTests): if langs is None: langs = [] with open(self.mbuild, 'w') as f: - f.write("project('failure test', 'c', 'cpp')\n") + f.write("project('failure test', 'c', 'cpp'") + if meson_version: + f.write(", meson_version: '{}'".format(meson_version)) + f.write(")\n") for lang in langs: f.write("add_languages('{}', required : false)\n".format(lang)) f.write(contents) @@ -2674,13 +2786,14 @@ class FailureTests(BasePlatformTests): # Must run in-process or we'll get a generic CalledProcessError self.init(self.srcdir, extra_args=extra_args, inprocess=True) - def obtainMesonOutput(self, contents, match, extra_args, langs, meson_version): + def obtainMesonOutput(self, contents, match, extra_args, langs, meson_version=None): if langs is None: langs = [] with open(self.mbuild, 'w') as f: - core_version = '.'.join([str(component) for component in grab_leading_numbers(mesonbuild.coredata.version)]) - meson_version = meson_version or core_version - f.write("project('output test', 'c', 'cpp', meson_version: '{}')\n".format(meson_version)) + f.write("project('output test', 'c', 'cpp'") + if meson_version: + f.write(", meson_version: '{}'".format(meson_version)) + f.write(")\n") for lang in langs: f.write("add_languages('{}', required : false)\n".format(lang)) f.write(contents) @@ -2743,15 +2856,15 @@ class FailureTests(BasePlatformTests): def test_wx_notfound_dependency(self): # Want to test failure, so skip if available - if shutil.which('wx-config-3.0') or shutil.which('wx-config'): - raise unittest.SkipTest('wx-config or wx-config-3.0 found') + if shutil.which('wx-config-3.0') or shutil.which('wx-config') or shutil.which('wx-config-gtk3'): + raise unittest.SkipTest('wx-config, wx-config-3.0 or wx-config-gtk3 found') self.assertMesonRaises("dependency('wxwidgets')", self.dnf) self.assertMesonOutputs("dependency('wxwidgets', required : false)", "Dependency .*WxWidgets.* found: .*NO.*") def test_wx_dependency(self): - if not shutil.which('wx-config-3.0') and not shutil.which('wx-config'): - raise unittest.SkipTest('Neither wx-config nor wx-config-3.0 found') + if not shutil.which('wx-config-3.0') and not shutil.which('wx-config') and not shutil.which('wx-config-gtk3'): + raise unittest.SkipTest('Neither wx-config, wx-config-3.0 nor wx-config-gtk3 found') self.assertMesonRaises("dependency('wxwidgets', modules : 1)", "module argument is not a string") @@ -2860,7 +2973,7 @@ class FailureTests(BasePlatformTests): # Same as above, except the meson version is now appropriate self.assertMesonDoesNotOutput("dict = {}", ".*WARNING.*Project targetting.*but.*", - meson_version='>= 0.47.0') + meson_version='>= 0.47') def test_using_too_recent_feature_dependency(self): self.assertMesonOutputs("dependency('pcap', required: false)", @@ -2998,6 +3111,10 @@ class DarwinTests(BasePlatformTests): testdir = os.path.join(self.common_test_dir, '4 shared') # Try with bitcode enabled out = self.init(testdir, extra_args='-Db_bitcode=true') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(False) + if cc.id != 'clang': + raise unittest.SkipTest('Not using Clang on OSX') # Warning was printed self.assertRegex(out, 'WARNING:.*b_bitcode') # Compiler options were added @@ -3218,23 +3335,23 @@ class LinuxlikeTests(BasePlatformTests): self.assertIn(" -Werror ", c_command) @skipIfNoPkgconfig - def test_qt5dependency_pkgconfig_detection(self): + def test_qtdependency_pkgconfig_detection(self): ''' Test that qt4 and qt5 detection with pkgconfig works. ''' # Verify Qt4 or Qt5 can be found with pkg-config qt4 = subprocess.call(['pkg-config', '--exists', 'QtCore']) qt5 = subprocess.call(['pkg-config', '--exists', 'Qt5Core']) - if qt4 != 0 or qt5 != 0: - raise unittest.SkipTest('Qt not found with pkg-config') testdir = os.path.join(self.framework_test_dir, '4 qt') self.init(testdir, ['-Dmethod=pkg-config']) # Confirm that the dependency was found with pkg-config mesonlog = self.get_meson_log() - self.assertRegex('\n'.join(mesonlog), - r'Dependency qt4 \(modules: Core\) found: YES .*, `pkg-config`\n') - self.assertRegex('\n'.join(mesonlog), - r'Dependency qt5 \(modules: Core\) found: YES .*, `pkg-config`\n') + if qt4 == 0: + self.assertRegex('\n'.join(mesonlog), + r'Dependency qt4 \(modules: Core\) found: YES 4.* \(pkg-config\)\n') + if qt5 == 0: + self.assertRegex('\n'.join(mesonlog), + r'Dependency qt5 \(modules: Core\) found: YES 5.* \(pkg-config\)\n') def test_generate_gir_with_address_sanitizer(self): if is_cygwin(): @@ -3344,18 +3461,22 @@ class LinuxlikeTests(BasePlatformTests): for v in compiler.get_options()[lang_std].choices: if (compiler.get_id() == 'clang' and '17' in v and (version_compare(compiler.version, '<5.0.0') or - (compiler.clang_type == mesonbuild.compilers.CLANG_OSX and version_compare(compiler.version, '<9.1')))): + (compiler.compiler_type == mesonbuild.compilers.CompilerType.CLANG_OSX and version_compare(compiler.version, '<9.1')))): continue if (compiler.get_id() == 'clang' and '2a' in v and (version_compare(compiler.version, '<6.0.0') or - (compiler.clang_type == mesonbuild.compilers.CLANG_OSX and version_compare(compiler.version, '<9.1')))): + (compiler.compiler_type == mesonbuild.compilers.CompilerType.CLANG_OSX and version_compare(compiler.version, '<9.1')))): continue if (compiler.get_id() == 'gcc' and '2a' in v and version_compare(compiler.version, '<8.0.0')): continue std_opt = '{}={}'.format(lang_std, v) self.init(testdir, ['-D' + std_opt]) cmd = self.get_compdb()[0]['command'] - if v != 'none': + # c++03 and gnu++03 are not understood by ICC, don't try to look for them + skiplist = frozenset([ + ('intel', 'c++03'), + ('intel', 'gnu++03')]) + if v != 'none' and not (compiler.get_id(), v) in skiplist: cmd_std = " -std={} ".format(v) self.assertIn(cmd_std, cmd) try: @@ -3566,23 +3687,26 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.unit_test_dir, '6 std override') self.init(testdir) compdb = self.get_compdb() + # Don't try to use -std=c++03 as a check for the + # presence of a compiler flag, as ICC does not + # support it. for i in compdb: - if 'prog03' in i['file']: - c03_comp = i['command'] + if 'prog98' in i['file']: + c98_comp = i['command'] if 'prog11' in i['file']: c11_comp = i['command'] if 'progp' in i['file']: plain_comp = i['command'] self.assertNotEqual(len(plain_comp), 0) - self.assertIn('-std=c++03', c03_comp) - self.assertNotIn('-std=c++11', c03_comp) + self.assertIn('-std=c++98', c98_comp) + self.assertNotIn('-std=c++11', c98_comp) self.assertIn('-std=c++11', c11_comp) - self.assertNotIn('-std=c++03', c11_comp) - self.assertNotIn('-std=c++03', plain_comp) + self.assertNotIn('-std=c++98', c11_comp) + self.assertNotIn('-std=c++98', plain_comp) self.assertNotIn('-std=c++11', plain_comp) # Now werror self.assertIn('-Werror', plain_comp) - self.assertNotIn('-Werror', c03_comp) + self.assertNotIn('-Werror', c98_comp) def test_run_installed(self): if is_cygwin() or is_osx(): diff --git a/test cases/common/122 shared module/installed_files.txt b/test cases/common/122 shared module/installed_files.txt index a351490..4542a55 100644 --- a/test cases/common/122 shared module/installed_files.txt +++ b/test cases/common/122 shared module/installed_files.txt @@ -1 +1,2 @@ usr/lib/libnosyms.so +?msvc:usr/lib/libnosyms.pdb diff --git a/test cases/common/126 object only target/installed_files.txt b/test cases/common/126 object only target/installed_files.txt index c7dab9f..5e796b0 100644 --- a/test cases/common/126 object only target/installed_files.txt +++ b/test cases/common/126 object only target/installed_files.txt @@ -1 +1,2 @@ usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/196 install_mode/installed_files.txt b/test cases/common/196 install_mode/installed_files.txt index 724d954..c1de3e1 100644 --- a/test cases/common/196 install_mode/installed_files.txt +++ b/test cases/common/196 install_mode/installed_files.txt @@ -1,5 +1,6 @@ usr/bin/runscript.sh usr/bin/trivialprog?exe +?msvc:usr/bin/trivialprog.pdb usr/include/config.h usr/include/rootdir.h usr/libtest/libstat.a diff --git a/test cases/common/204 function attributes/meson.build b/test cases/common/204 function attributes/meson.build index bc049d7..e46533f 100644 --- a/test cases/common/204 function attributes/meson.build +++ b/test cases/common/204 function attributes/meson.build @@ -50,9 +50,15 @@ attributes = [ 'used', 'warn_unused_result', 'weak', - 'weakref', ] +if c.get_id() != 'intel' + # not supported by icc as of 19.0.0 + attributes += 'weakref' +endif + +expected_result = c.get_id() != 'msvc' + # These are unsupported on darwin with apple clang 9.1.0 if host_machine.system() != 'darwin' attributes += 'alias' diff --git a/test cases/common/25 library versions/installed_files.txt b/test cases/common/25 library versions/installed_files.txt index e10d1dd..c842ed8 100644 --- a/test cases/common/25 library versions/installed_files.txt +++ b/test cases/common/25 library versions/installed_files.txt @@ -1 +1,2 @@ usr/lib/prefixsomelib.suffix +?msvc:usr/lib/prefixsomelib.pdb diff --git a/test cases/common/43 library chain/installed_files.txt b/test cases/common/43 library chain/installed_files.txt index c7dab9f..5e796b0 100644 --- a/test cases/common/43 library chain/installed_files.txt +++ b/test cases/common/43 library chain/installed_files.txt @@ -1 +1,2 @@ usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/46 subproject/installed_files.txt b/test cases/common/46 subproject/installed_files.txt index dc09fb7..dba3202 100644 --- a/test cases/common/46 subproject/installed_files.txt +++ b/test cases/common/46 subproject/installed_files.txt @@ -1,2 +1,3 @@ usr/bin/user?exe +?msvc:usr/bin/user.pdb usr/share/sublib/sublib.depmf diff --git a/test cases/common/48 pkgconfig-gen/installed_files.txt b/test cases/common/48 pkgconfig-gen/installed_files.txt index 3c44d28..94de704 100644 --- a/test cases/common/48 pkgconfig-gen/installed_files.txt +++ b/test cases/common/48 pkgconfig-gen/installed_files.txt @@ -1,3 +1,4 @@ usr/include/simple.h usr/lib/pkgconfig/simple.pc usr/lib/pkgconfig/libfoo.pc +usr/lib/pkgconfig/libhello.pc diff --git a/test cases/common/49 custom install dirs/installed_files.txt b/test cases/common/49 custom install dirs/installed_files.txt index 0cc533a..7d24ce8 100644 --- a/test cases/common/49 custom install dirs/installed_files.txt +++ b/test cases/common/49 custom install dirs/installed_files.txt @@ -1,5 +1,7 @@ usr/dib/dab/dub/prog?exe +?msvc:usr/dib/dab/dub/prog.pdb usr/dib/dab/dub2/prog2?exe +?msvc:usr/dib/dab/dub2/prog2.pdb usr/some/dir/sample.h usr/some/dir2/sample.h usr/woman/prog.1.gz diff --git a/test cases/common/57 install script/installed_files.txt b/test cases/common/57 install script/installed_files.txt index 94c1fed..28f9ed0 100644 --- a/test cases/common/57 install script/installed_files.txt +++ b/test cases/common/57 install script/installed_files.txt @@ -1,4 +1,5 @@ usr/bin/prog?exe +?msvc:usr/bin/prog.pdb usr/diiba/daaba/file.dat usr/this/should/also-work.dat usr/this/does/something-different.dat.in diff --git a/test cases/common/6 linkshared/installed_files.txt b/test cases/common/6 linkshared/installed_files.txt index c7dab9f..5e796b0 100644 --- a/test cases/common/6 linkshared/installed_files.txt +++ b/test cases/common/6 linkshared/installed_files.txt @@ -1 +1,2 @@ usr/bin/prog?exe +?msvc:usr/bin/prog.pdb diff --git a/test cases/common/64 foreach/installed_files.txt b/test cases/common/64 foreach/installed_files.txt index 2930ff0..3376925 100644 --- a/test cases/common/64 foreach/installed_files.txt +++ b/test cases/common/64 foreach/installed_files.txt @@ -1,3 +1,6 @@ usr/bin/prog1?exe +?msvc:usr/bin/prog1.pdb usr/bin/prog2?exe +?msvc:usr/bin/prog2.pdb usr/bin/prog3?exe +?msvc:usr/bin/prog3.pdb diff --git a/test cases/common/8 install/installed_files.txt b/test cases/common/8 install/installed_files.txt index cbbdc03..d3122a7 100644 --- a/test cases/common/8 install/installed_files.txt +++ b/test cases/common/8 install/installed_files.txt @@ -1,2 +1,3 @@ usr/bin/prog?exe +?msvc:usr/bin/prog.pdb usr/libtest/libstat.a diff --git a/test cases/csharp/4 external dep/installed_files.txt b/test cases/csharp/4 external dep/installed_files.txt new file mode 100644 index 0000000..f64c68c --- /dev/null +++ b/test cases/csharp/4 external dep/installed_files.txt @@ -0,0 +1 @@ +usr/bin/prog.exe diff --git a/test cases/d/3 shared library/installed_files.txt b/test cases/d/3 shared library/installed_files.txt index 6658947..4e2c591 100644 --- a/test cases/d/3 shared library/installed_files.txt +++ b/test cases/d/3 shared library/installed_files.txt @@ -2,3 +2,4 @@ usr/bin/app_d?exe ?msvc:usr/bin/stuff.dll ?msvc:usr/lib/stuff.lib ?gcc:usr/lib/libstuff.so +usr/lib/pkgconfig/test.pc diff --git a/test cases/d/3 shared library/meson.build b/test cases/d/3 shared library/meson.build index 64f972b..b37b700 100644 --- a/test cases/d/3 shared library/meson.build +++ b/test cases/d/3 shared library/meson.build @@ -11,13 +11,11 @@ ldyn = shared_library('stuff', 'libstuff.d', install : true) ed = executable('app_d', 'app.d', link_with : ldyn, install : true) test('linktest_dyn', ed) -if host_machine.system() != 'windows' - # test D attributes for pkg-config - pkgc = import('pkgconfig') - pkgc.generate(name: 'test', - libraries: ldyn, - subdirs: 'd/stuff', - description: 'A test of D attributes to pkgconfig.generate.', - d_module_versions: ['Use_Static'] - ) -endif +# test D attributes for pkg-config +pkgc = import('pkgconfig') +pkgc.generate(name: 'test', + libraries: ldyn, + subdirs: 'd/stuff', + description: 'A test of D attributes to pkgconfig.generate.', + d_module_versions: ['Use_Static'] +) diff --git a/test cases/d/5 mixed/installed_files.txt b/test cases/d/5 mixed/installed_files.txt index 5f3f4e2..5950753 100644 --- a/test cases/d/5 mixed/installed_files.txt +++ b/test cases/d/5 mixed/installed_files.txt @@ -3,4 +3,6 @@ usr/bin/appdc_s?exe usr/lib/libstuff.a ?gcc:usr/lib/libstuff.so ?msvc:usr/bin/stuff.dll +?msvc:usr/bin/stuff.pdb ?msvc:usr/lib/stuff.lib +?msvc:usr/lib/stuff.pdb diff --git a/test cases/frameworks/12 multiple gir/installed_files.txt b/test cases/frameworks/12 multiple gir/installed_files.txt index a5d16bc..3f9a8f2 100644 --- a/test cases/frameworks/12 multiple gir/installed_files.txt +++ b/test cases/frameworks/12 multiple gir/installed_files.txt @@ -1,6 +1,8 @@ usr/lib/girepository-1.0/Meson-1.0.typelib usr/lib/girepository-1.0/MesonSub-1.0.typelib usr/lib/?libgirlib.so +?cygwin:usr/lib/libgirlib.dll.a usr/lib/?libgirsubproject.so +?cygwin:usr/lib/libgirsubproject.dll.a usr/share/gir-1.0/Meson-1.0.gir usr/share/gir-1.0/MesonSub-1.0.gir diff --git a/test cases/frameworks/23 hotdoc/installed_files.txt b/test cases/frameworks/23 hotdoc/installed_files.txt new file mode 100644 index 0000000..6804dbf --- /dev/null +++ b/test cases/frameworks/23 hotdoc/installed_files.txt @@ -0,0 +1,304 @@ +usr/share/doc/foobar/html/foo.html +usr/share/doc/foobar/html/c-index.html +usr/share/doc/foobar/html/index.html +usr/share/doc/foobar/html/dumped.trie +usr/share/doc/foobar/html/assets/css/prism.css +usr/share/doc/foobar/html/assets/css/bootstrap-toc.min.css +usr/share/doc/foobar/html/assets/css/frontend.css +usr/share/doc/foobar/html/assets/css/dumped.trie +usr/share/doc/foobar/html/assets/css/jquery.mCustomScrollbar.min.css +usr/share/doc/foobar/html/assets/css/custom_bootstrap.css +usr/share/doc/foobar/html/assets/templates/navbar_links.html +usr/share/doc/foobar/html/assets/templates/scripts.html +usr/share/doc/foobar/html/assets/templates/stylesheets.html +usr/share/doc/foobar/html/assets/templates/multi_return_value.html +usr/share/doc/foobar/html/assets/templates/parameters.html +usr/share/doc/foobar/html/assets/templates/base_page.html +usr/share/doc/foobar/html/assets/templates/footer.html +usr/share/doc/foobar/html/assets/templates/extra_head.html +usr/share/doc/foobar/html/assets/templates/parameter_detail.html +usr/share/doc/foobar/html/assets/templates/navbar_center.html +usr/share/doc/foobar/html/assets/templates/enum_member.html +usr/share/doc/foobar/html/assets/templates/member_list.html +usr/share/doc/foobar/html/assets/templates/return_item.html +usr/share/doc/foobar/html/assets/templates/subpages.html +usr/share/doc/foobar/html/assets/templates/dumped.trie +usr/share/doc/foobar/html/assets/templates/page_content.html +usr/share/doc/foobar/html/assets/templates/navbar.html +usr/share/doc/foobar/html/assets/templates/site_navigation.html +usr/share/doc/foobar/html/assets/templates/field_detail.html +usr/share/doc/foobar/html/assets/templates/brand-logo.html +usr/share/doc/foobar/html/assets/js/prism_autoloader_path_override.js +usr/share/doc/foobar/html/assets/js/jquery.js +usr/share/doc/foobar/html/assets/js/scrollspy.js +usr/share/doc/foobar/html/assets/js/isotope.pkgd.min.js +usr/share/doc/foobar/html/assets/js/utils.js +usr/share/doc/foobar/html/assets/js/typeahead.jquery.min.js +usr/share/doc/foobar/html/assets/js/language_switching.js +usr/share/doc/foobar/html/assets/js/tag_filtering.js +usr/share/doc/foobar/html/assets/js/prism-autoloader.js +usr/share/doc/foobar/html/assets/js/navbar_offset_scroller.js +usr/share/doc/foobar/html/assets/js/lines_around_headings.js +usr/share/doc/foobar/html/assets/js/trie_index.js +usr/share/doc/foobar/html/assets/js/search.js +usr/share/doc/foobar/html/assets/js/trie.js +usr/share/doc/foobar/html/assets/js/bootstrap.js +usr/share/doc/foobar/html/assets/js/navigation.js +usr/share/doc/foobar/html/assets/js/bootstrap-toc.min.js +usr/share/doc/foobar/html/assets/js/anchor.min.js +usr/share/doc/foobar/html/assets/js/prism-core.js +usr/share/doc/foobar/html/assets/js/sitemap.js +usr/share/doc/foobar/html/assets/js/dumped.trie +usr/share/doc/foobar/html/assets/js/mustache.min.js +usr/share/doc/foobar/html/assets/js/compare-versions.js +usr/share/doc/foobar/html/assets/js/jquery.touchSwipe.min.js +usr/share/doc/foobar/html/assets/js/jquery.mCustomScrollbar.concat.min.js +usr/share/doc/foobar/html/assets/js/search/members +usr/share/doc/foobar/html/assets/js/search/Hello +usr/share/doc/foobar/html/assets/js/search/hello +usr/share/doc/foobar/html/assets/js/search/type +usr/share/doc/foobar/html/assets/js/search/FooIndecision +usr/share/doc/foobar/html/assets/js/search/fooindecision +usr/share/doc/foobar/html/assets/js/search/Members +usr/share/doc/foobar/html/assets/js/search/dumped.trie +usr/share/doc/foobar/html/assets/js/search/indecision +usr/share/doc/foobar/html/assets/js/search/hotdoc_fragments/index.html-hello-world.fragment +usr/share/doc/foobar/html/assets/js/search/hotdoc_fragments/dumped.trie +usr/share/doc/foobar/html/assets/js/search/hotdoc_fragments/foo.html-FooIndecision.fragment +usr/share/doc/foobar/html/assets/prism_components/prism-inform7.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-pascal.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-bro.js +usr/share/doc/foobar/html/assets/prism_components/prism-nim.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-gherkin.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-stylus.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-ocaml.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-powershell.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-smalltalk.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-verilog.js +usr/share/doc/foobar/html/assets/prism_components/prism-puppet.js +usr/share/doc/foobar/html/assets/prism_components/prism-aspnet.js +usr/share/doc/foobar/html/assets/prism_components/prism-parigp.js +usr/share/doc/foobar/html/assets/prism_components/prism-objectivec.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-processing.js +usr/share/doc/foobar/html/assets/prism_components/prism-objectivec.js +usr/share/doc/foobar/html/assets/prism_components/prism-jsx.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nginx.js +usr/share/doc/foobar/html/assets/prism_components/prism-powershell.js +usr/share/doc/foobar/html/assets/prism_components/prism-php.js +usr/share/doc/foobar/html/assets/prism_components/prism-smarty.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-roboconf.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-batch.js +usr/share/doc/foobar/html/assets/prism_components/prism-vhdl.js +usr/share/doc/foobar/html/assets/prism_components/prism-protobuf.js +usr/share/doc/foobar/html/assets/prism_components/prism-textile.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-crystal.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-scss.js +usr/share/doc/foobar/html/assets/prism_components/prism-bro.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-smarty.js +usr/share/doc/foobar/html/assets/prism_components/prism-bison.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-tcl.js +usr/share/doc/foobar/html/assets/prism_components/prism-pure.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-makefile.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-applescript.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-css-extras.js +usr/share/doc/foobar/html/assets/prism_components/prism-stylus.js +usr/share/doc/foobar/html/assets/prism_components/prism-q.js +usr/share/doc/foobar/html/assets/prism_components/prism-dart.js +usr/share/doc/foobar/html/assets/prism_components/prism-oz.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-haskell.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-clike.js +usr/share/doc/foobar/html/assets/prism_components/prism-kotlin.js +usr/share/doc/foobar/html/assets/prism_components/prism-http.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-bash.js +usr/share/doc/foobar/html/assets/prism_components/prism-apl.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-docker.js +usr/share/doc/foobar/html/assets/prism_components/prism-sass.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-basic.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nasm.js +usr/share/doc/foobar/html/assets/prism_components/prism-kotlin.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-abap.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-perl.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-rust.js +usr/share/doc/foobar/html/assets/prism_components/prism-c.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-scala.js +usr/share/doc/foobar/html/assets/prism_components/prism-glsl.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-lua.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-coffeescript.js +usr/share/doc/foobar/html/assets/prism_components/prism-jade.js +usr/share/doc/foobar/html/assets/prism_components/prism-keyman.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-crystal.js +usr/share/doc/foobar/html/assets/prism_components/prism-rest.js +usr/share/doc/foobar/html/assets/prism_components/prism-json.js +usr/share/doc/foobar/html/assets/prism_components/prism-roboconf.js +usr/share/doc/foobar/html/assets/prism_components/prism-twig.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-dart.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-vim.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-handlebars.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-cpp.js +usr/share/doc/foobar/html/assets/prism_components/prism-fsharp.js +usr/share/doc/foobar/html/assets/prism_components/prism-sas.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-brainfuck.js +usr/share/doc/foobar/html/assets/prism_components/prism-haxe.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-julia.js +usr/share/doc/foobar/html/assets/prism_components/prism-jade.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-python.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nim.js +usr/share/doc/foobar/html/assets/prism_components/prism-typescript.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-csharp.js +usr/share/doc/foobar/html/assets/prism_components/prism-brainfuck.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-asciidoc.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-groovy.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-applescript.js +usr/share/doc/foobar/html/assets/prism_components/prism-elixir.js +usr/share/doc/foobar/html/assets/prism_components/prism-diff.js +usr/share/doc/foobar/html/assets/prism_components/prism-scheme.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-parser.js +usr/share/doc/foobar/html/assets/prism_components/prism-qore.js +usr/share/doc/foobar/html/assets/prism_components/prism-yaml.js +usr/share/doc/foobar/html/assets/prism_components/prism-j.js +usr/share/doc/foobar/html/assets/prism_components/prism-mel.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-css-extras.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-erlang.js +usr/share/doc/foobar/html/assets/prism_components/prism-icon.js +usr/share/doc/foobar/html/assets/prism_components/prism-actionscript.js +usr/share/doc/foobar/html/assets/prism_components/prism-cpp.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-makefile.js +usr/share/doc/foobar/html/assets/prism_components/prism-q.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nsis.js +usr/share/doc/foobar/html/assets/prism_components/prism-mizar.js +usr/share/doc/foobar/html/assets/prism_components/prism-wiki.js +usr/share/doc/foobar/html/assets/prism_components/prism-csharp.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-julia.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-coffeescript.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-sql.js +usr/share/doc/foobar/html/assets/prism_components/prism-php-extras.js +usr/share/doc/foobar/html/assets/prism_components/prism-basic.js +usr/share/doc/foobar/html/assets/prism_components/prism-swift.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-haxe.js +usr/share/doc/foobar/html/assets/prism_components/prism-apacheconf.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-javascript.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-markup.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-keyman.js +usr/share/doc/foobar/html/assets/prism_components/prism-sql.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-php-extras.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-scheme.js +usr/share/doc/foobar/html/assets/prism_components/prism-python.js +usr/share/doc/foobar/html/assets/prism_components/prism-autoit.js +usr/share/doc/foobar/html/assets/prism_components/prism-gherkin.js +usr/share/doc/foobar/html/assets/prism_components/prism-java.js +usr/share/doc/foobar/html/assets/prism_components/prism-parigp.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-autohotkey.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-ruby.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nginx.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-core.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-fortran.js +usr/share/doc/foobar/html/assets/prism_components/prism-nasm.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-ini.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-protobuf.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-jsx.js +usr/share/doc/foobar/html/assets/prism_components/prism-markdown.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nix.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nsis.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-oz.js +usr/share/doc/foobar/html/assets/prism_components/prism-less.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-abap.js +usr/share/doc/foobar/html/assets/prism_components/prism-puppet.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-nix.js +usr/share/doc/foobar/html/assets/prism_components/prism-pascal.js +usr/share/doc/foobar/html/assets/prism_components/prism-latex.js +usr/share/doc/foobar/html/assets/prism_components/prism-verilog.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-aspnet.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-go.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-glsl.js +usr/share/doc/foobar/html/assets/prism_components/prism-inform7.js +usr/share/doc/foobar/html/assets/prism_components/prism-yaml.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-matlab.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-lua.js +usr/share/doc/foobar/html/assets/prism_components/prism-mizar.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-c.js +usr/share/doc/foobar/html/assets/prism_components/prism-fsharp.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-haml.js +usr/share/doc/foobar/html/assets/prism_components/prism-rust.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-icon.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-fortran.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-qore.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-batch.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-eiffel.js +usr/share/doc/foobar/html/assets/prism_components/prism-vim.js +usr/share/doc/foobar/html/assets/prism_components/prism-j.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-eiffel.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-elixir.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-erlang.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-matlab.js +usr/share/doc/foobar/html/assets/prism_components/prism-tcl.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-ruby.js +usr/share/doc/foobar/html/assets/prism_components/prism-d.js +usr/share/doc/foobar/html/assets/prism_components/prism-swift.js +usr/share/doc/foobar/html/assets/prism_components/prism-wiki.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-lolcode.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-latex.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-prolog.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-php.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-scss.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-vhdl.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-lolcode.js +usr/share/doc/foobar/html/assets/prism_components/prism-prolog.js +usr/share/doc/foobar/html/assets/prism_components/prism-apacheconf.js +usr/share/doc/foobar/html/assets/prism_components/prism-core.js +usr/share/doc/foobar/html/assets/prism_components/prism-diff.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-json.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-ini.js +usr/share/doc/foobar/html/assets/prism_components/dumped.trie +usr/share/doc/foobar/html/assets/prism_components/prism-r.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-markup.js +usr/share/doc/foobar/html/assets/prism_components/prism-apl.js +usr/share/doc/foobar/html/assets/prism_components/prism-markdown.js +usr/share/doc/foobar/html/assets/prism_components/prism-asciidoc.js +usr/share/doc/foobar/html/assets/prism_components/prism-ocaml.js +usr/share/doc/foobar/html/assets/prism_components/prism-javascript.js +usr/share/doc/foobar/html/assets/prism_components/prism-autohotkey.js +usr/share/doc/foobar/html/assets/prism_components/prism-less.js +usr/share/doc/foobar/html/assets/prism_components/prism-pure.js +usr/share/doc/foobar/html/assets/prism_components/prism-groovy.js +usr/share/doc/foobar/html/assets/prism_components/prism-bison.js +usr/share/doc/foobar/html/assets/prism_components/prism-sass.js +usr/share/doc/foobar/html/assets/prism_components/prism-css.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-haml.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-handlebars.js +usr/share/doc/foobar/html/assets/prism_components/prism-textile.js +usr/share/doc/foobar/html/assets/prism_components/prism-parser.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-docker.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-monkey.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-http.js +usr/share/doc/foobar/html/assets/prism_components/prism-git.js +usr/share/doc/foobar/html/assets/prism_components/prism-sas.js +usr/share/doc/foobar/html/assets/prism_components/prism-go.js +usr/share/doc/foobar/html/assets/prism_components/prism-mel.js +usr/share/doc/foobar/html/assets/prism_components/prism-rest.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-clike.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-d.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-haskell.js +usr/share/doc/foobar/html/assets/prism_components/prism-git.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-java.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-rip.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-perl.js +usr/share/doc/foobar/html/assets/prism_components/prism-typescript.js +usr/share/doc/foobar/html/assets/prism_components/prism-actionscript.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-autoit.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-rip.js +usr/share/doc/foobar/html/assets/prism_components/prism-twig.js +usr/share/doc/foobar/html/assets/prism_components/prism-monkey.js +usr/share/doc/foobar/html/assets/prism_components/prism-processing.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-scala.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-smalltalk.js +usr/share/doc/foobar/html/assets/prism_components/prism-bash.min.js +usr/share/doc/foobar/html/assets/prism_components/prism-r.js +usr/share/doc/foobar/html/assets/prism_components/prism-css.js +usr/share/doc/foobar/html/assets/fonts/glyphicons-halflings-regular.woff +usr/share/doc/foobar/html/assets/fonts/glyphicons-halflings-regular.woff2 +usr/share/doc/foobar/html/assets/fonts/glyphicons-halflings-regular.svg +usr/share/doc/foobar/html/assets/fonts/glyphicons-halflings-regular.ttf +usr/share/doc/foobar/html/assets/fonts/glyphicons-halflings-regular.eot +usr/share/doc/foobar/html/assets/fonts/dumped.trie +usr/share/doc/foobar/html/assets/images/home.svg +usr/share/doc/foobar/html/assets/images/dumped.trie diff --git a/test cases/frameworks/6 gettext/data2/meson.build b/test cases/frameworks/6 gettext/data2/meson.build new file mode 100644 index 0000000..d927ba3 --- /dev/null +++ b/test cases/frameworks/6 gettext/data2/meson.build @@ -0,0 +1,8 @@ +i18n.merge_file( + input: 'test.desktop.in', + output: 'test.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) diff --git a/test cases/frameworks/6 gettext/data2/test.desktop.in b/test cases/frameworks/6 gettext/data2/test.desktop.in new file mode 100644 index 0000000..33b9a9f --- /dev/null +++ b/test cases/frameworks/6 gettext/data2/test.desktop.in @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Test +GenericName=Application +Comment=Test Application +Type=Application + diff --git a/test cases/frameworks/6 gettext/meson.build b/test cases/frameworks/6 gettext/meson.build index e02234b..9b84856 100644 --- a/test cases/frameworks/6 gettext/meson.build +++ b/test cases/frameworks/6 gettext/meson.build @@ -14,3 +14,4 @@ i18n = import('i18n') subdir('po') subdir('src') subdir('data') +subdir('data2') diff --git a/test cases/frameworks/7 gnome/installed_files.txt b/test cases/frameworks/7 gnome/installed_files.txt index 7502888..281b000 100644 --- a/test cases/frameworks/7 gnome/installed_files.txt +++ b/test cases/frameworks/7 gnome/installed_files.txt @@ -4,6 +4,7 @@ usr/include/enums3.h usr/include/enums5.h usr/include/marshaller.h usr/lib/?libgir_lib.so +usr/lib/?libgir_lib2.so usr/lib/?libdep1lib.so usr/lib/?libdep2lib.so usr/lib/girepository-1.0/Meson-1.0.typelib @@ -14,5 +15,6 @@ usr/share/gir-1.0/MesonDep1-1.0.gir usr/share/gir-1.0/MesonDep2-1.0.gir usr/share/glib-2.0/schemas/com.github.meson.gschema.xml usr/share/simple-resources.gresource +usr/include/enums6.h usr/include/simple-resources.h usr/include/generated-gdbus.h diff --git a/test cases/osx/4 framework/installed_files.txt b/test cases/osx/4 framework/installed_files.txt new file mode 100644 index 0000000..2c6bd93 --- /dev/null +++ b/test cases/osx/4 framework/installed_files.txt @@ -0,0 +1,2 @@ +usr/bin/prog +usr/lib/libstat.a diff --git a/test cases/unit/35 dist script/replacer.py b/test cases/unit/35 dist script/replacer.py index 92bcef0..adda365 100755 --- a/test cases/unit/35 dist script/replacer.py +++ b/test cases/unit/35 dist script/replacer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import os, sys +import os import pathlib source_root = pathlib.Path(os.environ['MESON_DIST_ROOT']) diff --git a/test cases/unit/39 python extmodule/meson.build b/test cases/unit/39 python extmodule/meson.build index 4798654..eb00a6a 100644 --- a/test cases/unit/39 python extmodule/meson.build +++ b/test cases/unit/39 python extmodule/meson.build @@ -21,3 +21,6 @@ if py.found() else error('MESON_SKIP_TEST: Python not found, skipping test.') endif + +py = py_mod.find_installation(get_option('python'), required : get_option('disabled_opt')) +assert(not py.found(), 'find_installation not working with disabled feature') diff --git a/test cases/unit/39 python extmodule/meson_options.txt b/test cases/unit/39 python extmodule/meson_options.txt index b8f645d..c85110d 100644 --- a/test cases/unit/39 python extmodule/meson_options.txt +++ b/test cases/unit/39 python extmodule/meson_options.txt @@ -1,3 +1,4 @@ option('python', type: 'string', description: 'Name of or path to the python executable' ) +option('disabled_opt', type: 'feature', value: 'disabled') diff --git a/test cases/unit/41 featurenew subprojects/meson.build b/test cases/unit/41 featurenew subprojects/meson.build index 27898cd..d136bed 100644 --- a/test cases/unit/41 featurenew subprojects/meson.build +++ b/test cases/unit/41 featurenew subprojects/meson.build @@ -4,3 +4,4 @@ foo = {} subproject('foo') subproject('bar') +subproject('baz') diff --git a/test cases/unit/41 featurenew subprojects/subprojects/baz/meson.build b/test cases/unit/41 featurenew subprojects/subprojects/baz/meson.build new file mode 100644 index 0000000..811e7aa --- /dev/null +++ b/test cases/unit/41 featurenew subprojects/subprojects/baz/meson.build @@ -0,0 +1,3 @@ +project('baz subproject', meson_version: '!=0.40') + +disabler() diff --git a/test cases/unit/6 std override/meson.build b/test cases/unit/6 std override/meson.build index ef2baac..0eac752 100644 --- a/test cases/unit/6 std override/meson.build +++ b/test cases/unit/6 std override/meson.build @@ -1,10 +1,10 @@ project('cpp std override', 'cpp', - default_options : ['cpp_std=c++03', + default_options : ['cpp_std=c++98', 'werror=true']) executable('plain', 'progp.cpp', override_options : 'cpp_std=none') -executable('v03', 'prog03.cpp', +executable('v98', 'prog98.cpp', override_options : 'werror=false') executable('v11', 'prog11.cpp', override_options : 'cpp_std=c++11') diff --git a/test cases/unit/6 std override/prog03.cpp b/test cases/unit/6 std override/prog98.cpp index d30abc9..67c326d 100644 --- a/test cases/unit/6 std override/prog03.cpp +++ b/test cases/unit/6 std override/prog98.cpp @@ -1,6 +1,6 @@ #include<iostream> int main(int argc, char **argv) { - std::cout << "I am a c++03 test program.\n"; + std::cout << "I am a c++98 test program.\n"; return 0; } diff --git a/test cases/vala/11 generated vapi/installed_files.txt b/test cases/vala/11 generated vapi/installed_files.txt index aeaf2da..ca41d65 100644 --- a/test cases/vala/11 generated vapi/installed_files.txt +++ b/test cases/vala/11 generated vapi/installed_files.txt @@ -1,6 +1,8 @@ -usr/bin/vapigen-test +usr/bin/vapigen-test?exe usr/lib/?libfoo.so +?cygwin:usr/lib/libfoo.dll.a usr/lib/?libbar.so +?cygwin:usr/lib/libbar.dll.a usr/share/vala/vapi/foo-1.0.vapi usr/share/vala/vapi/foo-1.0.deps usr/share/vala/vapi/bar-1.0.vapi diff --git a/test cases/vala/7 shared library/installed_files.txt b/test cases/vala/7 shared library/installed_files.txt index 012b107..83cbb63 100644 --- a/test cases/vala/7 shared library/installed_files.txt +++ b/test cases/vala/7 shared library/installed_files.txt @@ -1,5 +1,7 @@ usr/lib/?libinstalled_vala_lib.so +?cygwin:usr/lib/libinstalled_vala_lib.dll.a usr/lib/?libinstalled_vala_all.so +?cygwin:usr/lib/libinstalled_vala_all.dll.a usr/include/installed_vala_all.h usr/include/valah/installed_vala_all_nolib.h usr/include/installed_vala_onlyh.h diff --git a/test cases/vala/8 generated sources/installed_files.txt b/test cases/vala/8 generated sources/installed_files.txt index e1e9432..ae0f65f 100644 --- a/test cases/vala/8 generated sources/installed_files.txt +++ b/test cases/vala/8 generated sources/installed_files.txt @@ -1,2 +1,3 @@ -usr/bin/generatedtest -usr/bin/onlygentest +usr/bin/generatedtestparent?exe +usr/bin/generatedtest?exe +usr/bin/onlygentest?exe diff --git a/test cases/vala/9 gir/installed_files.txt b/test cases/vala/9 gir/installed_files.txt index 64bddee..890b47a 100644 --- a/test cases/vala/9 gir/installed_files.txt +++ b/test cases/vala/9 gir/installed_files.txt @@ -1,2 +1,3 @@ -usr/lib/?libfoo.so +?gcc:usr/lib/?libfoo.so +?cygwin:usr/lib/libfoo.dll.a usr/share/gir-1.0/Foo-1.0.gir diff --git a/test cases/windows/1 basic/installed_files.txt b/test cases/windows/1 basic/installed_files.txt index 8c8464a..5022d28 100644 --- a/test cases/windows/1 basic/installed_files.txt +++ b/test cases/windows/1 basic/installed_files.txt @@ -1,2 +1,2 @@ usr/bin/prog.exe -usr/bin/prog.pdb +?msvc:usr/bin/prog.pdb diff --git a/test cases/windows/11 exe implib/installed_files.txt b/test cases/windows/11 exe implib/installed_files.txt index bd2abe9..b1e805c 100644 --- a/test cases/windows/11 exe implib/installed_files.txt +++ b/test cases/windows/11 exe implib/installed_files.txt @@ -1,7 +1,7 @@ usr/bin/prog.exe -usr/bin/prog.pdb +?msvc:usr/bin/prog.pdb usr/bin/prog2.exe -usr/bin/prog2.pdb +?msvc:usr/bin/prog2.pdb ?gcc:usr/lib/libprog.exe.a ?gcc:usr/lib/libburble.a ?msvc:usr/lib/prog.exe.lib diff --git a/test cases/windows/7 dll versioning/installed_files.txt b/test cases/windows/7 dll versioning/installed_files.txt index 20482bf..517620e 100644 --- a/test cases/windows/7 dll versioning/installed_files.txt +++ b/test cases/windows/7 dll versioning/installed_files.txt @@ -4,14 +4,19 @@ ?msvc:usr/bin/noversion.dll ?msvc:usr/bin/noversion.pdb ?msvc:usr/lib/noversion.lib +?msvc:usr/lib/noversion.pdb ?msvc:usr/bin/onlyversion-1.dll +?msvc:usr/bin/onlyversion-1.pdb ?msvc:usr/lib/onlyversion.lib ?msvc:usr/bin/onlysoversion-5.dll +?msvc:usr/bin/onlysoversion-5.pdb ?msvc:usr/lib/onlysoversion.lib ?msvc:usr/libexec/customdir.dll ?msvc:usr/libexec/customdir.lib +?msvc:usr/libexec/customdir.pdb ?msvc:usr/lib/module.dll ?msvc:usr/lib/module.lib +?msvc:usr/lib/module.pdb ?gcc:usr/bin/?libsome-0.dll ?gcc:usr/lib/libsome.dll.a ?gcc:usr/bin/?libnoversion.dll diff --git a/tools/dircondenser.py b/tools/dircondenser.py index c87b967..58c44a2 100755 --- a/tools/dircondenser.py +++ b/tools/dircondenser.py @@ -67,7 +67,7 @@ def condense(dirname): i = _i + 1 if e[0] != i: old_name = str(e[0]) + ' ' + e[1] - new_name = str(i) + ' ' + e[1] + new_name = str(i) + ' ' + e[1] #print('git mv "%s" "%s"' % (old_name, new_name)) subprocess.check_call(['git', 'mv', old_name, new_name]) replacements.append((old_name, new_name)) |