aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/syntax-highlighting/vim/syntax/meson.vim1
-rw-r--r--docs/markdown/Gnome-module.md7
-rw-r--r--docs/markdown/Python-3-module.md2
-rw-r--r--docs/markdown/Users.md3
-rw-r--r--docs/markdown/snippets/if-release.md7
-rwxr-xr-xmeson.py11
-rw-r--r--mesonbuild/backend/backends.py10
-rw-r--r--mesonbuild/compilers/c.py6
-rw-r--r--mesonbuild/compilers/compilers.py7
-rw-r--r--mesonbuild/compilers/fortran.py2
-rw-r--r--mesonbuild/coredata.py4
-rw-r--r--mesonbuild/dependencies/base.py11
-rw-r--r--mesonbuild/dependencies/dev.py11
-rw-r--r--mesonbuild/dependencies/misc.py2
-rw-r--r--mesonbuild/interpreter.py2
-rw-r--r--mesonbuild/mesonlib.py29
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/scripts/coverage.py1
-rwxr-xr-xrun_project_tests.py11
-rwxr-xr-xrun_unittests.py2
-rw-r--r--test cases/frameworks/21 libwmf/meson.build5
21 files changed, 102 insertions, 34 deletions
diff --git a/data/syntax-highlighting/vim/syntax/meson.vim b/data/syntax-highlighting/vim/syntax/meson.vim
index 49921c1..e06b2df 100644
--- a/data/syntax-highlighting/vim/syntax/meson.vim
+++ b/data/syntax-highlighting/vim/syntax/meson.vim
@@ -112,6 +112,7 @@ syn keyword mesonBuiltin
\ target_machine
\ test
\ vcs_tag
+ \ warning
if exists("meson_space_error_highlight")
" trailing whitespace
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 738e2a9..b33009d 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -196,6 +196,13 @@ When called, this method will compile the gschemas in the current
directory. Note that this is not for installing schemas and is only
useful when running the application locally for example during tests.
+* `build_by_default`: causes, when set to true, to have this target be
+ built by default, that is, when invoking plain `ninja`, the default
+ value is true for all built target types
+* `depend_files`: files ([`string`](#string-object),
+ [`files()`](#files), or [`configure_file()`](#configure_file)) of
+ schema source XML files that should trigger a re-compile if changed.
+
### gnome.gdbus_codegen()
Compiles the given XML schema into gdbus source code. Takes two
diff --git a/docs/markdown/Python-3-module.md b/docs/markdown/Python-3-module.md
index fa1d78e..dc6f571 100644
--- a/docs/markdown/Python-3-module.md
+++ b/docs/markdown/Python-3-module.md
@@ -7,7 +7,7 @@ following methods.
This is a cross platform way of finding the Python 3 executable, which
may have a different name on different operating systems. Returns an
-external program object.
+[external program](Reference-manual.html#external-program-object) object.
*Added 0.38.0*
diff --git a/docs/markdown/Users.md b/docs/markdown/Users.md
index c27c516..959eac6 100644
--- a/docs/markdown/Users.md
+++ b/docs/markdown/Users.md
@@ -12,6 +12,7 @@ If you have a project that uses Meson that you want to add to this list, let us
- [casync](https://github.com/systemd/casync), Content-Addressable Data Synchronization Tool
- [Emeus](https://github.com/ebassi/emeus), Constraint based layout manager for GTK+
- [Frida](https://www.frida.re/), a dynamic binary instrumentation toolkit
+ - [Geary](https://wiki.gnome.org/Apps/Geary), an email application built around conversations, for the GNOME 3 desktop.
- [GLib](https://git.gnome.org/browse/glib/), cross-platform C library used by GTK+ and GStreamer (not the default yet)
- [Gnome Builder](https://git.gnome.org/browse/gnome-builder/), an IDE for the Gnome platform
- [Gnome MPV](https://github.com/gnome-mpv/gnome-mpv), Gnome frontend to the mpv video player
@@ -37,7 +38,7 @@ If you have a project that uses Meson that you want to add to this list, let us
- [Pitivi](http://pitivi.org/), a nonlinear video editor
- [Polari](https://git.gnome.org/browse/polari), an IRC client
- [Sysprof](https://wiki.gnome.org/Apps/Sysprof), a profiling tool
- - [systemd](https://github.com/systemd/systemd/pull/5704), the init system (not the default yet)
+ - [systemd](https://github.com/systemd/systemd), the init system
- [Xorg](https://cgit.freedesktop.org/xorg/xserver/) the X.org display server (not the default yet)
- [Valum](https://github.com/valum-framework/valum), a micro web framework written in Vala
- [Wayland and Weston](https://lists.freedesktop.org/archives/wayland-devel/2016-November/031984.html), a next generation display server (not merged yet)
diff --git a/docs/markdown/snippets/if-release.md b/docs/markdown/snippets/if-release.md
new file mode 100644
index 0000000..96e12ef
--- /dev/null
+++ b/docs/markdown/snippets/if-release.md
@@ -0,0 +1,7 @@
+## b_ndebug : if-release
+
+The value `if-release` can be given for the `b_ndebug` project option.
+
+This will make the `NDEBUG` pre-compiler macro to be defined for release
+type builds as if the `b_ndebug` project option had had the value `true`
+defined for it.
diff --git a/meson.py b/meson.py
index 57cc6dc..13bc870 100755
--- a/meson.py
+++ b/meson.py
@@ -18,17 +18,6 @@ from mesonbuild import mesonmain, mesonlib
import sys, os, locale
def main():
- # Warn if the locale is not UTF-8. This can cause various unfixable issues
- # such as os.stat not being able to decode filenames with unicode in them.
- # There is no way to reset both the preferred encoding and the filesystem
- # encoding, so we can just warn about it.
- e = locale.getpreferredencoding()
- if e.upper() != 'UTF-8' and not mesonlib.is_windows():
- print('Warning: You are using {!r} which is not a Unicode-compatible '
- 'locale.'.format(e), file=sys.stderr)
- print('You might see errors if you use UTF-8 strings as '
- 'filenames, as strings, or as file contents.', file=sys.stderr)
- print('Please switch to a UTF-8 locale for your platform.', file=sys.stderr)
# Always resolve the command path so Ninja can find it for regen, tests, etc.
launcher = os.path.realpath(sys.argv[0])
return mesonmain.run(sys.argv[1:], launcher)
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 3f1e4ce..5a5db22 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -346,6 +346,11 @@ class Backend:
assert isinstance(source, mesonlib.File)
build_dir = self.environment.get_build_dir()
rel_src = source.rel_to_builddir(self.build_to_src)
+
+ if (not self.environment.is_source(rel_src) or
+ self.environment.is_header(rel_src)) and not is_unity:
+ return None
+
# foo.vala files compile down to foo.c and then foo.c.o, not foo.vala.o
if rel_src.endswith(('.vala', '.gs')):
# See description in generate_vala_compile for this logic.
@@ -393,8 +398,9 @@ class Backend:
return [objpath]
for osrc in extobj.srclist:
objname = self.object_filename_from_source(extobj.target, osrc, False)
- objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
- result.append(objpath)
+ if objname:
+ objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
+ result.append(objpath)
return result
def get_pch_include_args(self, compiler, target):
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index c1982d6..233fc84 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -97,7 +97,7 @@ class CCompiler(Compiler):
return self.build_unix_rpath_args(build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
def get_dependency_gen_args(self, outtarget, outfile):
- return ['-MMD', '-MQ', outtarget, '-MF', outfile]
+ return ['-MD', '-MQ', outtarget, '-MF', outfile]
def depfile_for_object(self, objfile):
return objfile + '.' + self.get_depfile_suffix()
@@ -156,7 +156,9 @@ class CCompiler(Compiler):
return ['-shared']
def get_library_dirs(self):
- stdo = Popen_safe(self.exelist + ['--print-search-dirs'])[1]
+ env = os.environ.copy()
+ env['LC_ALL'] = 'C'
+ stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=env)[1]
for line in stdo.split('\n'):
if line.startswith('libraries:'):
libstr = line.split('=', 1)[1]
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 6941649..3d50eb0 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -224,9 +224,8 @@ base_options = {'b_pch': coredata.UserBooleanOption('b_pch', 'Use precompiled he
'b_colorout': coredata.UserComboOption('b_colorout', 'Use colored output',
['auto', 'always', 'never'],
'always'),
- 'b_ndebug': coredata.UserBooleanOption('b_ndebug',
- 'Disable asserts',
- False),
+ 'b_ndebug': coredata.UserComboOption('b_ndebug', 'Disable asserts',
+ ['true', 'false', 'if-release'], 'false'),
'b_staticpic': coredata.UserBooleanOption('b_staticpic',
'Build static libraries as position independent',
True),
@@ -313,7 +312,7 @@ def get_base_compile_args(options, compiler):
except KeyError:
pass
try:
- if options['b_ndebug'].value:
+ if options['b_ndebug'].value == 'true' or (options['b_ndebug'].value == 'if-release' and options['buildtype'] == 'release'):
args += ['-DNDEBUG']
except KeyError:
pass
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 5101676..1b42bfa 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -99,7 +99,7 @@ end program prog
def get_dependency_gen_args(self, outtarget, outfile):
# Disabled until this is fixed:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62162
- # return ['-cpp', '-MMD', '-MQ', outtarget]
+ # return ['-cpp', '-MD', '-MQ', outtarget]
return []
def get_output_args(self, target):
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index cf7df5e..d4a91a7 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from . import mlog
import pickle, os, uuid
import sys
from pathlib import PurePath
@@ -148,6 +149,9 @@ class UserArrayOption(UserOption):
newvalue = ast.literal_eval(value)
else:
newvalue = [v.strip() for v in value.split(',')]
+ if len(set(newvalue)) != len(newvalue):
+ mlog.log(mlog.red('DEPRECATION:'), '''Duplicated values in an array type is deprecated.
+This will become a hard error in the future.''')
if not isinstance(newvalue, list):
raise MesonException('"{0}" should be a string array, but it is not'.format(str(newvalue)))
for i in newvalue:
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 0ef3372..46cce43 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -284,17 +284,18 @@ class ConfigToolDependency(ExternalDependency):
"""Helper method to print messages about the tool."""
if self.config is None:
if version is not None:
- mlog.log('found {} {!r} but need:'.format(self.tool_name, version),
- req_version)
+ mlog.log('Found', mlog.bold(self.tool_name), repr(version),
+ mlog.red('NO'), '(needed', req_version, ')')
else:
- mlog.log("No {} found; can't detect dependency".format(self.tool_name))
- mlog.log('Dependency {} found:'.format(self.name), mlog.red('NO'))
+ mlog.log('Found', mlog.bold(self.tool_name), repr(req_version),
+ mlog.red('NO'))
+ mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO'))
if self.required:
raise DependencyException('Dependency {} not found'.format(self.name))
return False
mlog.log('Found {}:'.format(self.tool_name), mlog.bold(shutil.which(self.config)),
'({})'.format(version))
- mlog.log('Dependency {} found:'.format(self.name), mlog.green('YES'))
+ mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES'))
return True
def get_config_value(self, args, stage):
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py
index d15d5da..91414d5 100644
--- a/mesonbuild/dependencies/dev.py
+++ b/mesonbuild/dependencies/dev.py
@@ -140,7 +140,7 @@ class LLVMDependency(ConfigToolDependency):
def __init__(self, environment, kwargs):
# It's necessary for LLVM <= 3.8 to use the C++ linker. For 3.9 and 4.0
# the C linker works fine if only using the C API.
- super().__init__('config-tool', environment, 'cpp', kwargs)
+ super().__init__('LLVM', environment, 'cpp', kwargs)
self.provided_modules = []
self.required_modules = set()
if not self.is_found:
@@ -150,7 +150,12 @@ class LLVMDependency(ConfigToolDependency):
# Currently meson doesn't really attempt to handle pre-release versions,
# so strip the 'svn' off the end, since it will probably cuase problems
# for users who want the patch version.
+ #
+ # If LLVM is built from svn then "svn" will be appended to the version
+ # string, if it's built from a git mirror then "git-<very short sha>"
+ # will be appended instead.
self.version = self.version.rstrip('svn')
+ self.version = self.version.split('git')[0]
self.provided_modules = self.get_config_value(['--components'], 'modules')
modules = stringlistify(extract_as_list(kwargs, 'modules'))
@@ -213,7 +218,7 @@ class LLVMDependency(ConfigToolDependency):
"""
for mod in sorted(set(modules)):
if mod not in self.provided_modules:
- mlog.log('LLVM module', mod, 'found:', mlog.red('NO'),
+ mlog.log('LLVM module', mlog.bold(mod), 'found:', mlog.red('NO'),
'(optional)' if not required else '')
if required:
self.is_found = False
@@ -222,7 +227,7 @@ class LLVMDependency(ConfigToolDependency):
'Could not find required LLVM Component: {}'.format(mod))
else:
self.required_modules.add(mod)
- mlog.log('LLVM module', mod, 'found:', mlog.green('YES'))
+ mlog.log('LLVM module', mlog.bold(mod), 'found:', mlog.green('YES'))
def need_threads(self):
return True
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index ce9313e..6ffa42a 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -804,7 +804,7 @@ class CupsDependency(ExternalDependency):
self.type_name = 'config-tool'
self.version = ctdep.version
self.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
- self.link_args = ctdep.get_config_value(['--libs'], 'link_args')
+ self.link_args = ctdep.get_config_value(['--ldflags', '--libs'], 'link_args')
self.is_found = True
return
except Exception as e:
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 9c15929..93f4b1a 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2507,6 +2507,7 @@ to directly access options of other subprojects.''')
@permittedKwargs(permitted_kwargs['subdir'])
def func_subdir(self, node, args, kwargs):
self.validate_arguments(args, 1, [str])
+ mesonlib.check_direntry_issues(args)
if '..' in args[0]:
raise InvalidArguments('Subdir contains ..')
if self.subdir == '' and args[0] == self.subproject_dir:
@@ -2916,6 +2917,7 @@ different subdirectory.
def source_strings_to_files(self, sources):
results = []
+ mesonlib.check_direntry_issues(sources)
for s in sources:
if isinstance(s, (mesonlib.File, GeneratedListHolder,
CustomTargetHolder, CustomTargetIndexHolder)):
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index f10a138..9ad0668 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -19,6 +19,7 @@ import stat
import time
import platform, subprocess, operator, os, shutil, re
import collections
+from mesonbuild import mlog
from glob import glob
@@ -59,6 +60,34 @@ else:
python_command = [sys.executable]
meson_command = python_command + [detect_meson_py_location()]
+def is_ascii_string(astring):
+ try:
+ if isinstance(astring, str):
+ astring.encode('ascii')
+ if isinstance(astring, bytes):
+ astring.decode('ascii')
+ except UnicodeDecodeError:
+ return False
+ return True
+
+def check_direntry_issues(direntry_array):
+ import locale
+ # Warn if the locale is not UTF-8. This can cause various unfixable issues
+ # such as os.stat not being able to decode filenames with unicode in them.
+ # There is no way to reset both the preferred encoding and the filesystem
+ # encoding, so we can just warn about it.
+ e = locale.getpreferredencoding()
+ if e.upper() != 'UTF-8' and not is_windows():
+ if not isinstance(direntry_array, list):
+ direntry_array = [direntry_array]
+ for de in direntry_array:
+ if is_ascii_string(de):
+ continue
+ mlog.warning('''You are using {!r} which is not a Unicode-compatible '
+locale but you are trying to access a file system entry called {!r} which is
+not pure ASCII. This may cause problems.
+'''.format(e, de), file=sys.stderr)
+
# Put this in objects that should not get dumped to pickle files
# by accident.
import threading
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 56765a5..7a01abc 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -626,7 +626,7 @@ class GnomeModule(ExtensionModule):
rv = [scan_target, typelib_target]
return ModuleReturnValue(rv, rv)
- @permittedKwargs({'build_by_default'})
+ @permittedKwargs({'build_by_default', 'depend_files'})
def compile_schemas(self, state, args, kwargs):
if args:
raise MesonException('Compile_schemas does not take positional arguments.')
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index d596622..25451d4 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -59,6 +59,7 @@ def coverage(source_root, build_root, log_dir):
remove_dir_from_trace(lcov_exe, covinfo, '/usr/include/*')
remove_dir_from_trace(lcov_exe, covinfo, '/usr/local/include/*')
remove_dir_from_trace(lcov_exe, covinfo, '/usr/src/*')
+ remove_dir_from_trace(lcov_exe, covinfo, '/usr/lib/llvm-*/include/*')
subprocess.check_call([genhtml_exe,
'--prefix', build_root,
'--output-directory', htmloutdir,
diff --git a/run_project_tests.py b/run_project_tests.py
index b94a976..323f9a3 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -312,10 +312,19 @@ def parse_test_args(testdir):
pass
return args
+# Build directory name must be the same so CCache works over
+# consecutive invocations.
+def create_deterministic_builddir(src_dir):
+ import hashlib
+ rel_dirname = 'b ' + hashlib.sha256(src_dir.encode(errors='ignore')).hexdigest()[0:10]
+ os.mkdir(rel_dirname)
+ abs_pathname = os.path.join(os.getcwd(), rel_dirname)
+ return abs_pathname
+
def run_test(skipped, testdir, extra_args, compiler, backend, flags, commands, should_fail):
if skipped:
return None
- with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
+ with AutoDeletedDir(create_deterministic_builddir(testdir)) as build_dir:
with AutoDeletedDir(tempfile.mkdtemp(prefix='i ', dir=os.getcwd())) as install_dir:
try:
return _run_test(testdir, build_dir, install_dir, extra_args, compiler, backend, flags, commands, should_fail)
diff --git a/run_unittests.py b/run_unittests.py
index f717e6d..d7d5ed0 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1741,7 +1741,7 @@ class FailureTests(BasePlatformTests):
raise unittest.SkipTest('wx-config or wx-config-3.0 found')
self.assertMesonRaises("dependency('wxwidgets')", self.dnf)
self.assertMesonOutputs("dependency('wxwidgets', required : false)",
- "No wx-config found;")
+ "Dependency .*WxWidgets.* found: .*NO.*")
def test_wx_dependency(self):
if not shutil.which('wx-config-3.0') and not shutil.which('wx-config'):
diff --git a/test cases/frameworks/21 libwmf/meson.build b/test cases/frameworks/21 libwmf/meson.build
index b39d8f4..1fdce2e 100644
--- a/test cases/frameworks/21 libwmf/meson.build
+++ b/test cases/frameworks/21 libwmf/meson.build
@@ -1,5 +1,10 @@
project('libwmf test', 'c')
+wm = find_program('libwmf-config', required : false)
+if not wm.found()
+ error('MESON_SKIP_TEST: libwmf-config not installed')
+endif
+
libwmf_dep = dependency('libwmf', version : '>= 0.2.8')
libwmf_ver = libwmf_dep.version()
assert(libwmf_ver.split('.').length() > 1, 'libwmf version is "@0@"'.format(libwmf_ver))