aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--docs/markdown/Builtin-options.md6
-rw-r--r--docs/markdown/Qt5-module.md3
-rw-r--r--docs/markdown/Reference-tables.md5
-rw-r--r--docs/markdown/Wrap-dependency-system-manual.md22
-rw-r--r--mesonbuild/backend/backends.py1
-rw-r--r--mesonbuild/compilers/c.py4
-rw-r--r--mesonbuild/compilers/compilers.py2
-rw-r--r--mesonbuild/modules/gnome.py31
-rw-r--r--mesonbuild/modules/qt.py10
-rw-r--r--mesonbuild/scripts/dist.py38
-rw-r--r--mesonbuild/scripts/gtkdochelper.py2
-rwxr-xr-xrun_unittests.py21
13 files changed, 97 insertions, 50 deletions
diff --git a/README.md b/README.md
index 1307263..7f7fa93 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,8 @@ build system.
[![Travis](https://travis-ci.org/mesonbuild/meson.svg?branch=master)](https://travis-ci.org/mesonbuild/meson)
[![Appveyor](https://ci.appveyor.com/api/projects/status/7jfaotriu8d8ncov?svg=true)](https://ci.appveyor.com/project/mesonbuild/meson)
[![Codecov](https://codecov.io/gh/mesonbuild/meson/coverage.svg?branch=master)](https://codecov.io/gh/mesonbuild/meson/branch/master)
+[![Code Quality: Python](https://img.shields.io/lgtm/grade/python/g/mesonbuild/meson.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mesonbuild/meson/context:python)
+[![Total Alerts](https://img.shields.io/lgtm/alerts/g/mesonbuild/meson.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mesonbuild/meson/alerts)
#### Dependencies
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index 55352aa..55d82a5 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -119,4 +119,8 @@ compiler being used:
The default values of `c_winlibs` and `cpp_winlibs` are in compiler-specific
argument forms, but the libraries are: kernel32, user32, gdi32, winspool,
-shell32, ole32, oleaut32, uuid, comdlg32, advapi32
+shell32, ole32, oleaut32, uuid, comdlg32, advapi32.
+
+c_args, cpp_args, c_link_args, and cpp_link_args only affect native builds,
+when cross compiling they will not be applied to binaries or libraries
+targeting the host system, only those being run on the build system.
diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md
index f59b6ec..9542a81 100644
--- a/docs/markdown/Qt5-module.md
+++ b/docs/markdown/Qt5-module.md
@@ -9,8 +9,9 @@ This method takes the following keyword arguments:
- `moc_headers`, `moc_sources`, `ui_files`, `qresources`, which define the files that require preprocessing with `moc`, `uic` and `rcc`
- `include_directories`, the directories to add to header search path for `moc` (optional)
- `moc_extra_arguments`, any additional arguments to `moc` (optional). Available since v0.44.0.
+ - `uic_extra_arguments`, any additional arguments to `uic` (optional). Available since v0.49.0.
- `dependencies`, dependency objects needed by moc. Available since v0.48.0.
-
+
It returns an opaque object that should be passed to a main build target.
## compile_translations (since v0.44.0)
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md
index ccdcb34..39ec1cd 100644
--- a/docs/markdown/Reference-tables.md
+++ b/docs/markdown/Reference-tables.md
@@ -65,6 +65,11 @@ set in the cross file.
Any cpu family not listed in the above list is not guaranteed to
remain stable in future releases.
+Those porting from autotools should note that meson does not add
+endianness to the name of the cpu_family. For example, autotools
+will call little endian PPC64 "ppc64le", meson will not, you must
+also check the `.endian()` value of the machine for this information.
+
## Operating system names
These are provided by the `.system()` method call.
diff --git a/docs/markdown/Wrap-dependency-system-manual.md b/docs/markdown/Wrap-dependency-system-manual.md
index 0977921..2e977b2 100644
--- a/docs/markdown/Wrap-dependency-system-manual.md
+++ b/docs/markdown/Wrap-dependency-system-manual.md
@@ -85,9 +85,9 @@ slightly different wrap file.
```ini
[wrap-git]
-directory=samplesubproject
-url=https://github.com/jpakkane/samplesubproject.git
-revision=head
+directory = samplesubproject
+url = https://github.com/jpakkane/samplesubproject.git
+revision = head
```
The format is straightforward. The only thing to note is the revision
@@ -106,14 +106,14 @@ these cases you can specify the upload URL by adding the following at
the end of your wrap file:
```ini
-push-url=git@git.example.com:projects/someproject.git # Supported since version 0.37.0
+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
+clone-recursive = true
```
## Using wrapped projects
@@ -121,12 +121,12 @@ clone-recursive=true
To use a subproject simply do this in your top level `meson.build`.
```meson
-foobar_sp = subproject('foobar')
+foobar_proj = subproject('foobar')
```
Usually dependencies consist of some header files plus a library to
-link against. To do this you would declare this internal dependency
-like this:
+link against. To do this in a project so it can be used as a subproject you
+would declare this internal dependency like this:
```meson
foobar_dep = declare_dependency(link_with : mylib,
@@ -137,7 +137,7 @@ Then in your main project you would use them like this:
```meson
executable('toplevel_exe', 'prog.c',
- dependencies : foobar_sp.get_variable('foobar_dep'))
+ dependencies : foobar_proj.get_variable('foobar_dep'))
```
Note that the subproject object is *not* used as the dependency, but
@@ -160,10 +160,10 @@ available.
foobar_dep = dependency('foobar', required : false)
if not foobar_dep.found()
- foobar_subproj = subproject('foobar')
+ foobar_proj = subproject('foobar')
# the subproject defines an internal dependency with
# the command declare_dependency().
- foobar_dep = foobar_subproj.get_variable('foobar_dep')
+ foobar_dep = foobar_proj.get_variable('foobar_dep')
endif
executable('toplevel_exe', 'prog.c',
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 0e7e8e0..78c2877 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -361,6 +361,7 @@ class Backend:
@staticmethod
def _libdir_is_system(libdir, compilers, env):
+ libdir = os.path.normpath(libdir)
for cc in compilers.values():
if libdir in cc.get_library_dirs(env):
return True
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 7c6a43b..72b9f24 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -986,12 +986,12 @@ class CCompiler(Compiler):
return self.find_library_impl(libname, env, extra_dirs, code, libtype)
def thread_flags(self, env):
- if for_haiku(self.is_cross, env):
+ if for_haiku(self.is_cross, env) or for_darwin(self.is_cross, env):
return []
return ['-pthread']
def thread_link_flags(self, env):
- if for_haiku(self.is_cross, env):
+ if for_haiku(self.is_cross, env) or for_darwin(self.is_cross, env):
return []
return ['-pthread']
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 87bf5af..26aeba7 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -299,7 +299,7 @@ msvc_optimization_args = {'0': [],
'g': ['/O0'],
'1': ['/O1'],
'2': ['/O2'],
- '3': ['/O3'],
+ '3': ['/O2'],
's': ['/O1'], # Implies /Os.
}
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 5128de4..1c2f034 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -331,14 +331,15 @@ class GnomeModule(ExtensionModule):
for lib in dep.libraries:
if hasattr(lib, 'held_object'):
lib = lib.held_object
- internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
- libdepflags = self._get_dependencies_flags(lib.get_external_deps(), state, depends, include_rpath,
- use_gir_args, True)
- cflags.update(libdepflags[0])
- internal_ldflags.update(libdepflags[1])
- external_ldflags.update(libdepflags[2])
- external_ldflags_nodedup += libdepflags[3]
- gi_includes.update(libdepflags[4])
+ if isinstance(lib, build.SharedLibrary):
+ internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
+ libdepflags = self._get_dependencies_flags(lib.get_external_deps(), state, depends, include_rpath,
+ use_gir_args, True)
+ cflags.update(libdepflags[0])
+ internal_ldflags.update(libdepflags[1])
+ external_ldflags.update(libdepflags[2])
+ external_ldflags_nodedup += libdepflags[3]
+ gi_includes.update(libdepflags[4])
extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath,
use_gir_args, True)
cflags.update(extdepflags[0])
@@ -518,7 +519,12 @@ class GnomeModule(ExtensionModule):
ret = []
for lang in langs:
- for link_arg in state.environment.coredata.get_external_link_args(lang):
+ if state.environment.is_cross_build():
+ link_args = state.environment.cross_info.config["properties"].get(lang + '_link_args', "")
+ else:
+ link_args = state.environment.coredata.get_external_link_args(lang)
+
+ for link_arg in link_args:
if link_arg.startswith('-L'):
ret.append(link_arg)
@@ -691,7 +697,10 @@ class GnomeModule(ExtensionModule):
def _get_external_args_for_langs(self, state, langs):
ret = []
for lang in langs:
- ret += state.environment.coredata.get_external_args(lang)
+ if state.environment.is_cross_build():
+ ret += state.environment.cross_info.config["properties"].get(lang + '_args', "")
+ else:
+ ret += state.environment.coredata.get_external_args(lang)
return ret
@staticmethod
@@ -1012,6 +1021,8 @@ This will become a hard error in the future.''')
ldflags.update(external_ldflags)
if state.environment.is_cross_build():
+ cflags.update(state.environment.cross_info.config["properties"].get('c_args', ""))
+ ldflags.update(state.environment.cross_info.config["properties"].get('c_link_args', ""))
compiler = state.environment.coredata.cross_compilers.get('c')
else:
cflags.update(state.environment.coredata.get_external_args('c'))
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index a8e916a..237220f 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -116,11 +116,12 @@ class QtBaseModule:
except Exception:
return []
+ @FeatureNewKwargs('qt.preprocess', '0.49.0', ['uic_extra_arguments'])
@FeatureNewKwargs('qt.preprocess', '0.44.0', ['moc_extra_arguments'])
- @permittedKwargs({'moc_headers', 'moc_sources', 'moc_extra_arguments', 'include_directories', 'dependencies', 'ui_files', 'qresources', 'method'})
+ @permittedKwargs({'moc_headers', 'moc_sources', 'uic_extra_arguments', 'moc_extra_arguments', 'include_directories', 'dependencies', 'ui_files', 'qresources', 'method'})
def preprocess(self, state, args, kwargs):
- rcc_files, ui_files, moc_headers, moc_sources, moc_extra_arguments, sources, include_directories, dependencies \
- = extract_as_list(kwargs, 'qresources', 'ui_files', 'moc_headers', 'moc_sources', 'moc_extra_arguments', 'sources', 'include_directories', 'dependencies', pop = True)
+ rcc_files, ui_files, moc_headers, moc_sources, uic_extra_arguments, moc_extra_arguments, sources, include_directories, dependencies \
+ = extract_as_list(kwargs, 'qresources', 'ui_files', 'moc_headers', 'moc_sources', 'uic_extra_arguments', 'moc_extra_arguments', 'sources', 'include_directories', 'dependencies', pop = True)
sources += args[1:]
method = kwargs.get('method', 'auto')
self._detect_tools(state.environment, method)
@@ -160,8 +161,9 @@ class QtBaseModule:
if len(ui_files) > 0:
if not self.uic.found():
raise MesonException(err_msg.format('UIC', 'uic-qt' + self.qt_version))
+ arguments = uic_extra_arguments + ['-o', '@OUTPUT@', '@INPUT@']
ui_kwargs = {'output': 'ui_@BASENAME@.h',
- 'arguments': ['-o', '@OUTPUT@', '@INPUT@']}
+ 'arguments': arguments}
ui_gen = build.Generator([self.uic], ui_kwargs)
ui_output = ui_gen.process_files('Qt{} ui'.format(self.qt_version), ui_files, state)
sources.append(ui_output)
diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py
index 6fa10ff..68cfcd0 100644
--- a/mesonbuild/scripts/dist.py
+++ b/mesonbuild/scripts/dist.py
@@ -26,6 +26,7 @@ from glob import glob
from mesonbuild.environment import detect_ninja
from mesonbuild.dependencies import ExternalProgram
from mesonbuild.mesonlib import windows_proof_rmtree
+from mesonbuild import mlog
def create_hash(fname):
hashname = fname + '.sha256sum'
@@ -80,18 +81,26 @@ def run_dist_scripts(dist_root, dist_scripts):
env = os.environ.copy()
env['MESON_DIST_ROOT'] = dist_root
for d in dist_scripts:
- print('Processing dist script %s.' % d)
+ print('Processing dist script %s' % d)
ddir, dname = os.path.split(d)
ep = ExternalProgram(dname,
search_dir=os.path.join(dist_root, ddir),
silent=True)
if not ep.found():
- sys.exit('Script %s could not be found in dist directory.' % d)
+ sys.exit('Script %s could not be found in dist directory' % d)
pc = subprocess.run(ep.command, env=env)
if pc.returncode != 0:
- sys.exit('Dist script errored out.')
+ sys.exit('Dist script errored out')
+
+
+def git_have_dirty_index(src_root):
+ '''Check whether there are uncommitted changes in git'''
+ ret = subprocess.call(['git', '-C', src_root, 'diff-index', '--quiet', 'HEAD'])
+ return ret == 1
def create_dist_git(dist_name, src_root, bld_root, dist_sub, dist_scripts):
+ if git_have_dirty_index(src_root):
+ mlog.warning('Repository has uncommitted changes that will not be included in the dist tarball')
distdir = os.path.join(dist_sub, dist_name)
if os.path.exists(distdir):
shutil.rmtree(distdir)
@@ -111,14 +120,21 @@ def create_dist_git(dist_name, src_root, bld_root, dist_sub, dist_scripts):
return (xzname, )
+def hg_have_dirty_index(src_root):
+ '''Check whether there are uncommitted changes in hg'''
+ out = subprocess.check_output(['hg', '-R', src_root, 'summary'])
+ return b'commit: (clean)' not in out
+
def create_dist_hg(dist_name, src_root, bld_root, dist_sub, dist_scripts):
- os.makedirs(dist_sub, exist_ok=True)
+ if hg_have_dirty_index(src_root):
+ mlog.warning('Repository has uncommitted changes that will not be included in the dist tarball')
+ os.makedirs(dist_sub, exist_ok=True)
tarname = os.path.join(dist_sub, dist_name + '.tar')
xzname = tarname + '.xz'
subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'tar', tarname])
if len(dist_scripts) > 0:
- print('WARNING: dist scripts not supported in Mercurial projects.')
+ mlog.warning('dist scripts are not supported in Mercurial projects')
with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf:
shutil.copyfileobj(tf, xf)
os.unlink(tarname)
@@ -129,7 +145,7 @@ def create_dist_hg(dist_name, src_root, bld_root, dist_sub, dist_scripts):
def check_dist(packagename, meson_command):
- print('Testing distribution package %s.' % packagename)
+ print('Testing distribution package %s' % packagename)
unpackdir = tempfile.mkdtemp()
builddir = tempfile.mkdtemp()
installdir = tempfile.mkdtemp()
@@ -142,21 +158,21 @@ def check_dist(packagename, meson_command):
print('Running Meson on distribution package failed')
return 1
if subprocess.call([ninja_bin], cwd=builddir) != 0:
- print('Compiling the distribution package failed.')
+ print('Compiling the distribution package failed')
return 1
if subprocess.call([ninja_bin, 'test'], cwd=builddir) != 0:
- print('Running unit tests on the distribution package failed.')
+ print('Running unit tests on the distribution package failed')
return 1
myenv = os.environ.copy()
myenv['DESTDIR'] = installdir
if subprocess.call([ninja_bin, 'install'], cwd=builddir, env=myenv) != 0:
- print('Installing the distribution package failed.')
+ print('Installing the distribution package failed')
return 1
finally:
shutil.rmtree(unpackdir)
shutil.rmtree(builddir)
shutil.rmtree(installdir)
- print('Distribution package %s tested.' % packagename)
+ print('Distribution package %s tested' % packagename)
return 0
def run(args):
@@ -177,7 +193,7 @@ def run(args):
elif os.path.isdir(os.path.join(src_root, '.hg')):
names = create_dist_hg(dist_name, src_root, bld_root, dist_sub, build.dist_scripts)
else:
- print('Dist currently only works with Git or Mercurial repos.')
+ print('Dist currently only works with Git or Mercurial repos')
return 1
if names is None:
return 1
diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
index 04b4deb..01ced5b 100644
--- a/mesonbuild/scripts/gtkdochelper.py
+++ b/mesonbuild/scripts/gtkdochelper.py
@@ -66,7 +66,7 @@ def gtkdoc_run_check(cmd, cwd, library_paths=None):
# This preserves the order of messages.
p, out = Popen_safe(cmd, cwd=cwd, env=env, stderr=subprocess.STDOUT)[0:2]
if p.returncode != 0:
- err_msg = ["{!r} failed with status {:d}".format(cmd[0], p.returncode)]
+ err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)]
if out:
err_msg.append(out)
raise MesonException('\n'.join(err_msg))
diff --git a/run_unittests.py b/run_unittests.py
index 8fe1c11..8bea2d0 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -37,7 +37,7 @@ import mesonbuild.coredata
import mesonbuild.modules.gnome
from mesonbuild.interpreter import Interpreter, ObjectHolder
from mesonbuild.mesonlib import (
- is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd,
+ is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku,
windows_proof_rmtree, python_command, version_compare,
BuildDirLock, Version
)
@@ -3270,17 +3270,17 @@ class LinuxlikeTests(BasePlatformTests):
self.assertEqual(sorted(out), sorted(['libfoo >= 1.0']))
out = self._run(cmd + ['--cflags-only-other']).strip().split()
- self.assertEqual(sorted(out), sorted(['-pthread', '-DCUSTOM']))
+ self.check_pkg_flags_are_same(out, ['-pthread', '-DCUSTOM'])
out = self._run(cmd + ['--libs-only-l', '--libs-only-other']).strip().split()
- self.assertEqual(sorted(out), sorted(['-pthread', '-lcustom',
- '-llibmain', '-llibexposed']))
+ self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom',
+ '-llibmain', '-llibexposed'])
out = self._run(cmd + ['--libs-only-l', '--libs-only-other', '--static']).strip().split()
- self.assertEqual(sorted(out), sorted(['-pthread', '-lcustom',
- '-llibmain', '-llibexposed',
- '-llibinternal', '-lcustom2',
- '-lfoo']))
+ self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom',
+ '-llibmain', '-llibexposed',
+ '-llibinternal', '-lcustom2',
+ '-lfoo'])
cmd = ['pkg-config', 'requires-test']
out = self._run(cmd + ['--print-requires']).strip().split('\n')
@@ -3290,6 +3290,11 @@ class LinuxlikeTests(BasePlatformTests):
out = self._run(cmd + ['--print-requires-private']).strip().split('\n')
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
+ def check_pkg_flags_are_same(self, output, expected):
+ if is_osx() or is_haiku():
+ expected = [x for x in expected if x != '-pthread']
+ self.assertEqual(sorted(output), sorted(expected))
+
def test_pkg_unfound(self):
testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig')
self.init(testdir)