aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ci/install-dmd.ps12
-rw-r--r--ciimage/Dockerfile1
-rw-r--r--data/macros.meson1
-rw-r--r--docs/markdown/Dependencies.md9
-rw-r--r--docs/markdown/Subprojects.md11
-rw-r--r--docs/markdown/snippets/gpgme-config.md3
-rw-r--r--docs/markdown/snippets/introRemovedTargetFiles.md4
-rw-r--r--docs/markdown/snippets/subproject-foreach.md7
-rw-r--r--mesonbuild/backend/backends.py1
-rw-r--r--mesonbuild/compilers/d.py10
-rw-r--r--mesonbuild/compilers/fortran.py35
-rw-r--r--mesonbuild/coredata.py260
-rw-r--r--mesonbuild/dependencies/__init__.py3
-rw-r--r--mesonbuild/dependencies/base.py24
-rw-r--r--mesonbuild/dependencies/misc.py31
-rw-r--r--mesonbuild/mintro.py32
-rw-r--r--mesonbuild/modules/python.py19
-rw-r--r--mesonbuild/msetup.py8
-rwxr-xr-x[-rw-r--r--]mesonbuild/msubprojects.py37
-rw-r--r--mesonbuild/mtest.py19
-rw-r--r--mesonbuild/optinterpreter.py9
-rw-r--r--mesonbuild/scripts/symbolextractor.py9
-rw-r--r--mesonbuild/scripts/vcstagger.py8
-rwxr-xr-xrun_cross_test.py2
-rwxr-xr-xrun_project_tests.py2
-rwxr-xr-xrun_unittests.py49
-rwxr-xr-xtest cases/frameworks/17 mpi/is_broken_ubuntu.py9
-rw-r--r--test cases/frameworks/17 mpi/main.f9051
-rw-r--r--test cases/frameworks/17 mpi/meson.build22
-rw-r--r--test cases/frameworks/27 gpgme/gpgme_prog.c8
-rw-r--r--test cases/frameworks/27 gpgme/meson.build21
-rw-r--r--test cases/python/1 basic/meson.build2
-rw-r--r--test cases/unit/55 pkg_config_path option/extra_path/totally_made_up_dep.pc7
-rw-r--r--test cases/unit/55 pkg_config_path option/meson.build3
34 files changed, 422 insertions, 297 deletions
diff --git a/ci/install-dmd.ps1 b/ci/install-dmd.ps1
index aeacdf2..fd13317 100644
--- a/ci/install-dmd.ps1
+++ b/ci/install-dmd.ps1
@@ -9,8 +9,8 @@ $ProgressPreference = "SilentlyContinue"
$dmd_install = "C:\D"
$dmd_version_file = "C:\cache\DMD_LATEST"
-#echo "Fetching latest DMD version..."
if (!$Version) {
+ #echo "Fetching latest DMD version..."
$dmd_latest_url = "http://downloads.dlang.org/releases/LATEST"
$retries = 10
for ($i = 1; $i -le $retries; $i++) {
diff --git a/ciimage/Dockerfile b/ciimage/Dockerfile
index 980ed53..d5f4816 100644
--- a/ciimage/Dockerfile
+++ b/ciimage/Dockerfile
@@ -20,6 +20,7 @@ RUN sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" \
&& apt-get -y install --no-install-recommends wine-stable \
&& apt-get -y install llvm-dev libclang-dev \
&& apt-get -y install libgcrypt11-dev \
+&& apt-get -y install libgpgme-dev \
&& apt-get -y install libhdf5-dev \
&& dub fetch urld && dub build urld --compiler=gdc \
&& dub fetch dubtestproject \
diff --git a/data/macros.meson b/data/macros.meson
index 73a31ab..05d21e5 100644
--- a/data/macros.meson
+++ b/data/macros.meson
@@ -21,7 +21,6 @@
--sharedstatedir=%{_sharedstatedir} \
--wrap-mode=%{__meson_wrap_mode} \
--auto-features=%{__meson_auto_features} \
- -Db_ndebug=true \
%{_vpath_srcdir} %{_vpath_builddir} \
%{nil}}
diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md
index bd07524..2789ee0 100644
--- a/docs/markdown/Dependencies.md
+++ b/docs/markdown/Dependencies.md
@@ -200,7 +200,7 @@ wmf_dep = dependency('libwmf', method : 'config-tool')
## Dependencies using config tools
[CUPS](#cups), [LLVM](#llvm), [pcap](#pcap), [WxWidgets](#wxwidgets),
-[libwmf](#libwmf), [GCrypt](#libgcrypt), and GnuStep either do not provide pkg-config
+[libwmf](#libwmf), [GCrypt](#libgcrypt), [GPGME](#gpgme), and GnuStep either do not provide pkg-config
modules or additionally can be detected via a config tool
(cups-config, llvm-config, libgcrypt-config, etc). Meson has native support for these
tools, and they can be found like other dependencies:
@@ -210,6 +210,7 @@ pcap_dep = dependency('pcap', version : '>=1.0')
cups_dep = dependency('cups', version : '>=1.4')
llvm_dep = dependency('llvm', version : '>=4.0')
libgcrypt_dep = dependency('libgcrypt', version: '>= 1.8')
+gpgme_dep = dependency('gpgme', version: '>= 1.0')
```
## AppleFrameworks
@@ -389,6 +390,12 @@ The `language` keyword may used.
`method` may be `auto`, `config-tool` or `pkg-config`.
+## GPGME
+
+*(added 0.51.0)*
+
+`method` may be `auto` or `config-tool`.
+
## Python3
Python3 is handled specially by meson:
diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md
index 24b8af6..2546441 100644
--- a/docs/markdown/Subprojects.md
+++ b/docs/markdown/Subprojects.md
@@ -235,12 +235,21 @@ To pull latest version of all your subprojects at once, just run the command:
The command-line `meson subprojects checkout <branch_name>` will checkout a
branch, or create one with `-b` argument, in every git subprojects. This is
useful when starting local changes across multiple subprojects. It is still your
-responsability to commit and push in each repository where you made local
+responsibility to commit and push in each repository where you made local
changes.
To come back to the revision set in wrap file (i.e. master), just run
`meson subprojects checkout` with no branch name.
+## Execute a command on all subprojects
+
+*Since 0.51.0*
+
+The command-line `meson subprojects foreach <command> [...]` will
+execute a command in each subproject directory. For example this can be useful
+to check the status of subprojects (e.g. with `git status` or `git diff`) before
+performing other actions on them.
+
## Why must all subprojects be inside a single directory?
There are several reasons.
diff --git a/docs/markdown/snippets/gpgme-config.md b/docs/markdown/snippets/gpgme-config.md
new file mode 100644
index 0000000..08a7d38
--- /dev/null
+++ b/docs/markdown/snippets/gpgme-config.md
@@ -0,0 +1,3 @@
+## gpgme dependency now supports gpgme-config
+
+Previously, we could only detect GPGME with custom invocations of `gpgme-config`. Now we added support to Meson allowing us to use `dependency('gpgme')` instead.
diff --git a/docs/markdown/snippets/introRemovedTargetFiles.md b/docs/markdown/snippets/introRemovedTargetFiles.md
new file mode 100644
index 0000000..bd86f45
--- /dev/null
+++ b/docs/markdown/snippets/introRemovedTargetFiles.md
@@ -0,0 +1,4 @@
+## Removed the deprecated `--target-files` API
+
+The `--target-files` introspection API is now no longer available. The same
+information can be queried with the `--targets` API introduced in 0.50.0.
diff --git a/docs/markdown/snippets/subproject-foreach.md b/docs/markdown/snippets/subproject-foreach.md
new file mode 100644
index 0000000..3a8ffc4
--- /dev/null
+++ b/docs/markdown/snippets/subproject-foreach.md
@@ -0,0 +1,7 @@
+## Add new `meson subprojects foreach` command
+
+`meson subprojects` has learned a new `foreach` command which accepts a command
+with arguments and executes it in each subproject directory.
+
+For example this can be useful to check the status of subprojects (e.g. with
+`git status` or `git diff`) before performing other actions on them.
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 124d40f..119c1c2 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -789,6 +789,7 @@ class Backend:
for df in self.interpreter.get_build_def_files()]
if self.environment.is_cross_build():
deps.extend(self.environment.coredata.cross_files)
+ deps.extend(self.environment.coredata.config_files)
deps.append('meson-private/coredata.dat')
if os.path.exists(os.path.join(self.environment.get_source_dir(), 'meson_options.txt')):
deps.append(os.path.join(self.build_to_src, 'meson_options.txt'))
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index f1580b6..529919b 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -622,7 +622,15 @@ class DmdDCompiler(DCompiler):
return []
def get_std_shared_lib_link_args(self):
- return ['-shared', '-defaultlib=libphobos2.so']
+ libname = 'libphobos2.so'
+ if is_windows():
+ if self.arch == 'x86_64':
+ libname = 'phobos64.lib'
+ elif self.arch == 'x86_mscoff':
+ libname = 'phobos32mscoff.lib'
+ else:
+ libname = 'phobos.lib'
+ return ['-shared', '-defaultlib=' + libname]
def get_target_arch_args(self):
# DMD32 and DMD64 on 64-bit Windows defaults to 32-bit (OMF).
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 5afbb3d..e747a35 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -76,18 +76,27 @@ class FortranCompiler(Compiler):
def get_soname_args(self, *args):
return CCompiler.get_soname_args(self, *args)
- def sanity_check(self, work_dir, environment):
- source_name = os.path.join(work_dir, 'sanitycheckf.f90')
- binary_name = os.path.join(work_dir, 'sanitycheckf')
- with open(source_name, 'w') as ofile:
- ofile.write('print *, "Fortran compilation is working."; end')
+ def sanity_check(self, work_dir: Path, environment):
+ """
+ Check to be sure a minimal program can compile and execute
+ with this compiler & platform.
+ """
+ work_dir = Path(work_dir)
+ source_name = work_dir / 'sanitycheckf.f90'
+ binary_name = work_dir / 'sanitycheckf'
+ if binary_name.is_file():
+ binary_name.unlink()
+
+ source_name.write_text('print *, "Fortran compilation is working."; end')
+
if environment.is_cross_build() and not self.is_cross:
for_machine = MachineChoice.BUILD
else:
for_machine = MachineChoice.HOST
extra_flags = environment.coredata.get_external_args(for_machine, self.language)
extra_flags += environment.coredata.get_external_link_args(for_machine, self.language)
- pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
+ # %% build the test executable
+ pc = subprocess.Popen(self.exelist + extra_flags + [str(source_name), '-o', str(binary_name)])
pc.wait()
if pc.returncode != 0:
raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
@@ -95,12 +104,16 @@ class FortranCompiler(Compiler):
if self.exe_wrapper is None:
# Can't check if the binaries run so we have to assume they do
return
- cmdlist = self.exe_wrapper + [binary_name]
+ cmdlist = self.exe_wrapper + [str(binary_name)]
else:
- cmdlist = [binary_name]
- pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
- pe.wait()
- if pe.returncode != 0:
+ cmdlist = [str(binary_name)]
+ # %% Run the test executable
+ try:
+ pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ pe.wait()
+ if pe.returncode != 0:
+ raise EnvironmentException('Executables created by Fortran compiler %s are not runnable.' % self.name_string())
+ except OSError:
raise EnvironmentException('Executables created by Fortran compiler %s are not runnable.' % self.name_string())
def get_std_warn_args(self, level):
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 01db635..739f6e7 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -26,6 +26,7 @@ from .wrap import WrapMode
import ast
import argparse
import configparser
+from typing import Optional, Any, TypeVar, Generic, Type
version = '0.50.999'
backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'xcode']
@@ -269,7 +270,6 @@ class CoreData:
self.cross_compilers = OrderedDict()
self.deps = OrderedDict()
# Only to print a warning if it changes between Meson invocations.
- self.pkgconf_envvar = os.environ.get('PKG_CONFIG_PATH', '')
self.config_files = self.__load_config_files(options.native_file)
self.libdir_cross_fixup()
@@ -335,11 +335,10 @@ class CoreData:
def init_builtins(self):
# Create builtin options with default values
self.builtins = {}
- prefix = get_builtin_option_default('prefix')
- for key in get_builtin_options():
- value = get_builtin_option_default(key, prefix)
- args = [key] + builtin_options[key][1:-1] + [value]
- self.builtins[key] = builtin_options[key][0](*args)
+ for key, opt in builtin_options.items():
+ self.builtins[key] = opt.init_option(key)
+ if opt.separate_cross:
+ self.builtins['cross_' + key] = opt.init_option(key)
def init_backend_options(self, backend_name):
if backend_name == 'ninja':
@@ -462,7 +461,7 @@ class CoreData:
self.builtins['prefix'].set_value(prefix)
for key in builtin_dir_noprefix_options:
if key not in options:
- self.builtins[key].set_value(get_builtin_option_default(key, prefix))
+ self.builtins[key].set_value(builtin_options[key].prefixed_default(key, prefix))
unknown_options = []
for k, v in options.items():
@@ -495,7 +494,7 @@ class CoreData:
from . import optinterpreter
for k, v in default_options.items():
if subproject:
- if optinterpreter.is_invalid_name(k):
+ if optinterpreter.is_invalid_name(k, log=False):
continue
k = subproject + ':' + k
env.cmd_line_options.setdefault(k, v)
@@ -506,14 +505,20 @@ class CoreData:
# languages and setting the backend (builtin options must be set first
# to know which backend we'll use).
options = {}
+
+ # Some options default to environment variables if they are
+ # unset, set those now. These will either be overwritten
+ # below, or they won't.
+ options['pkg_config_path'] = os.environ.get('PKG_CONFIG_PATH', '').split(':')
+
for k, v in env.cmd_line_options.items():
if subproject:
if not k.startswith(subproject + ':'):
continue
- elif k not in get_builtin_options():
+ elif k not in builtin_options:
if ':' in k:
continue
- if optinterpreter.is_invalid_name(k):
+ if optinterpreter.is_invalid_name(k, log=False):
continue
options[k] = v
@@ -656,80 +661,10 @@ def save(obj, build_dir):
os.replace(tempfilename, filename)
return filename
-def get_builtin_options():
- return list(builtin_options.keys())
-
-def is_builtin_option(optname):
- return optname in get_builtin_options()
-
-def get_builtin_option_choices(optname):
- if is_builtin_option(optname):
- if builtin_options[optname][0] == UserComboOption:
- return builtin_options[optname][2]
- elif builtin_options[optname][0] == UserBooleanOption:
- return [True, False]
- elif builtin_options[optname][0] == UserFeatureOption:
- return UserFeatureOption.static_choices
- else:
- return None
- else:
- raise RuntimeError('Tried to get the supported values for an unknown builtin option \'%s\'.' % optname)
-
-def get_builtin_option_description(optname):
- if is_builtin_option(optname):
- return builtin_options[optname][1]
- else:
- raise RuntimeError('Tried to get the description for an unknown builtin option \'%s\'.' % optname)
-
-def get_builtin_option_action(optname):
- default = builtin_options[optname][2]
- if default is True:
- return 'store_false'
- elif default is False:
- return 'store_true'
- return None
-
-def get_builtin_option_default(optname, prefix=''):
- if is_builtin_option(optname):
- o = builtin_options[optname]
- if o[0] == UserComboOption:
- return o[3]
- if o[0] == UserIntegerOption:
- return o[4]
- try:
- return builtin_dir_noprefix_options[optname][prefix]
- except KeyError:
- pass
- return o[2]
- else:
- raise RuntimeError('Tried to get the default value for an unknown builtin option \'%s\'.' % optname)
-
-def get_builtin_option_cmdline_name(name):
- if name == 'warning_level':
- return '--warnlevel'
- else:
- return '--' + name.replace('_', '-')
-
-def add_builtin_argument(p, name):
- kwargs = {}
- c = get_builtin_option_choices(name)
- b = get_builtin_option_action(name)
- h = get_builtin_option_description(name)
- if not b:
- h = h.rstrip('.') + ' (default: %s).' % get_builtin_option_default(name)
- else:
- kwargs['action'] = b
- if c and not b:
- kwargs['choices'] = c
- kwargs['default'] = argparse.SUPPRESS
- kwargs['dest'] = name
-
- cmdline_name = get_builtin_option_cmdline_name(name)
- p.add_argument(cmdline_name, help=h, **kwargs)
def register_builtin_arguments(parser):
- for n in builtin_options:
- add_builtin_argument(parser, n)
+ for n, b in builtin_options.items():
+ b.add_to_argparse(n, parser)
parser.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option",
help='Set the value of an option, can be used several times to set multiple options.')
@@ -747,48 +682,129 @@ def parse_cmd_line_options(args):
args.cmd_line_options = create_options_dict(args.projectoptions)
# Merge builtin options set with --option into the dict.
- for name in builtin_options:
- value = getattr(args, name, None)
- if value is not None:
- if name in args.cmd_line_options:
- cmdline_name = get_builtin_option_cmdline_name(name)
- raise MesonException(
- 'Got argument {0} as both -D{0} and {1}. Pick one.'.format(name, cmdline_name))
- args.cmd_line_options[name] = value
- delattr(args, name)
+ for name, builtin in builtin_options.items():
+ names = [name]
+ if builtin.separate_cross:
+ names.append('cross_' + name)
+ for name in names:
+ value = getattr(args, name, None)
+ if value is not None:
+ if name in args.cmd_line_options:
+ cmdline_name = BuiltinOption.argparse_name_to_arg(name)
+ raise MesonException(
+ 'Got argument {0} as both -D{0} and {1}. Pick one.'.format(name, cmdline_name))
+ args.cmd_line_options[name] = value
+ delattr(args, name)
+
+
+_U = TypeVar('_U', bound=UserOption)
+
+class BuiltinOption(Generic[_U]):
+
+ """Class for a builtin option type.
+
+ Currently doesn't support UserIntegerOption, or a few other cases.
+ """
+
+ def __init__(self, opt_type: Type[_U], description: str, default: Any, yielding: Optional[bool] = None, *,
+ choices: Any = None, separate_cross: bool = False):
+ self.opt_type = opt_type
+ self.description = description
+ self.default = default
+ self.choices = choices
+ self.yielding = yielding
+ self.separate_cross = separate_cross
+
+ def init_option(self, name: str) -> _U:
+ """Create an instance of opt_type and return it."""
+ keywords = {'yielding': self.yielding, 'value': self.default}
+ if self.choices:
+ keywords['choices'] = self.choices
+ return self.opt_type(name, self.description, **keywords)
+
+ def _argparse_action(self) -> Optional[str]:
+ if self.default is True:
+ return 'store_false'
+ elif self.default is False:
+ return 'store_true'
+ return None
+
+ def _argparse_choices(self) -> Any:
+ if self.opt_type is UserBooleanOption:
+ return [True, False]
+ elif self.opt_type is UserFeatureOption:
+ return UserFeatureOption.static_choices
+ return self.choices
+
+ @staticmethod
+ def argparse_name_to_arg(name: str) -> str:
+ if name == 'warning_level':
+ return '--warnlevel'
+ else:
+ return '--' + name.replace('_', '-')
+
+ def prefixed_default(self, name: str, prefix: str = '') -> Any:
+ if self.opt_type in [UserComboOption, UserIntegerOption]:
+ return self.default
+ try:
+ return builtin_dir_noprefix_options[name][prefix]
+ except KeyError:
+ pass
+ return self.default
+
+ def add_to_argparse(self, name: str, parser: argparse.ArgumentParser) -> None:
+ kwargs = {}
+
+ c = self._argparse_choices()
+ b = self._argparse_action()
+ h = self.description
+ if not b:
+ h = '{} (default: {}).'.format(h.rstrip('.'), self.prefixed_default(name))
+ else:
+ kwargs['action'] = b
+ if c and not b:
+ kwargs['choices'] = c
+ kwargs['default'] = argparse.SUPPRESS
+ kwargs['dest'] = name
+
+ cmdline_name = self.argparse_name_to_arg(name)
+ parser.add_argument(cmdline_name, help=h, **kwargs)
+ if self.separate_cross:
+ kwargs['dest'] = 'cross_' + name
+ parser.add_argument(self.argparse_name_to_arg('cross_' + name), help=h + ' (for host in cross compiles)', **kwargs)
+
builtin_options = {
- 'buildtype': [UserComboOption, 'Build type to use', ['plain', 'debug', 'debugoptimized', 'release', 'minsize', 'custom'], 'debug'],
- 'strip': [UserBooleanOption, 'Strip targets on install', False],
- 'unity': [UserComboOption, 'Unity build', ['on', 'off', 'subprojects'], 'off'],
- 'prefix': [UserStringOption, 'Installation prefix', default_prefix()],
- 'libdir': [UserStringOption, 'Library directory', default_libdir()],
- 'libexecdir': [UserStringOption, 'Library executable directory', default_libexecdir()],
- 'bindir': [UserStringOption, 'Executable directory', 'bin'],
- 'sbindir': [UserStringOption, 'System executable directory', 'sbin'],
- 'includedir': [UserStringOption, 'Header file directory', 'include'],
- 'datadir': [UserStringOption, 'Data file directory', 'share'],
- 'mandir': [UserStringOption, 'Manual page directory', 'share/man'],
- 'infodir': [UserStringOption, 'Info page directory', 'share/info'],
- 'localedir': [UserStringOption, 'Locale data directory', 'share/locale'],
- 'sysconfdir': [UserStringOption, 'Sysconf data directory', 'etc'],
- 'localstatedir': [UserStringOption, 'Localstate data directory', 'var'],
- 'sharedstatedir': [UserStringOption, 'Architecture-independent data directory', 'com'],
- 'werror': [UserBooleanOption, 'Treat warnings as errors', False],
- 'warning_level': [UserComboOption, 'Compiler warning level to use', ['0', '1', '2', '3'], '1'],
- 'layout': [UserComboOption, 'Build directory layout', ['mirror', 'flat'], 'mirror'],
- 'default_library': [UserComboOption, 'Default library type', ['shared', 'static', 'both'], 'shared'],
- 'backend': [UserComboOption, 'Backend to use', backendlist, 'ninja'],
- 'stdsplit': [UserBooleanOption, 'Split stdout and stderr in test logs', True],
- 'errorlogs': [UserBooleanOption, "Whether to print the logs from failing tests", True],
- 'install_umask': [UserUmaskOption, 'Default umask to apply on permissions of installed files', '022'],
- 'auto_features': [UserFeatureOption, "Override value of all 'auto' features", 'auto'],
- 'optimization': [UserComboOption, 'Optimization level', ['0', 'g', '1', '2', '3', 's'], '0'],
- 'debug': [UserBooleanOption, 'Debug', True],
- 'wrap_mode': [UserComboOption, 'Wrap mode', ['default',
- 'nofallback',
- 'nodownload',
- 'forcefallback'], 'default'],
+ 'buildtype': BuiltinOption(UserComboOption, 'Build type to use', 'debug',
+ choices=['plain', 'debug', 'debugoptimized', 'release', 'minsize', 'custom']),
+ 'strip': BuiltinOption(UserBooleanOption, 'Strip targets on install', False),
+ 'unity': BuiltinOption(UserComboOption, 'Unity build', 'off', choices=['on', 'off', 'subprojects']),
+ 'prefix': BuiltinOption(UserStringOption, 'Installation prefix', default_prefix()),
+ 'libdir': BuiltinOption(UserStringOption, 'Library directory', default_libdir()),
+ 'libexecdir': BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir()),
+ 'bindir': BuiltinOption(UserStringOption, 'Executable directory', 'bin'),
+ 'sbindir': BuiltinOption(UserStringOption, 'System executable directory', 'sbin'),
+ 'includedir': BuiltinOption(UserStringOption, 'Header file directory', 'include'),
+ 'datadir': BuiltinOption(UserStringOption, 'Data file directory', 'share'),
+ 'mandir': BuiltinOption(UserStringOption, 'Manual page directory', 'share/man'),
+ 'infodir': BuiltinOption(UserStringOption, 'Info page directory', 'share/info'),
+ 'localedir': BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale'),
+ 'sysconfdir': BuiltinOption(UserStringOption, 'Sysconf data directory', 'etc'),
+ 'localstatedir': BuiltinOption(UserStringOption, 'Localstate data directory', 'var'),
+ 'sharedstatedir': BuiltinOption(UserStringOption, 'Architecture-independent data directory', 'com'),
+ 'werror': BuiltinOption(UserBooleanOption, 'Treat warnings as errors', False),
+ 'warning_level': BuiltinOption(UserComboOption, 'Compiler warning level to use', '1', choices=['0', '1', '2', '3']),
+ 'layout': BuiltinOption(UserComboOption, 'Build directory layout', 'mirror', choices=['mirror', 'flat']),
+ 'default_library': BuiltinOption(UserComboOption, 'Default library type', 'shared', choices=['shared', 'static', 'both']),
+ 'backend': BuiltinOption(UserComboOption, 'Backend to use', 'ninja', choices=backendlist),
+ 'stdsplit': BuiltinOption(UserBooleanOption, 'Split stdout and stderr in test logs', True),
+ 'errorlogs': BuiltinOption(UserBooleanOption, "Whether to print the logs from failing tests", True),
+ 'install_umask': BuiltinOption(UserUmaskOption, 'Default umask to apply on permissions of installed files', '022'),
+ 'auto_features': BuiltinOption(UserFeatureOption, "Override value of all 'auto' features", 'auto'),
+ 'optimization': BuiltinOption(UserComboOption, 'Optimization level', '0', choices=['0', 'g', '1', '2', '3', 's']),
+ 'debug': BuiltinOption(UserBooleanOption, 'Debug', True),
+ 'wrap_mode': BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback']),
+ 'pkg_config_path': BuiltinOption(UserArrayOption, 'List of additional paths for pkg-config to search', [], separate_cross=True),
}
# Special prefix-dependent defaults for installation directories that reside in
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index 1152b8d..846f3de 100644
--- a/mesonbuild/dependencies/__init__.py
+++ b/mesonbuild/dependencies/__init__.py
@@ -18,7 +18,7 @@ from .base import ( # noqa: F401
ExternalDependency, NotFoundDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
PkgConfigDependency, CMakeDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency
-from .misc import (CoarrayDependency, HDF5Dependency, MPIDependency, NetCDFDependency, OpenMPDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency, LibGCryptDependency, ShadercDependency)
+from .misc import (CoarrayDependency, HDF5Dependency, MPIDependency, NetCDFDependency, OpenMPDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency, LibGCryptDependency, GpgmeDependency, ShadercDependency)
from .platform import AppleFrameworks
from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, VulkanDependency
@@ -43,6 +43,7 @@ packages.update({
'cups': CupsDependency,
'libwmf': LibWmfDependency,
'libgcrypt': LibGCryptDependency,
+ 'gpgme': GpgmeDependency,
'shaderc': ShadercDependency,
# From platform:
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index aae2572..6063fd3 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -417,6 +417,14 @@ class ConfigToolDependency(ExternalDependency):
best_match = (None, None)
for tool in tools:
+ if len(tool) == 1:
+ # In some situations the command can't be directly executed.
+ # For example Shell scripts need to be called through sh on
+ # Windows (see issue #1423).
+ potential_bin = ExternalProgram(tool[0], silent=True)
+ if not potential_bin.found():
+ continue
+ tool = potential_bin.get_command()
try:
p, out = Popen_safe(tool + ['--version'])[:2]
except (FileNotFoundError, PermissionError):
@@ -457,7 +465,7 @@ class ConfigToolDependency(ExternalDependency):
elif req_version:
found_msg.append('need {!r}'.format(req_version))
else:
- found_msg += [mlog.green('YES'), '({})'.format(shutil.which(self.config[0])), version]
+ found_msg += [mlog.green('YES'), '({})'.format(' '.join(self.config)), version]
mlog.log(*found_msg)
@@ -607,11 +615,19 @@ class PkgConfigDependency(ExternalDependency):
return rc, out
def _call_pkgbin(self, args, env=None):
+ # Always copy the environment since we're going to modify it
+ # with pkg-config variables
if env is None:
- fenv = env
- env = os.environ
+ env = os.environ.copy()
else:
- fenv = frozenset(env.items())
+ env = env.copy()
+
+ if self.want_cross:
+ extra_paths = self.env.coredata.get_builtin_option('cross_pkg_config_path')
+ else:
+ extra_paths = self.env.coredata.get_builtin_option('pkg_config_path')
+ env['PKG_CONFIG_PATH'] = ':'.join([p for p in extra_paths])
+ fenv = frozenset(env.items())
targs = tuple(args)
cache = PkgConfigDependency.pkgbin_cache
if (self.pkgbin, targs, fenv) not in cache:
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 5721cc3..219b3d6 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -212,6 +212,9 @@ class MPIDependency(ExternalDependency):
break
if not self.is_found and mesonlib.is_windows():
+ # only Intel Fortran compiler is compatible with Microsoft MPI at this time.
+ if language == 'fortran' and environment.detect_fortran_compiler(False).name_string() != 'intel':
+ return
result = self._try_msmpi()
if result is not None:
self.is_found = True
@@ -668,6 +671,34 @@ class LibGCryptDependency(ExternalDependency):
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
+class GpgmeDependency(ExternalDependency):
+ def __init__(self, environment, kwargs):
+ super().__init__('gpgme', environment, None, kwargs)
+
+ @classmethod
+ def _factory(cls, environment, kwargs):
+ methods = cls._process_method_kw(kwargs)
+ candidates = []
+
+ if DependencyMethods.CONFIG_TOOL in methods:
+ candidates.append(functools.partial(ConfigToolDependency.factory,
+ 'gpgme', environment, None, kwargs, ['gpgme-config'],
+ 'gpgme-config',
+ GpgmeDependency.tool_finish_init))
+
+ return candidates
+
+ @staticmethod
+ def tool_finish_init(ctdep):
+ ctdep.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
+ ctdep.link_args = ctdep.get_config_value(['--libs'], 'link_args')
+ ctdep.version = ctdep.get_config_value(['--version'], 'version')[0]
+
+ @staticmethod
+ def get_methods():
+ return [DependencyMethods.CONFIG_TOOL]
+
+
class ShadercDependency(ExternalDependency):
def __init__(self, environment, kwargs):
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 243dc5d..32931b6 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -101,8 +101,6 @@ def add_arguments(parser):
flag = '--' + val.get('key', key)
parser.add_argument(flag, action='store_true', dest=key, default=False, help=val['desc'])
- parser.add_argument('--target-files', action='store', dest='target_files', default=None,
- help='List source files for a given target.')
parser.add_argument('--backend', choices=cdata.backendlist, dest='backend', default='ninja',
help='The backend to use for the --buildoptions introspection.')
parser.add_argument('-a', '--all', action='store_true', dest='all', default=False,
@@ -204,27 +202,6 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend)
def list_buildoptions_from_source(intr: IntrospectionInterpreter) -> List[dict]:
return list_buildoptions(intr.coredata)
-def list_target_files(target_name: str, targets: list, source_dir: str):
- sys.stderr.write("WARNING: The --target-files introspection API is deprecated. Use --targets instead.\n")
- result = []
- tgt = None
-
- for i in targets:
- if i['id'] == target_name:
- tgt = i
- break
-
- if tgt is None:
- print('Target with the ID "{}" could not be found'.format(target_name))
- sys.exit(1)
-
- for i in tgt['target_sources']:
- result += i['sources'] + i['generated_sources']
-
- result = list(map(lambda x: os.path.relpath(x, source_dir), result))
-
- return result
-
def list_buildoptions(coredata: cdata.CoreData) -> List[dict]:
optlist = []
@@ -413,11 +390,9 @@ def run(options):
return 1
intro_vers = '0.0.0'
- source_dir = None
with open(infofile, 'r') as fp:
raw = json.load(fp)
intro_vers = raw.get('introspection', {}).get('version', {}).get('full', '0.0.0')
- source_dir = raw.get('directories', {}).get('source', None)
vers_to_check = get_meson_introspection_required_version()
for i in vers_to_check:
@@ -427,13 +402,6 @@ def run(options):
.format(intro_vers, ' and '.join(vers_to_check)))
return 1
- # Handle the one option that does not have its own JSON file (meybe deprecate / remove this?)
- if options.target_files is not None:
- targets_file = os.path.join(infodir, 'intro-targets.json')
- with open(targets_file, 'r') as fp:
- targets = json.load(fp)
- results += [('target_files', list_target_files(options.target_files, targets, source_dir))]
-
# Extract introspection information from JSON
for i in intro_types.keys():
if 'func' not in intro_types[i]:
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 34fe5a5..bd69244 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -131,7 +131,7 @@ class PythonDependency(ExternalDependency):
if self.is_found:
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES ({})'.format(py_lookup_method)))
else:
- mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO'))
+ mlog.log('Dependency', mlog.bold(self.name), 'found:', [mlog.red('NO')])
def _find_libpy(self, python_holder, environment):
if python_holder.is_pypy:
@@ -498,9 +498,6 @@ class PythonModule(ExtensionModule):
def find_installation(self, interpreter, state, args, kwargs):
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.')
@@ -511,9 +508,12 @@ class PythonModule(ExtensionModule):
if not isinstance(name_or_path, str):
raise InvalidArguments('find_installation argument must be a string.')
+ if disabled:
+ mlog.log('Program', name_or_path or 'python', 'found:', mlog.red('NO'), '(disabled by:', mlog.bold(feature), ')')
+ return ExternalProgramHolder(NonExistingExternalProgram())
+
if not name_or_path:
- mlog.log("Using meson's python {}".format(mesonlib.python_command))
- python = ExternalProgram('python3', mesonlib.python_command, silent=True)
+ python = ExternalProgram('python3', mesonlib.python_command)
else:
python = ExternalProgram.from_entry('python3', name_or_path)
@@ -521,14 +521,17 @@ class PythonModule(ExtensionModule):
pythonpath = self._get_win_pythonpath(name_or_path)
if pythonpath is not None:
name_or_path = pythonpath
- python = ExternalProgram(name_or_path, silent = True)
+ python = ExternalProgram(name_or_path, silent=True)
# Last ditch effort, python2 or python3 can be named python
# on various platforms, let's not give up just yet, if an executable
# named python is available and has a compatible version, let's use
# it
if not python.found() and name_or_path in ['python2', 'python3']:
- python = ExternalProgram('python', silent = True)
+ python = ExternalProgram('python', silent=True)
+
+ mlog.log('Program', python.name, 'found:',
+ *[mlog.green('YES'), '({})'.format(' '.join(python.command))] if python.found() else [mlog.red('NO')])
if not python.found():
if required:
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py
index 6e8ca83..ef0511d 100644
--- a/mesonbuild/msetup.py
+++ b/mesonbuild/msetup.py
@@ -149,13 +149,6 @@ class MesonApp:
sys.exit(1)
return src_dir, build_dir
- def check_pkgconfig_envvar(self, env):
- curvar = os.environ.get('PKG_CONFIG_PATH', '')
- if curvar != env.coredata.pkgconf_envvar:
- mlog.warning('PKG_CONFIG_PATH has changed between invocations from "%s" to "%s".' %
- (env.coredata.pkgconf_envvar, curvar))
- env.coredata.pkgconf_envvar = curvar
-
def generate(self):
env = environment.Environment(self.source_dir, self.build_dir, self.options)
mlog.initialize(env.get_log_dir(), self.options.fatal_warnings)
@@ -169,7 +162,6 @@ class MesonApp:
mlog.debug('Main binary:', sys.executable)
mlog.debug('Python system:', platform.system())
mlog.log(mlog.bold('The Meson build system'))
- self.check_pkgconfig_envvar(env)
mlog.log('Version:', coredata.version)
mlog.log('Source dir:', mlog.bold(self.source_dir))
mlog.log('Build dir:', mlog.bold(self.build_dir))
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py
index 2c1bf8b..c31b07d 100644..100755
--- a/mesonbuild/msubprojects.py
+++ b/mesonbuild/msubprojects.py
@@ -1,4 +1,5 @@
import os, subprocess
+import argparse
from . import mlog
from .mesonlib import Popen_safe
@@ -167,6 +168,18 @@ def download(wrap, repo_dir, options):
except WrapException as e:
mlog.log(' ->', mlog.red(str(e)))
+def foreach(wrap, repo_dir, options):
+ mlog.log('Executing command in %s' % repo_dir)
+ if not os.path.isdir(repo_dir):
+ mlog.log(' -> Not downloaded yet')
+ return
+ try:
+ subprocess.check_call([options.command] + options.args, cwd=repo_dir)
+ mlog.log('')
+ except subprocess.CalledProcessError as e:
+ out = e.output.decode().strip()
+ mlog.log(' -> ', mlog.red(out))
+
def add_common_arguments(p):
p.add_argument('--sourcedir', default='.',
help='Path to source directory')
@@ -197,6 +210,15 @@ def add_arguments(parser):
add_common_arguments(p)
p.set_defaults(subprojects_func=download)
+ p = subparsers.add_parser('foreach', help='Execute a command in each subproject directory.')
+ p.add_argument('command', metavar='command ...',
+ help='Command to execute in each subproject directory')
+ p.add_argument('args', nargs=argparse.REMAINDER,
+ help=argparse.SUPPRESS)
+ p.add_argument('--sourcedir', default='.',
+ help='Path to source directory')
+ p.set_defaults(subprojects_func=foreach)
+
def run(options):
src_dir = os.path.relpath(os.path.realpath(options.sourcedir))
if not os.path.isfile(os.path.join(src_dir, 'meson.build')):
@@ -207,13 +229,14 @@ def run(options):
mlog.log('Directory', mlog.bold(src_dir), 'does not seem to have subprojects.')
return 0
files = []
- for name in options.subprojects:
- f = os.path.join(subprojects_dir, name + '.wrap')
- if not os.path.isfile(f):
- mlog.error('Subproject', mlog.bold(name), 'not found.')
- return 1
- else:
- files.append(f)
+ if hasattr(options, 'subprojects'):
+ for name in options.subprojects:
+ f = os.path.join(subprojects_dir, name + '.wrap')
+ if not os.path.isfile(f):
+ mlog.error('Subproject', mlog.bold(name), 'not found.')
+ return 1
+ else:
+ files.append(f)
if not files:
for f in os.listdir(subprojects_dir):
if f.endswith('.wrap'):
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index dc82084..0f15690 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -490,7 +490,9 @@ class SingleTestRunner:
stderr = None
if not self.options.verbose:
stdout = tempfile.TemporaryFile("wb+")
- stderr = tempfile.TemporaryFile("wb+") if self.options and self.options.split else stdout
+ stderr = tempfile.TemporaryFile("wb+") if self.options.split else stdout
+ if self.test.protocol == 'tap' and stderr is stdout:
+ stdout = tempfile.TemporaryFile("wb+")
# Let gdb handle ^C instead of us
if self.options.gdb:
@@ -570,17 +572,16 @@ class SingleTestRunner:
endtime = time.time()
duration = endtime - starttime
if additional_error is None:
- if stdout is None: # if stdout is None stderr should be as well
+ if stdout is None:
stdo = ''
- stde = ''
else:
stdout.seek(0)
stdo = decode(stdout.read())
- if stderr != stdout:
- stderr.seek(0)
- stde = decode(stderr.read())
- else:
- stde = ""
+ if stderr is None or stderr is stdout:
+ stde = ''
+ else:
+ stderr.seek(0)
+ stde = decode(stderr.read())
else:
stdo = ""
stde = additional_error
@@ -590,6 +591,8 @@ class SingleTestRunner:
if self.test.protocol == 'exitcode':
return TestRun.make_exitcode(self.test, p.returncode, duration, stdo, stde, cmd)
else:
+ if self.options.verbose:
+ print(stdo, end='')
return TestRun.make_tap(self.test, p.returncode, duration, stdo, stde, cmd)
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 85f6897..e64ed4e 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -20,19 +20,20 @@ from . import coredata
from . import mesonlib
from . import compilers
-forbidden_option_names = coredata.get_builtin_options()
+forbidden_option_names = set(coredata.builtin_options.keys())
forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
reserved_prefixes = ['cross_']
-def is_invalid_name(name):
+def is_invalid_name(name: str, *, log: bool = True) -> bool:
if name in forbidden_option_names:
return True
pref = name.split('_')[0] + '_'
if pref in forbidden_prefixes:
return True
if pref in reserved_prefixes:
- from . import mlog
- mlog.deprecation('Option uses prefix "%s", which is reserved for Meson. This will become an error in the future.' % pref)
+ if log:
+ from . import mlog
+ mlog.deprecation('Option uses prefix "%s", which is reserved for Meson. This will become an error in the future.' % pref)
return False
class OptionException(mesonlib.MesonException):
diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py
index 976d2f0..95ea0ec 100644
--- a/mesonbuild/scripts/symbolextractor.py
+++ b/mesonbuild/scripts/symbolextractor.py
@@ -68,7 +68,14 @@ def linux_syms(libfilename, outfilename):
libfilename])[0:2]
if pnm.returncode != 0:
raise RuntimeError('nm does not work.')
- result += [' '.join(x.split()[0:2]) for x in output.split('\n') if len(x) > 0]
+ for line in output.split('\n'):
+ if len(line) == 0:
+ continue
+ line_split = line.split()
+ entry = line_split[0:2]
+ if len(line_split) >= 4:
+ entry += [line_split[3]]
+ result += [' '.join(entry)]
write_if_changed('\n'.join(result) + '\n', outfilename)
def osx_syms(libfilename, outfilename):
diff --git a/mesonbuild/scripts/vcstagger.py b/mesonbuild/scripts/vcstagger.py
index 62a45d9..16dd4d1 100644
--- a/mesonbuild/scripts/vcstagger.py
+++ b/mesonbuild/scripts/vcstagger.py
@@ -14,6 +14,7 @@
import sys, os, subprocess, re
+
def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, cmd):
try:
output = subprocess.check_output(cmd, cwd=source_dir)
@@ -21,17 +22,18 @@ def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_
except Exception:
new_string = fallback
- with open(infile) as f:
+ with open(infile, encoding='utf8') as f:
new_data = f.read().replace(replace_string, new_string)
if os.path.exists(outfile):
- with open(outfile) as f:
+ with open(outfile, encoding='utf8') as f:
needs_update = (f.read() != new_data)
else:
needs_update = True
if needs_update:
- with open(outfile, 'w') as f:
+ with open(outfile, 'w', encoding='utf8') as f:
f.write(new_data)
+
def run(args):
infile, outfile, fallback, source_dir, replace_string, regex_selector = args[0:6]
command = args[6:]
diff --git a/run_cross_test.py b/run_cross_test.py
index b2ef6be..8d18123 100755
--- a/run_cross_test.py
+++ b/run_cross_test.py
@@ -34,7 +34,7 @@ def runtests(cross_file, failfast):
commontests = [('common', gather_tests(Path('test cases', 'common')), False)]
try:
(passing_tests, failing_tests, skipped_tests) = \
- run_tests(commontests, 'meson-cross-test-run', failfast, ['--cross', cross_file])
+ run_tests(commontests, 'meson-cross-test-run', failfast, ['--cross-file', cross_file])
except StopException:
pass
print('\nTotal passed cross tests:', passing_tests)
diff --git a/run_project_tests.py b/run_project_tests.py
index be6ecd9..fdb5f48 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -563,7 +563,7 @@ def detect_tests_to_run():
('C#', 'csharp', skip_csharp(backend)),
('vala', 'vala', backend is not Backend.ninja or not shutil.which('valac')),
('rust', 'rust', backend is not Backend.ninja or not shutil.which('rustc')),
- ('d', 'd', backend is not Backend.ninja or not have_d_compiler() or mesonlib.is_windows()),
+ ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objc_compiler()),
('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objcpp_compiler()),
('fortran', 'fortran', backend is not Backend.ninja or not shutil.which('gfortran')),
diff --git a/run_unittests.py b/run_unittests.py
index bc28eea..6642511 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2653,38 +2653,6 @@ int main(int argc, char **argv) {
self.init(testdir, ['--cross-file=' + name], inprocess=True)
self.wipe()
- def test_introspect_target_files(self):
- '''
- Tests that mesonintrospect --target-files returns expected output.
- '''
- testdir = os.path.join(self.common_test_dir, '8 install')
- self.init(testdir)
- expected = {
- 'stat@sta': ['stat.c'],
- 'prog@exe': ['prog.c'],
- }
- t_intro = self.introspect('--targets')
- self.assertCountEqual([t['id'] for t in t_intro], expected)
- for t in t_intro:
- id = t['id']
- tf_intro = self.introspect(['--target-files', id])
- self.assertEqual(tf_intro, expected[id])
- self.wipe()
-
- testdir = os.path.join(self.common_test_dir, '53 custom target')
- self.init(testdir)
- expected = {
- 'bindat@cus': ['data_source.txt'],
- 'a685fbc@@depfile@cus': [],
- }
- t_intro = self.introspect('--targets')
- self.assertCountEqual([t['id'] for t in t_intro], expected)
- for t in t_intro:
- id = t['id']
- tf_intro = self.introspect(['--target-files', id])
- self.assertEqual(tf_intro, expected[id])
- self.wipe()
-
def test_compiler_run_command(self):
'''
The test checks that the compiler object can be passed to
@@ -4683,8 +4651,7 @@ class LinuxlikeTests(BasePlatformTests):
docbook_target = t
break
self.assertIsInstance(docbook_target, dict)
- ifile = self.introspect(['--target-files', '8d60afc@@generated-gdbus-docbook@cus'])[0]
- self.assertListEqual(t['filename'], [os.path.join(self.builddir, 'gdbus/generated-gdbus-doc-' + os.path.basename(ifile))])
+ self.assertEqual(os.path.basename(t['filename'][0]), 'generated-gdbus-doc-' + os.path.basename(t['target_sources'][0]['sources'][0]))
def test_build_rpath(self):
if is_cygwin():
@@ -4837,9 +4804,9 @@ endian = 'little'
testdir = os.path.join(self.unit_test_dir, '58 pkgconfig relative paths')
pkg_dir = os.path.join(testdir, 'pkgconfig')
self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'librelativepath.pc')))
- os.environ['PKG_CONFIG_PATH'] = pkg_dir
env = get_fake_env(testdir, self.builddir, self.prefix)
+ env.coredata.set_options({'pkg_config_path': pkg_dir}, '')
kwargs = {'required': True, 'silent': True}
relative_path_dep = PkgConfigDependency('librelativepath', env, kwargs)
self.assertTrue(relative_path_dep.found())
@@ -4878,7 +4845,7 @@ endian = 'little'
myenv['PKG_CONFIG_PATH'] = self.privatedir
stdo = subprocess.check_output(['pkg-config', '--libs-only-l', 'libsomething'], env=myenv)
deps = [b'-lgobject-2.0', b'-lgio-2.0', b'-lglib-2.0', b'-lsomething']
- if is_windows() or is_cygwin() or is_osx():
+ if is_windows() or is_cygwin() or is_osx() or is_openbsd():
# On Windows, libintl is a separate library
deps.append(b'-lintl')
self.assertEqual(set(deps), set(stdo.split()))
@@ -5068,6 +5035,11 @@ endian = 'little'
# Assert that
self.assertEqual(len(line.split(lib)), 2, msg=(lib, line))
+ @skipIfNoPkgconfig
+ def test_pkg_config_option(self):
+ testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option')
+ self.init(testdir, extra_args=['-Dpkg_config_path=' + os.path.join(testdir, 'extra_path')])
+
def should_run_cross_arm_tests():
return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm')
@@ -5164,6 +5136,11 @@ class LinuxCrossMingwTests(BasePlatformTests):
# Must run in-process or we'll get a generic CalledProcessError
self.run_tests(inprocess=True)
+ @skipIfNoPkgconfig
+ def test_cross_pkg_config_option(self):
+ testdir = os.path.join(self.unit_test_dir, '55 pkg_config_path option')
+ self.init(testdir, extra_args=['-Dcross_pkg_config_path=' + os.path.join(testdir, 'extra_path')])
+
class PythonTests(BasePlatformTests):
'''
diff --git a/test cases/frameworks/17 mpi/is_broken_ubuntu.py b/test cases/frameworks/17 mpi/is_broken_ubuntu.py
deleted file mode 100755
index 27651ba..0000000
--- a/test cases/frameworks/17 mpi/is_broken_ubuntu.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env python3
-
-# Any exception causes return value to be not zero, which is sufficient.
-
-import sys
-
-fc = open('/etc/apt/sources.list').read()
-if 'artful' not in fc and 'bionic' not in fc and 'cosmic' not in fc:
- sys.exit(1)
diff --git a/test cases/frameworks/17 mpi/main.f90 b/test cases/frameworks/17 mpi/main.f90
index d379e96..b5666e8 100644
--- a/test cases/frameworks/17 mpi/main.f90
+++ b/test cases/frameworks/17 mpi/main.f90
@@ -1,21 +1,30 @@
-program mpitest
- implicit none
- include 'mpif.h'
- logical :: flag
- integer :: ier
- call MPI_Init(ier)
- if (ier /= 0) then
- print *, 'Unable to initialize MPI: ', ier
- stop 1
- endif
- call MPI_Initialized(flag, ier)
- if (ier /= 0) then
- print *, 'Unable to check MPI initialization state: ', ier
- stop 1
- endif
- call MPI_Finalize(ier)
- if (ier /= 0) then
- print *, 'Unable to finalize MPI: ', ier
- stop 1
- endif
-end program mpitest
+use, intrinsic :: iso_fortran_env, only: stderr=>error_unit
+use mpi
+
+implicit none
+
+logical :: flag
+integer :: ier
+
+call MPI_Init(ier)
+
+if (ier /= 0) then
+ write(stderr,*) 'Unable to initialize MPI', ier
+ stop 1
+endif
+
+call MPI_Initialized(flag, ier)
+if (ier /= 0) then
+ write(stderr,*) 'Unable to check MPI initialization state: ', ier
+ stop 1
+endif
+
+call MPI_Finalize(ier)
+if (ier /= 0) then
+ write(stderr,*) 'Unable to finalize MPI: ', ier
+ stop 1
+endif
+
+print *, "OK: Fortran MPI"
+
+end program
diff --git a/test cases/frameworks/17 mpi/meson.build b/test cases/frameworks/17 mpi/meson.build
index 2d0e4d3..8af9374 100644
--- a/test cases/frameworks/17 mpi/meson.build
+++ b/test cases/frameworks/17 mpi/meson.build
@@ -26,21 +26,15 @@ if build_machine.system() != 'windows'
test('MPI C++', execpp)
endif
-# OpenMPI is broken with Fortran on Ubuntu Artful.
-# Remove this once the following bug has been fixed:
-#
-# https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1727474
-
-ubudetector = find_program('is_broken_ubuntu.py')
-uburesult = run_command(ubudetector)
-
-if uburesult.returncode() != 0 and add_languages('fortran', required : false)
- mpifort = dependency('mpi', language : 'fortran')
- # Mixing compilers (msvc/clang with gfortran) does not seem to work on Windows.
- if build_machine.system() != 'windows' or cc.get_id() == 'gnu'
+# One of few feasible ways to use MPI for Fortran on Windows is via Intel compilers.
+if build_machine.system() != 'windows' or cc.get_id() == 'intel'
+ if add_languages('fortran', required : false)
+ mpifort = dependency('mpi', language : 'fortran')
+
exef = executable('exef',
- 'main.f90',
- dependencies : [mpifort])
+ 'main.f90',
+ dependencies : [mpifort])
+
test('MPI Fortran', exef)
endif
endif
diff --git a/test cases/frameworks/27 gpgme/gpgme_prog.c b/test cases/frameworks/27 gpgme/gpgme_prog.c
new file mode 100644
index 0000000..594f685
--- /dev/null
+++ b/test cases/frameworks/27 gpgme/gpgme_prog.c
@@ -0,0 +1,8 @@
+#include <gpgme.h>
+
+int
+main()
+{
+ printf("gpgme-v%s", gpgme_check_version(NULL));
+ return 0;
+}
diff --git a/test cases/frameworks/27 gpgme/meson.build b/test cases/frameworks/27 gpgme/meson.build
new file mode 100644
index 0000000..220a4c0
--- /dev/null
+++ b/test cases/frameworks/27 gpgme/meson.build
@@ -0,0 +1,21 @@
+project('gpgme test', 'c')
+
+wm = find_program('gpgme-config', required: false)
+if not wm.found()
+ error('MESON_SKIP_TEST: gpgme-config not installed')
+endif
+
+gpgme_dep = dependency('gpgme', version: '>= 1.0')
+gpgme_ver = gpgme_dep.version()
+assert(gpgme_ver.split('.').length() > 1, 'gpgme version is "@0@"'.format(gpgme_ver))
+message('gpgme version is "@0@"'.format(gpgme_ver))
+e = executable('gpgme_prog', 'gpgme_prog.c', dependencies: gpgme_dep)
+
+test('gpgmetest', e)
+
+# Test using the method keyword:
+
+dependency('gpgme', method: 'config-tool')
+
+# Check we can apply a version constraint
+dependency('gpgme', version: '>=@0@'.format(gpgme_dep.version()), method: 'config-tool')
diff --git a/test cases/python/1 basic/meson.build b/test cases/python/1 basic/meson.build
index f9a7433..9c3af10 100644
--- a/test cases/python/1 basic/meson.build
+++ b/test cases/python/1 basic/meson.build
@@ -1,7 +1,7 @@
project('python sample', 'c')
py_mod = import('python')
-py = py_mod.find_installation()
+py = py_mod.find_installation('python3')
py_version = py.language_version()
if py_version.version_compare('< 3.2')
diff --git a/test cases/unit/55 pkg_config_path option/extra_path/totally_made_up_dep.pc b/test cases/unit/55 pkg_config_path option/extra_path/totally_made_up_dep.pc
new file mode 100644
index 0000000..6d08687
--- /dev/null
+++ b/test cases/unit/55 pkg_config_path option/extra_path/totally_made_up_dep.pc
@@ -0,0 +1,7 @@
+prefix=/
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: totally_made_up_dep
+Description: completely and totally made up for a test case
+Version: 1.2.3 \ No newline at end of file
diff --git a/test cases/unit/55 pkg_config_path option/meson.build b/test cases/unit/55 pkg_config_path option/meson.build
new file mode 100644
index 0000000..623c3a2
--- /dev/null
+++ b/test cases/unit/55 pkg_config_path option/meson.build
@@ -0,0 +1,3 @@
+project('pkg_config_path option')
+
+dependency('totally_made_up_dep', method : 'pkg-config')