aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Gnome-module.md4
-rw-r--r--docs/markdown/Reference-manual.md5
-rw-r--r--docs/markdown/Release-notes-for-0.41.0.md4
-rw-r--r--docs/markdown/Release-notes-for-0.42.0.md5
-rw-r--r--man/meson.12
-rw-r--r--man/mesonconf.12
-rw-r--r--man/mesonintrospect.12
-rw-r--r--man/mesontest.12
-rw-r--r--man/wraptool.12
-rw-r--r--mesonbuild/backend/ninjabackend.py64
-rw-r--r--mesonbuild/build.py45
-rw-r--r--mesonbuild/compilers.py25
-rw-r--r--mesonbuild/dependencies/base.py5
-rw-r--r--mesonbuild/dependencies/dev.py2
-rw-r--r--mesonbuild/dependencies/ui.py6
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/modules/gnome.py8
-rw-r--r--mesonbuild/scripts/dist.py36
-rw-r--r--mesonbuild/scripts/yelphelper.py15
-rwxr-xr-xrun_project_tests.py36
-rwxr-xr-xrun_tests.py7
-rwxr-xr-xrun_unittests.py87
-rw-r--r--test cases/common/127 cpp and asm/retval-arm.S7
-rw-r--r--test cases/common/127 cpp and asm/retval-x86.S7
-rw-r--r--test cases/common/127 cpp and asm/retval-x86_64.S7
-rw-r--r--test cases/common/141 c cpp and asm/retval-arm.S7
-rw-r--r--test cases/common/141 c cpp and asm/retval-x86.S8
-rw-r--r--test cases/common/141 c cpp and asm/retval-x86_64.S7
-rw-r--r--test cases/failing/55 wrong shared crate type/foo.rs0
-rw-r--r--test cases/failing/55 wrong shared crate type/meson.build3
-rw-r--r--test cases/failing/56 wrong static crate type/foo.rs0
-rw-r--r--test cases/failing/56 wrong static crate type/meson.build3
-rw-r--r--test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml1
-rw-r--r--test cases/frameworks/10 gtk-doc/include/foo-version.h.in29
-rw-r--r--test cases/frameworks/10 gtk-doc/include/meson.build10
-rw-r--r--test cases/frameworks/10 gtk-doc/meson.build4
-rw-r--r--test cases/frameworks/13 yelp/help/meson.build8
-rw-r--r--test cases/frameworks/13 yelp/installed_files.txt7
-rw-r--r--test cases/frameworks/9 wxwidgets/meson.build1
-rw-r--r--test cases/linuxlike/5 dependency versions/meson.build2
-rw-r--r--test cases/rust/2 sharedlib/installed_files.txt2
-rw-r--r--test cases/rust/4 polyglot/installed_files.txt2
-rw-r--r--test cases/rust/4 polyglot/meson.build5
-rw-r--r--test cases/rust/4 polyglot/prog.c8
-rw-r--r--test cases/rust/4 polyglot/stuff.rs6
-rw-r--r--test cases/rust/5 polyglot static/installed_files.txt2
-rw-r--r--test cases/rust/5 polyglot static/meson.build10
-rw-r--r--test cases/rust/5 polyglot static/prog.c8
-rw-r--r--test cases/rust/5 polyglot static/stuff.rs6
-rw-r--r--test cases/unit/10 d dedup/meson.build6
-rw-r--r--test cases/unit/10 d dedup/prog.c14
-rw-r--r--test cases/vala/16 mixed dependence/meson.build6
-rw-r--r--test cases/vala/7 shared library/lib/meson.build10
-rw-r--r--test cases/windows/1 basic/prog.c2
54 files changed, 467 insertions, 97 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 61b88ad..e709fd5 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -127,9 +127,11 @@ This also creates two targets for translations `help-$project-update-po` and `he
* `sources`: list of pages
* `media`: list of media such as images
-* `symlink_media`: if media should be symlinked (requires newish yelp) defaults to `false`
+* `symlink_media`: if media should be symlinked not copied (defaults to `true` since 0.42.0)
* `languages`: list of languages for translations
+Note that very old versions of yelp may not support symlinked media; At least 3.10 should work.
+
*Added 0.36.0*
### gnome.gtkdoc()
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 492666b..dd77d6d 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -510,11 +510,12 @@ Joins the given strings into a file system path segment. For example `join_paths
Builds a library that is either static or shared depending on the value of `default_library` user option. You should use this instead of [`shared_library`](#shared_library) or [`static_library`](#static_library) most of the time. This allows you to toggle your entire project (including subprojects) from shared to static with only one option.
-The keyword arguments for this are the same as for [`executable`](#executable) with the following addition:
+The keyword arguments for this are the same as for [`executable`](#executable) with the following additions:
- `name_prefix` the string that will be used as the suffix for the target by overriding the default (only used for libraries). By default this is `lib` on all platforms and compilers except with MSVC where it is omitted.
+- `rust_crate_type` specifies the crate type for Rust libraries. Defaults to `dylib` for shared libraries and `rlib` for static libraries.
-`static_library` and `shared_library` also accept this keyword argument.
+`static_library` and `shared_library` also accept these keyword arguments.
### message()
diff --git a/docs/markdown/Release-notes-for-0.41.0.md b/docs/markdown/Release-notes-for-0.41.0.md
index eb565ab..1ddde95 100644
--- a/docs/markdown/Release-notes-for-0.41.0.md
+++ b/docs/markdown/Release-notes-for-0.41.0.md
@@ -11,7 +11,7 @@ Native support for linking against LLVM using the `dependency` function.
## vcs_tag keyword fallback is is now optional
-The `fallback` keyword in `vcs_tag` is now optional. If not given, its value
+The `fallback` keyword in `vcs_tag()` is now optional. If not given, its value
defaults to the return value of `meson.project_version()`.
## Better quoting of special characters in ninja command invocations
@@ -56,7 +56,7 @@ Targets for building rust now take a `rust_args` keyword.
Code coverage can be generated for tests by passing the `--cov` argument to
the `run_tests.py` test runner. Note, since multiple processes are used,
-coverage must be combined before producing a report (`coverage3 combine`.)
+coverage must be combined before producing a report (`coverage3 combine`).
## Reproducible builds
diff --git a/docs/markdown/Release-notes-for-0.42.0.md b/docs/markdown/Release-notes-for-0.42.0.md
index 5ea0d18..dcb86c3 100644
--- a/docs/markdown/Release-notes-for-0.42.0.md
+++ b/docs/markdown/Release-notes-for-0.42.0.md
@@ -7,4 +7,7 @@ short-description: Release notes for 0.42 (preliminary)
# New features
-Add features here as code is merged to master.
+## Distribution tarballs from Mercurial repositories
+
+Creating distribution tarballs can now be made out of projects based on
+Mercurial. As before, this remains possible only with the Ninja backend.
diff --git a/man/meson.1 b/man/meson.1
index 9cedccc..1cd60b6 100644
--- a/man/meson.1
+++ b/man/meson.1
@@ -1,4 +1,4 @@
-.TH MESON "1" "June 2017" "meson 0.41.0" "User Commands"
+.TH MESON "1" "June 2017" "meson 0.41.1" "User Commands"
.SH NAME
meson - a high productivity build system
.SH DESCRIPTION
diff --git a/man/mesonconf.1 b/man/mesonconf.1
index 0715637..6bb9d39 100644
--- a/man/mesonconf.1
+++ b/man/mesonconf.1
@@ -1,4 +1,4 @@
-.TH MESONCONF "1" "June 2017" "mesonconf 0.41.0" "User Commands"
+.TH MESONCONF "1" "June 2017" "mesonconf 0.41.1" "User Commands"
.SH NAME
mesonconf - a tool to configure Meson builds
.SH DESCRIPTION
diff --git a/man/mesonintrospect.1 b/man/mesonintrospect.1
index 7b3455d..1918b4f 100644
--- a/man/mesonintrospect.1
+++ b/man/mesonintrospect.1
@@ -1,4 +1,4 @@
-.TH MESONCONF "1" "June 2017" "mesonintrospect 0.41.0" "User Commands"
+.TH MESONCONF "1" "June 2017" "mesonintrospect 0.41.1" "User Commands"
.SH NAME
mesonintrospect - a tool to extract information about a Meson build
.SH DESCRIPTION
diff --git a/man/mesontest.1 b/man/mesontest.1
index 88d0520..cf21fe7 100644
--- a/man/mesontest.1
+++ b/man/mesontest.1
@@ -1,4 +1,4 @@
-.TH MESON "1" "June 2017" "meson 0.41.0" "User Commands"
+.TH MESON "1" "June 2017" "meson 0.41.1" "User Commands"
.SH NAME
mesontest - test tool for the Meson build system
.SH DESCRIPTION
diff --git a/man/wraptool.1 b/man/wraptool.1
index 5013cf8..73c2568 100644
--- a/man/wraptool.1
+++ b/man/wraptool.1
@@ -1,4 +1,4 @@
-.TH WRAPTOOL "1" "June 2017" "meson 0.41.0" "User Commands"
+.TH WRAPTOOL "1" "June 2017" "meson 0.41.1" "User Commands"
.SH NAME
wraptool - source dependency downloader
.SH DESCRIPTION
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 9a48c4e..761d508 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -510,12 +510,12 @@ int dummy;
cmd_type = 'meson_exe.py custom'
else:
cmd_type = 'custom'
-
if target.depfile is not None:
rel_dfile = os.path.join(self.get_target_dir(target), target.depfile)
abs_pdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
os.makedirs(abs_pdir, exist_ok=True)
elem.add_item('DEPFILE', rel_dfile)
+ cmd = self.replace_paths(target, cmd)
elem.add_item('COMMAND', cmd)
elem.add_item('description', desc.format(target.name, cmd_type))
elem.write(outfile)
@@ -564,7 +564,9 @@ int dummy;
else:
cmd.append(target.command)
cmd += arg_strings
+
elem.add_dep(deps)
+ cmd = self.replace_paths(target, cmd)
elem.add_item('COMMAND', cmd)
elem.add_item('description', 'Running external command %s.' % target.name)
elem.add_item('pool', 'console')
@@ -1098,7 +1100,13 @@ int dummy;
args += ['--library=' + target.name]
# Outputted header
hname = os.path.join(self.get_target_dir(target), target.vala_header)
- args += ['-H', hname, '--use-header']
+ args += ['-H', hname]
+ if self.is_unity(target):
+ # Without this the declarations will get duplicated in the .c
+ # files and cause a build failure when all of them are
+ # #include-d in one .c file.
+ # https://github.com/mesonbuild/meson/issues/1969
+ args += ['--use-header']
valac_outputs.append(hname)
# Outputted vapi file
vapiname = os.path.join(self.get_target_dir(target), target.vala_vapi)
@@ -1157,8 +1165,10 @@ int dummy;
args = ['--crate-type']
if isinstance(target, build.Executable):
cratetype = 'bin'
+ elif hasattr(target, 'rust_crate_type'):
+ cratetype = target.rust_crate_type
elif isinstance(target, build.SharedLibrary):
- cratetype = 'rlib'
+ cratetype = 'dylib'
elif isinstance(target, build.StaticLibrary):
cratetype = 'rlib'
else:
@@ -1177,6 +1187,36 @@ int dummy;
if d == '':
d = '.'
args += ['-L', d]
+ has_shared_deps = False
+ for dep in target.get_dependencies():
+ if isinstance(dep, build.SharedLibrary):
+ has_shared_deps = True
+ if isinstance(target, build.SharedLibrary) or has_shared_deps:
+ # add prefer-dynamic if any of the Rust libraries we link
+ # against are dynamic, otherwise we'll end up with
+ # multiple implementations of crates
+ args += ['-C', 'prefer-dynamic']
+
+ # build the usual rpath arguments as well...
+
+ # Set runtime-paths so we can run executables without needing to set
+ # LD_LIBRARY_PATH, etc in the environment. Doesn't work on Windows.
+ if '/' in target.name or '\\' in target.name:
+ # Target names really should not have slashes in them, but
+ # unfortunately we did not check for that and some downstream projects
+ # now have them. Once slashes are forbidden, remove this bit.
+ target_slashname_workaround_dir = os.path.join(os.path.split(target.name)[0],
+ self.get_target_dir(target))
+ else:
+ target_slashname_workaround_dir = self.get_target_dir(target)
+ rpath_args = rustc.build_rpath_args(self.environment.get_build_dir(),
+ target_slashname_workaround_dir,
+ self.determine_rpath_dirs(target),
+ target.install_rpath)
+ # ... but then add rustc's sysroot to account for rustup
+ # installations
+ for rpath_arg in rpath_args:
+ args += ['-C', 'link-arg=' + rpath_arg + ':' + os.path.join(rustc.get_sysroot(), 'lib')]
element = NinjaBuildElement(self.all_outputs, target_name, 'rust_COMPILER', relsrc)
if len(orderdeps) > 0:
element.add_orderdep(orderdeps)
@@ -1184,6 +1224,8 @@ int dummy;
element.add_item('targetdep', depfile)
element.add_item('cratetype', cratetype)
element.write(outfile)
+ if isinstance(target, build.SharedLibrary):
+ self.generate_shsym(outfile, target)
def swift_module_file_name(self, target):
return os.path.join(self.get_target_private_dir(target),
@@ -1649,6 +1691,16 @@ rule FORTRAN_DEP_HACK
continue
self.generate_genlist_for_target(genlist, target, outfile)
+ def replace_paths(self, target, args):
+ source_target_dir = self.get_target_source_dir(target)
+ relout = self.get_target_private_dir(target)
+ args = [x.replace("@SOURCE_DIR@", self.build_to_src).replace("@BUILD_DIR@", relout)
+ for x in args]
+ args = [x.replace("@CURRENT_SOURCE_DIR@", source_target_dir) for x in args]
+ args = [x.replace("@SOURCE_ROOT@", self.build_to_src).replace("@BUILD_ROOT@", '.')
+ for x in args]
+ return args
+
def generate_genlist_for_target(self, genlist, target, outfile):
generator = genlist.get_generator()
exe = generator.get_exe()
@@ -1682,11 +1734,7 @@ rule FORTRAN_DEP_HACK
if sole_output == '':
outfilelist = outfilelist[len(generator.outputs):]
relout = self.get_target_private_dir(target)
- args = [x.replace("@SOURCE_DIR@", self.build_to_src).replace("@BUILD_DIR@", relout)
- for x in args]
- args = [x.replace("@CURRENT_SOURCE_DIR@", source_target_dir) for x in args]
- args = [x.replace("@SOURCE_ROOT@", self.build_to_src).replace("@BUILD_ROOT@", '.')
- for x in args]
+ args = self.replace_paths(target, args)
cmdlist = exe_arr + self.replace_extra_args(args, genlist)
elem = NinjaBuildElement(self.all_outputs, outfiles, rulename, infilename)
if generator.depfile is not None:
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index ba30fec..c73ba3a 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -71,6 +71,7 @@ known_lib_kwargs.update({'version': True, # Only for shared libs
'vala_vapi': True,
'vala_gir': True,
'pic': True, # Only for static libs
+ 'rust_crate_type': True, # Only for Rust libs
})
@@ -1123,6 +1124,14 @@ class StaticLibrary(BuildTarget):
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
if 'cs' in self.compilers:
raise InvalidArguments('Static libraries not supported for C#.')
+ if 'rust' in self.compilers:
+ # If no crate type is specified, or it's the generic lib type, use rlib
+ if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'lib':
+ mlog.debug('Defaulting Rust static library target crate type to rlib')
+ self.rust_crate_type = 'rlib'
+ # Don't let configuration proceed with a non-static crate type
+ elif self.rust_crate_type not in ['rlib', 'staticlib']:
+ raise InvalidArguments('Crate type "{0}" invalid for static libraries; must be "rlib" or "staticlib"'.format(self.rust_crate_type))
# By default a static library is named libfoo.a even on Windows because
# MSVC does not have a consistent convention for what static libraries
# are called. The MSVC CRT uses libfoo.lib syntax but nothing else uses
@@ -1133,9 +1142,12 @@ class StaticLibrary(BuildTarget):
if not hasattr(self, 'prefix'):
self.prefix = 'lib'
if not hasattr(self, 'suffix'):
- # Rust static library crates have .rlib suffix
if 'rust' in self.compilers:
- self.suffix = 'rlib'
+ if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'rlib':
+ # default Rust static library suffix
+ self.suffix = 'rlib'
+ elif self.rust_crate_type == 'staticlib':
+ self.suffix = 'a'
else:
self.suffix = 'a'
self.filename = self.prefix + self.name + '.' + self.suffix
@@ -1147,6 +1159,15 @@ class StaticLibrary(BuildTarget):
def check_unknown_kwargs(self, kwargs):
self.check_unknown_kwargs_int(kwargs, known_lib_kwargs)
+ def process_kwargs(self, kwargs, environment):
+ super().process_kwargs(kwargs, environment)
+ if 'rust_crate_type' in kwargs:
+ rust_crate_type = kwargs['rust_crate_type']
+ if isinstance(rust_crate_type, str):
+ self.rust_crate_type = rust_crate_type
+ else:
+ raise InvalidArguments('Invalid rust_crate_type "{0}": must be a string.'.format(rust_crate_type))
+
class SharedLibrary(BuildTarget):
def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs):
self.soversion = None
@@ -1159,6 +1180,14 @@ class SharedLibrary(BuildTarget):
# The import library that GCC would generate (and prefer)
self.gcc_import_filename = None
super().__init__(name, subdir, subproject, is_cross, sources, objects, environment, kwargs)
+ if 'rust' in self.compilers:
+ # If no crate type is specified, or it's the generic lib type, use dylib
+ if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'lib':
+ mlog.debug('Defaulting Rust dynamic library target crate type to "dylib"')
+ self.rust_crate_type = 'dylib'
+ # Don't let configuration proceed with a non-dynamic crate type
+ elif self.rust_crate_type not in ['dylib', 'cdylib']:
+ raise InvalidArguments('Crate type "{0}" invalid for dynamic libraries; must be "dylib" or "cdylib"'.format(self.rust_crate_type))
if not hasattr(self, 'prefix'):
self.prefix = None
if not hasattr(self, 'suffix'):
@@ -1200,12 +1229,6 @@ class SharedLibrary(BuildTarget):
prefix = ''
suffix = 'dll'
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
- # Rust
- elif 'rust' in self.compilers:
- # Currently, we always build --crate-type=rlib
- prefix = 'lib'
- suffix = 'rlib'
- self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
# C, C++, Swift, Vala
# Only Windows uses a separate import library for linking
# For all other targets/platforms import_filename stays None
@@ -1315,6 +1338,12 @@ class SharedLibrary(BuildTarget):
raise InvalidArguments(
'Shared library vs_module_defs must be either a string, '
'a file object or a Custom Target')
+ if 'rust_crate_type' in kwargs:
+ rust_crate_type = kwargs['rust_crate_type']
+ if isinstance(rust_crate_type, str):
+ self.rust_crate_type = rust_crate_type
+ else:
+ raise InvalidArguments('Invalid rust_crate_type "{0}": must be a string.'.format(rust_crate_type))
def check_unknown_kwargs(self, kwargs):
self.check_unknown_kwargs_int(kwargs, known_lib_kwargs)
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 2b54cc8..979a5ac 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -430,6 +430,17 @@ class CompilerArgs(list):
to recursively search for symbols in the libraries. This is not needed
with other linkers.
'''
+
+ # A standalone argument must never be deduplicated because it is
+ # defined by what comes _after_ it. Thus dedupping this:
+ # -D FOO -D BAR
+ # would yield either
+ # -D FOO BAR
+ # or
+ # FOO -D BAR
+ # both of which are invalid.
+ if arg in cls.dedup2_prefixes:
+ return 0
if arg in cls.dedup2_args or \
arg.startswith(cls.dedup2_prefixes) or \
arg.endswith(cls.dedup2_suffixes):
@@ -1042,7 +1053,7 @@ class CCompiler(Compiler):
def _links_wrapper(self, code, env, extra_args, dependencies):
"Shares common code between self.links and self.run"
args = self._get_compiler_check_args(env, extra_args, dependencies, mode='link')
- return self.compile(code, args.to_native())
+ return self.compile(code, args)
def links(self, code, env, extra_args=None, dependencies=None):
with self._links_wrapper(code, env, extra_args, dependencies) as p:
@@ -1559,7 +1570,7 @@ class MonoCompiler(Compiler):
def split_shlib_to_parts(self, fname):
return None, fname
- def build_rpath_args(self, build_dir, rpath_paths, install_rpath):
+ def build_rpath_args(self, build_dir, from_dir, rpath_paths, install_rpath):
return []
def get_dependency_gen_args(self, outtarget, outfile):
@@ -1640,7 +1651,7 @@ class JavaCompiler(Compiler):
def split_shlib_to_parts(self, fname):
return None, fname
- def build_rpath_args(self, build_dir, rpath_paths, install_rpath):
+ def build_rpath_args(self, build_dir, from_dir, rpath_paths, install_rpath):
return []
def get_dependency_gen_args(self, outtarget, outfile):
@@ -1822,6 +1833,14 @@ class RustCompiler(Compiler):
def get_buildtype_args(self, buildtype):
return rust_buildtype_args[buildtype]
+ def build_rpath_args(self, build_dir, from_dir, rpath_paths, install_rpath):
+ return self.build_unix_rpath_args(build_dir, from_dir, rpath_paths, install_rpath)
+
+ def get_sysroot(self):
+ cmd = self.exelist + ['--print', 'sysroot']
+ p, stdo, stde = Popen_safe(cmd)
+ return stdo.split('\n')[0]
+
class SwiftCompiler(Compiler):
def __init__(self, exelist, version):
self.language = 'swift'
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 14ec41e..fdb5ab8 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -528,7 +528,10 @@ class ExternalLibrary(ExternalDependency):
C-like code. Note that C++ libraries *can* be linked with C code with
a C++ linker (and vice-versa).
'''
- if self.language == 'vala' and language != 'vala':
+ # Using a vala library in a non-vala target, or a non-vala library in a vala target
+ # XXX: This should be extended to other non-C linkers such as Rust
+ if (self.language == 'vala' and language != 'vala') or \
+ (language == 'vala' and self.language != 'vala'):
return []
return self.link_args
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py
index d7a7181..f991d3c 100644
--- a/mesonbuild/dependencies/dev.py
+++ b/mesonbuild/dependencies/dev.py
@@ -236,7 +236,7 @@ class ValgrindDependency(PkgConfigDependency):
link to its (static) libraries.
'''
def __init__(self, env, kwargs):
- super().__init__('valgrind', env, None, kwargs)
+ super().__init__('valgrind', env, kwargs)
def get_link_args(self):
return []
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 8537a7e..7cc8bb4 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -312,7 +312,7 @@ class QtBaseDependency(ExternalDependency):
fname = 'Qt' + m
fwdep = ExtraFrameworkDependency(fname, False, libdir, self.env,
self.language, kwargs)
- self.cargs.append('-F' + libdir)
+ self.compile_args.append('-F' + libdir)
if fwdep.found():
self.is_found = True
self.compile_args += fwdep.get_compile_args()
@@ -426,6 +426,8 @@ class WxDependency(ExternalDependency):
self.version = 'none'
if WxDependency.wx_found is None:
self.check_wxconfig()
+ else:
+ self.wxc = WxDependency.wx_found
if not WxDependency.wx_found:
mlog.log("Neither wx-config-3.0 nor wx-config found; can't detect dependency")
return
@@ -480,7 +482,7 @@ class WxDependency(ExternalDependency):
mlog.log('Found wx-config:', mlog.bold(shutil.which(wxc)),
'(%s)' % out.strip())
self.wxc = wxc
- WxDependency.wx_found = True
+ WxDependency.wx_found = wxc
return
except (FileNotFoundError, PermissionError):
pass
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 525a41d..5e672bb 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -158,7 +158,7 @@ def list_buildsystem_files(coredata, builddata):
def list_deps(coredata):
result = []
- for d in coredata.deps:
+ for d in coredata.deps.values():
if d.found():
args = {'compile_args': d.get_compile_args(),
'link_args': d.get_link_args()}
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6f38661..06a1fad 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -294,7 +294,7 @@ class GnomeModule(ExtensionModule):
else:
link_command = ['-l' + lib.name]
if isinstance(lib, build.SharedLibrary):
- libdir = state.backend.get_target_dir(lib)
+ libdir = os.path.join(state.environment.get_build_dir(), state.backend.get_target_dir(lib))
link_command.append('-L' + libdir)
# Needed for the following binutils bug:
# https://github.com/mesonbuild/meson/issues/1911
@@ -303,6 +303,8 @@ class GnomeModule(ExtensionModule):
for d in state.backend.determine_rpath_dirs(lib):
d = os.path.join(state.environment.get_build_dir(), d)
link_command.append('-L' + d)
+ if include_rpath:
+ link_command.append('-Wl,-rpath,' + d)
if include_rpath:
link_command.append('-Wl,-rpath,' + libdir)
if depends:
@@ -626,7 +628,7 @@ class GnomeModule(ExtensionModule):
langs = mesonlib.stringlistify(kwargs.pop('languages', []))
media = mesonlib.stringlistify(kwargs.pop('media', []))
- symlinks = kwargs.pop('symlink_media', False)
+ symlinks = kwargs.pop('symlink_media', True)
if not isinstance(symlinks, bool):
raise MesonException('symlink_media must be a boolean')
@@ -707,6 +709,8 @@ class GnomeModule(ExtensionModule):
for inc_dir in src_dir.get_incdirs():
header_dirs.append(os.path.join(state.environment.get_source_dir(),
src_dir.get_curdir(), inc_dir))
+ header_dirs.append(os.path.join(state.environment.get_build_dir(),
+ src_dir.get_curdir(), inc_dir))
else:
header_dirs.append(src_dir)
diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/scripts/dist.py
index 325a882..cb3bbe2 100644
--- a/mesonbuild/scripts/dist.py
+++ b/mesonbuild/scripts/dist.py
@@ -13,6 +13,7 @@
# limitations under the License.
+import lzma
import os
import shutil
import subprocess
@@ -29,10 +30,11 @@ def create_hash(fname):
m = hashlib.sha256()
m.update(open(fname, 'rb').read())
with open(hashname, 'w') as f:
- f.write('%s %s\n' % (m.hexdigest(), os.path.split(fname)[-1]))
+ f.write('%s %s\n' % (m.hexdigest(), os.path.basename(fname)))
+
def create_zip(zipfilename, packaging_dir):
- prefix = os.path.split(packaging_dir)[0]
+ prefix = os.path.dirname(packaging_dir)
removelen = len(prefix) + 1
with zipfile.ZipFile(zipfilename,
'w',
@@ -70,7 +72,8 @@ def process_submodules(dirname):
continue
del_gitfiles(os.path.join(dirname, v))
-def create_dist(dist_name, src_root, bld_root, dist_sub):
+
+def create_dist_git(dist_name, src_root, bld_root, dist_sub):
distdir = os.path.join(dist_sub, dist_name)
if os.path.exists(distdir):
shutil.rmtree(distdir)
@@ -81,13 +84,29 @@ def create_dist(dist_name, src_root, bld_root, dist_sub):
xzname = distdir + '.tar.xz'
# Should use shutil but it got xz support only in 3.5.
with tarfile.open(xzname, 'w:xz') as tf:
- tf.add(distdir, os.path.split(distdir)[1])
+ tf.add(distdir, dist_name)
# Create only .tar.xz for now.
# zipname = distdir + '.zip'
# create_zip(zipname, distdir)
shutil.rmtree(distdir)
return (xzname, )
+
+def create_dist_hg(dist_name, src_root, bld_root, dist_sub):
+ 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])
+ with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf:
+ shutil.copyfileobj(tf, xf)
+ os.unlink(tarname)
+ # Create only .tar.xz for now.
+ # zipname = os.path.join(dist_sub, dist_name + '.zip')
+ # subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'zip', zipname])
+ return (xzname, )
+
+
def check_dist(packagename, meson_command):
print('Testing distribution package %s.' % packagename)
unpackdir = tempfile.mkdtemp()
@@ -132,10 +151,13 @@ def run(args):
dist_name = build.project_name + '-' + build.project_version
- if not os.path.isdir(os.path.join(src_root, '.git')):
- print('Dist currently only works with Git repos.')
+ if os.path.isdir(os.path.join(src_root, '.git')):
+ names = create_dist_git(dist_name, src_root, bld_root, dist_sub)
+ elif os.path.isdir(os.path.join(src_root, '.hg')):
+ names = create_dist_hg(dist_name, src_root, bld_root, dist_sub)
+ else:
+ print('Dist currently only works with Git or Mercurial repos.')
return 1
- names = create_dist(dist_name, src_root, bld_root, dist_sub)
if names is None:
return 1
error_count = 0
diff --git a/mesonbuild/scripts/yelphelper.py b/mesonbuild/scripts/yelphelper.py
index 47dfb71..978a870 100644
--- a/mesonbuild/scripts/yelphelper.py
+++ b/mesonbuild/scripts/yelphelper.py
@@ -74,13 +74,24 @@ def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, pr
if not os.path.exists(infile):
if lang == 'C':
mlog.warning('Media file "%s" did not exist in C directory' % m)
+ continue
elif symlinks:
srcfile = os.path.join(c_install_dir, m)
mlog.log('Symlinking %s to %s.' % (outfile, srcfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)
- os.symlink(srcfile, outfile)
- continue
+ try:
+ try:
+ os.symlink(srcfile, outfile)
+ except FileExistsError:
+ os.remove(outfile)
+ os.symlink(srcfile, outfile)
+ continue
+ except (NotImplementedError, OSError):
+ mlog.warning('Symlinking not supported, falling back to copying')
+ else:
+ # Lang doesn't have media file so copy it over 'C' one
+ infile = os.path.join(srcdir, 'C', m)
mlog.log('Installing %s to %s' % (infile, outfile))
if '/' in m or '\\' in m:
os.makedirs(os.path.dirname(outfile), exist_ok=True)
diff --git a/run_project_tests.py b/run_project_tests.py
index 66d7eb0..76216a4 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -214,7 +214,8 @@ def validate_install(srcdir, installdir, compiler):
expected[platform_fix_name(line.strip())] = False
# Check if expected files were found
for fname in expected:
- if os.path.exists(os.path.join(installdir, fname)):
+ file_path = os.path.join(installdir, fname)
+ if os.path.exists(file_path) or os.path.islink(file_path):
expected[fname] = True
for (fname, found) in expected.items():
if not found:
@@ -249,6 +250,23 @@ def log_text_file(logfile, testdir, stdo, stde):
executor.shutdown()
raise StopException()
+
+def bold(text):
+ return mlog.bold(text).get_text(mlog.colorize_console)
+
+
+def green(text):
+ return mlog.green(text).get_text(mlog.colorize_console)
+
+
+def red(text):
+ return mlog.red(text).get_text(mlog.colorize_console)
+
+
+def yellow(text):
+ return mlog.yellow(text).get_text(mlog.colorize_console)
+
+
def run_test_inprocess(testdir):
old_stdout = sys.stdout
sys.stdout = mystdout = StringIO()
@@ -474,10 +492,12 @@ def run_tests(all_tests, log_name_base, extra_args):
for name, test_cases, skipped in all_tests:
current_suite = ET.SubElement(junit_root, 'testsuite', {'name': name, 'tests': str(len(test_cases))})
+ print()
if skipped:
- print('\nNot running %s tests.\n' % name)
+ print(bold('Not running %s tests.' % name))
else:
- print('\nRunning %s tests.\n' % name)
+ print(bold('Running %s tests.' % name))
+ print()
futures = []
for t in test_cases:
# Jenkins screws us over by automatically sorting test cases by name
@@ -493,7 +513,7 @@ def run_tests(all_tests, log_name_base, extra_args):
sys.stdout.flush()
result = result.result()
if result is None or 'MESON_SKIP_TEST' in result.stdo:
- print('Skipping:', t)
+ print(yellow('Skipping:'), t)
current_test = ET.SubElement(current_suite, 'testcase', {'name': testname,
'classname': name})
ET.SubElement(current_test, 'skipped', {})
@@ -501,7 +521,7 @@ def run_tests(all_tests, log_name_base, extra_args):
else:
without_install = "" if len(install_commands) > 0 else " (without install)"
if result.msg != '':
- print('Failed test{} during {}: {!r}'.format(without_install, result.step.name, t))
+ print(red('Failed test{} during {}: {!r}'.format(without_install, result.step.name, t)))
print('Reason:', result.msg)
failing_tests += 1
if result.step == BuildStep.configure and result.mlog != no_meson_log_msg:
@@ -647,9 +667,9 @@ if __name__ == '__main__':
pass
for f in pbfiles:
os.unlink(f)
- print('\nTotal passed tests:', passing_tests)
- print('Total failed tests:', failing_tests)
- print('Total skipped tests:', skipped_tests)
+ print('\nTotal passed tests:', green(str(passing_tests)))
+ print('Total failed tests:', red(str(failing_tests)))
+ print('Total skipped tests:', yellow(str(skipped_tests)))
if failing_tests > 0:
print('\nMesonlogs of failing tests\n')
for l in failing_logs:
diff --git a/run_tests.py b/run_tests.py
index 1549979..040f958 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -23,6 +23,7 @@ import tempfile
import platform
from mesonbuild import mesonlib
from mesonbuild import mesonmain
+from mesonbuild import mlog
from mesonbuild.environment import detect_ninja
from io import StringIO
from enum import Enum
@@ -177,7 +178,8 @@ if __name__ == '__main__':
if 'APPVEYOR' in os.environ and os.environ['arch'] == 'x86':
os.environ.pop('platform')
# Run tests
- print('Running unittests.\n')
+ print(mlog.bold('Running unittests.').get_text(mlog.colorize_console))
+ print()
units = ['InternalTests', 'AllPlatformTests', 'FailureTests']
if mesonlib.is_linux():
units += ['LinuxlikeTests']
@@ -200,7 +202,8 @@ if __name__ == '__main__':
returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'] + units, env=env)
# Ubuntu packages do not have a binary without -6 suffix.
if should_run_linux_cross_tests():
- print('Running cross compilation tests.\n')
+ print(mlog.bold('Running cross compilation tests.').get_text(mlog.colorize_console))
+ print()
returncode += subprocess.call([sys.executable, 'run_cross_test.py', 'cross/ubuntu-armhf.txt'], env=env)
returncode += subprocess.call([sys.executable, 'run_project_tests.py'] + sys.argv[1:], env=env)
sys.exit(returncode)
diff --git a/run_unittests.py b/run_unittests.py
index a405b01..63462d8 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -30,7 +30,7 @@ import mesonbuild.mlog
import mesonbuild.compilers
import mesonbuild.environment
import mesonbuild.mesonlib
-from mesonbuild.mesonlib import is_windows, is_osx, is_cygwin
+from mesonbuild.mesonlib import is_windows, is_osx, is_cygwin, windows_proof_rmtree
from mesonbuild.environment import Environment
from mesonbuild.dependencies import DependencyException
from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
@@ -445,7 +445,7 @@ class BasePlatformTests(unittest.TestCase):
print(f.read())
def tearDown(self):
- shutil.rmtree(self.builddir)
+ windows_proof_rmtree(self.builddir)
os.environ = self.orig_env
super().tearDown()
@@ -534,7 +534,7 @@ class BasePlatformTests(unittest.TestCase):
self._run(self.mconf_command + [arg, self.builddir])
def wipe(self):
- shutil.rmtree(self.builddir)
+ windows_proof_rmtree(self.builddir)
def utime(self, f):
ensure_backend_detects_changes(self.backend)
@@ -1161,18 +1161,50 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
- def test_dist(self):
+ def test_dist_git(self):
if not shutil.which('git'):
raise unittest.SkipTest('Git not found')
+
+ def git_init(project_dir):
+ subprocess.check_call(['git', 'init'], cwd=project_dir)
+ subprocess.check_call(['git', 'config',
+ 'user.name', 'Author Person'], cwd=project_dir)
+ subprocess.check_call(['git', 'config',
+ 'user.email', 'teh_coderz@example.com'], cwd=project_dir)
+ subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
+ subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir)
+
try:
- self.dist_impl()
+ self.dist_impl(git_init)
except PermissionError:
# When run under Windows CI, something (virus scanner?)
# holds on to the git files so cleaning up the dir
# fails sometimes.
pass
- def dist_impl(self):
+ def test_dist_hg(self):
+ if not shutil.which('hg'):
+ raise unittest.SkipTest('Mercurial not found')
+ if self.backend is not Backend.ninja:
+ raise unittest.SkipTest('Dist is only supported with Ninja')
+
+ def hg_init(project_dir):
+ subprocess.check_call(['hg', 'init'], cwd=project_dir)
+ with open(os.path.join(project_dir, '.hg', 'hgrc'), 'w') as f:
+ print('[ui]', file=f)
+ print('username=Author Person <teh_coderz@example.com>', file=f)
+ subprocess.check_call(['hg', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
+ subprocess.check_call(['hg', 'commit', '-m', 'I am a project'], cwd=project_dir)
+
+ try:
+ self.dist_impl(hg_init)
+ except PermissionError:
+ # When run under Windows CI, something (virus scanner?)
+ # holds on to the hg files so cleaning up the dir
+ # fails sometimes.
+ pass
+
+ def dist_impl(self, vcs_init):
# Create this on the fly because having rogue .git directories inside
# the source tree leads to all kinds of trouble.
with tempfile.TemporaryDirectory() as project_dir:
@@ -1189,13 +1221,7 @@ int main(int argc, char **argv) {
return 0;
}
''')
- subprocess.check_call(['git', 'init'], cwd=project_dir)
- subprocess.check_call(['git', 'config',
- 'user.name', 'Author Person'], cwd=project_dir)
- subprocess.check_call(['git', 'config',
- 'user.email', 'teh_coderz@example.com'], cwd=project_dir)
- subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
- subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir)
+ vcs_init(project_dir)
self.init(project_dir)
self.build('dist')
distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz')
@@ -1221,6 +1247,15 @@ int main(int argc, char **argv) {
for path in rpath.split(':'):
self.assertTrue(path.startswith('$ORIGIN'), msg=(each, path))
+ def test_dash_d_dedup(self):
+ testdir = os.path.join(self.unit_test_dir, '10 d dedup')
+ self.init(testdir)
+ cmd = self.get_compdb()[0]['command']
+ self.assertTrue('-D FOO -D BAR' in cmd or
+ '"-D" "FOO" "-D" "BAR"' in cmd or
+ '/D FOO /D BAR' in cmd or
+ '"/D" "FOO" "/D" "BAR"' in cmd)
+
class FailureTests(BasePlatformTests):
'''
@@ -1239,7 +1274,7 @@ class FailureTests(BasePlatformTests):
def tearDown(self):
super().tearDown()
- shutil.rmtree(self.srcdir)
+ windows_proof_rmtree(self.srcdir)
def assertMesonRaises(self, contents, match, extra_args=None, langs=None):
'''
@@ -1761,16 +1796,22 @@ class LinuxlikeTests(BasePlatformTests):
self.init(testdir)
# NOTE: .pc file has -Lfoo -lfoo -Lbar -lbar but pkg-config reorders
# the flags before returning them to -Lfoo -Lbar -lfoo -lbar
- expected_order = ['-L/me/first', '-L/me/second','-lfoo1', '-lfoo2',
- '-L/me/third', '-L/me/fourth', '-lfoo3', '-lfoo4']
+ # but pkgconf seems to not do that. Sigh. Support both.
+ expected_order = [('-L/me/first', '-lfoo1'),
+ ('-L/me/second', '-lfoo2'),
+ ('-L/me/first', '-L/me/second'),
+ ('-lfoo1', '-lfoo2'),
+ ('-L/me/second', '-L/me/third'),
+ ('-L/me/third', '-L/me/fourth',),
+ ('-L/me/third', '-lfoo3'),
+ ('-L/me/fourth', '-lfoo4'),
+ ('-lfoo3', '-lfoo4'),
+ ]
with open(os.path.join(self.builddir, 'build.ninja')) as ifile:
for line in ifile:
- if expected_order[0] in line:
- previous_index = line.index(expected_order[0])
- for entry in expected_order[1:]:
- current_index = line.index(entry)
- self.assertLess(previous_index, current_index)
- previous_index = current_index
+ if expected_order[0][0] in line:
+ for first, second in expected_order:
+ self.assertLess(line.index(first), line.index(second))
return
raise RuntimeError('Linker entries not found in the Ninja file.')
@@ -1807,7 +1848,7 @@ class RewriterTests(unittest.TestCase):
self.test_dir = os.path.join(src_root, 'test cases/rewrite')
def tearDown(self):
- shutil.rmtree(self.tmpdir)
+ windows_proof_rmtree(self.tmpdir)
def read_contents(self, fname):
with open(os.path.join(self.workdir, fname)) as f:
diff --git a/test cases/common/127 cpp and asm/retval-arm.S b/test cases/common/127 cpp and asm/retval-arm.S
index 8b37197..a892362 100644
--- a/test cases/common/127 cpp and asm/retval-arm.S
+++ b/test cases/common/127 cpp and asm/retval-arm.S
@@ -2,7 +2,10 @@
.text
.globl SYMBOL_NAME(get_retval)
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- mov r0, #0
- mov pc, lr
+ mov r0, #0
+ mov pc, lr
diff --git a/test cases/common/127 cpp and asm/retval-x86.S b/test cases/common/127 cpp and asm/retval-x86.S
index 06bd75c..f9e8190 100644
--- a/test cases/common/127 cpp and asm/retval-x86.S
+++ b/test cases/common/127 cpp and asm/retval-x86.S
@@ -2,7 +2,10 @@
.text
.globl SYMBOL_NAME(get_retval)
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- xorl %eax, %eax
- retl
+ xorl %eax, %eax
+ retl
diff --git a/test cases/common/127 cpp and asm/retval-x86_64.S b/test cases/common/127 cpp and asm/retval-x86_64.S
index 638921e..1a5f3eb 100644
--- a/test cases/common/127 cpp and asm/retval-x86_64.S
+++ b/test cases/common/127 cpp and asm/retval-x86_64.S
@@ -2,7 +2,10 @@
.text
.globl SYMBOL_NAME(get_retval)
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- xorl %eax, %eax
- retq
+ xorl %eax, %eax
+ retq
diff --git a/test cases/common/141 c cpp and asm/retval-arm.S b/test cases/common/141 c cpp and asm/retval-arm.S
index 8b37197..a892362 100644
--- a/test cases/common/141 c cpp and asm/retval-arm.S
+++ b/test cases/common/141 c cpp and asm/retval-arm.S
@@ -2,7 +2,10 @@
.text
.globl SYMBOL_NAME(get_retval)
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- mov r0, #0
- mov pc, lr
+ mov r0, #0
+ mov pc, lr
diff --git a/test cases/common/141 c cpp and asm/retval-x86.S b/test cases/common/141 c cpp and asm/retval-x86.S
index 06bd75c..3cb0237 100644
--- a/test cases/common/141 c cpp and asm/retval-x86.S
+++ b/test cases/common/141 c cpp and asm/retval-x86.S
@@ -2,7 +2,11 @@
.text
.globl SYMBOL_NAME(get_retval)
+/* Only supported on Linux with GAS */
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- xorl %eax, %eax
- retl
+ xorl %eax, %eax
+ retl
diff --git a/test cases/common/141 c cpp and asm/retval-x86_64.S b/test cases/common/141 c cpp and asm/retval-x86_64.S
index 638921e..1a5f3eb 100644
--- a/test cases/common/141 c cpp and asm/retval-x86_64.S
+++ b/test cases/common/141 c cpp and asm/retval-x86_64.S
@@ -2,7 +2,10 @@
.text
.globl SYMBOL_NAME(get_retval)
+# ifdef __linux__
+.type get_retval, %function
+#endif
SYMBOL_NAME(get_retval):
- xorl %eax, %eax
- retq
+ xorl %eax, %eax
+ retq
diff --git a/test cases/failing/55 wrong shared crate type/foo.rs b/test cases/failing/55 wrong shared crate type/foo.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/failing/55 wrong shared crate type/foo.rs
diff --git a/test cases/failing/55 wrong shared crate type/meson.build b/test cases/failing/55 wrong shared crate type/meson.build
new file mode 100644
index 0000000..69ac3da
--- /dev/null
+++ b/test cases/failing/55 wrong shared crate type/meson.build
@@ -0,0 +1,3 @@
+project('test', 'rust')
+
+shared_library('test', 'foo.rs', rust_crate_type : 'staticlib')
diff --git a/test cases/failing/56 wrong static crate type/foo.rs b/test cases/failing/56 wrong static crate type/foo.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/failing/56 wrong static crate type/foo.rs
diff --git a/test cases/failing/56 wrong static crate type/meson.build b/test cases/failing/56 wrong static crate type/meson.build
new file mode 100644
index 0000000..c094613
--- /dev/null
+++ b/test cases/failing/56 wrong static crate type/meson.build
@@ -0,0 +1,3 @@
+project('test', 'rust')
+
+static_library('test', 'foo.rs', rust_crate_type : 'cdylib')
diff --git a/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml
index d23b22f..028b808 100644
--- a/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml
+++ b/test cases/frameworks/10 gtk-doc/doc/foobar-docs.sgml
@@ -34,6 +34,7 @@
</para>
</partintro>
<xi:include href="xml/foo.xml"/>
+ <xi:include href="xml/foo-version.xml"/>
</reference>
</book>
diff --git a/test cases/frameworks/10 gtk-doc/include/foo-version.h.in b/test cases/frameworks/10 gtk-doc/include/foo-version.h.in
new file mode 100644
index 0000000..30751cd
--- /dev/null
+++ b/test cases/frameworks/10 gtk-doc/include/foo-version.h.in
@@ -0,0 +1,29 @@
+#pragma once
+
+/**
+ * SECTION:version
+ * @section_id: foo-version
+ * @short_description: <filename>foo-version.h</filename>
+ * @title: Foo Versioning
+ */
+
+/**
+ * FOO_MAJOR_VERSION:
+ *
+ * The major version of foo.
+ */
+#define FOO_MAJOR_VERSION (@FOO_MAJOR_VERSION@)
+
+/**
+ * FOO_MINOR_VERSION:
+ *
+ * The minor version of foo.
+ */
+#define FOO_MINOR_VERSION (@FOO_MINOR_VERSION@)
+
+/**
+ * FOO_MICRO_VERSION:
+ *
+ * The micro version of foo.
+ */
+#define FOO_MICRO_VERSION (@FOO_MICRO_VERSION@)
diff --git a/test cases/frameworks/10 gtk-doc/include/meson.build b/test cases/frameworks/10 gtk-doc/include/meson.build
new file mode 100644
index 0000000..4c85b80
--- /dev/null
+++ b/test cases/frameworks/10 gtk-doc/include/meson.build
@@ -0,0 +1,10 @@
+cdata = configuration_data()
+parts = meson.project_version().split('.')
+cdata.set('FOO_MAJOR_VERSION', parts[0])
+cdata.set('FOO_MINOR_VERSION', parts[1])
+cdata.set('FOO_MICRO_VERSION', parts[2])
+configure_file(input : 'foo-version.h.in',
+ output : 'foo-version.h',
+ configuration : cdata,
+ install : true,
+ install_dir : get_option('includedir'))
diff --git a/test cases/frameworks/10 gtk-doc/meson.build b/test cases/frameworks/10 gtk-doc/meson.build
index 95eeefa..4cfcca1 100644
--- a/test cases/frameworks/10 gtk-doc/meson.build
+++ b/test cases/frameworks/10 gtk-doc/meson.build
@@ -1,4 +1,4 @@
-project('gtkdoctest', 'c')
+project('gtkdoctest', 'c', version : '1.0.0')
gnome = import('gnome')
@@ -6,6 +6,8 @@ assert(gnome.gtkdoc_html_dir('foobar') == 'share/gtkdoc/html/foobar', 'Gtkdoc in
inc = include_directories('include')
+subdir('include')
+
# We have to disable this test until this bug fix has landed to
# distros https://bugzilla.gnome.org/show_bug.cgi?id=753145
error('MESON_SKIP_TEST can not enable gtk-doc test until upstream fixes have landed.')
diff --git a/test cases/frameworks/13 yelp/help/meson.build b/test cases/frameworks/13 yelp/help/meson.build
index 7c6f01d..85bc980 100644
--- a/test cases/frameworks/13 yelp/help/meson.build
+++ b/test cases/frameworks/13 yelp/help/meson.build
@@ -3,5 +3,13 @@ gnome = import('gnome')
gnome.yelp('meson',
sources: 'index.page',
media: 'media/test.txt',
+ symlink_media: false,
+ languages: ['de', 'es'],
+)
+
+gnome.yelp('meson-symlink',
+ sources: 'index.page',
+ media: 'media/test.txt',
+ symlink_media: true,
languages: ['de', 'es'],
)
diff --git a/test cases/frameworks/13 yelp/installed_files.txt b/test cases/frameworks/13 yelp/installed_files.txt
index 59d2158..9fc097d 100644
--- a/test cases/frameworks/13 yelp/installed_files.txt
+++ b/test cases/frameworks/13 yelp/installed_files.txt
@@ -3,3 +3,10 @@ usr/share/help/C/meson/media/test.txt
usr/share/help/es/meson/index.page
usr/share/help/es/meson/media/test.txt
usr/share/help/de/meson/index.page
+usr/share/help/de/meson/media/test.txt
+usr/share/help/C/meson-symlink/index.page
+usr/share/help/C/meson-symlink/media/test.txt
+usr/share/help/es/meson-symlink/media/test.txt
+usr/share/help/es/meson-symlink/index.page
+usr/share/help/de/meson-symlink/index.page
+usr/share/help/de/meson-symlink/media/test.txt
diff --git a/test cases/frameworks/9 wxwidgets/meson.build b/test cases/frameworks/9 wxwidgets/meson.build
index c1fa367..da3aa26 100644
--- a/test cases/frameworks/9 wxwidgets/meson.build
+++ b/test cases/frameworks/9 wxwidgets/meson.build
@@ -1,5 +1,6 @@
project('wxwidgets test', 'cpp')
+wxd = dependency('wxwidgets', version : '>=5', required : false)
wxd = dependency('wxwidgets', version : '>=3.0.0', required : false)
if wxd.found()
diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build
index ad513f2..d4140b7 100644
--- a/test cases/linuxlike/5 dependency versions/meson.build
+++ b/test cases/linuxlike/5 dependency versions/meson.build
@@ -92,7 +92,7 @@ endif
objc_found = add_languages('objc', required : false)
-foreach d : ['sdl2', 'gnustep', 'wx', 'gl', 'python3', 'boost', 'gtest', 'gmock']
+foreach d : ['sdl2', 'gnustep', 'wxwidgets', 'gl', 'python3', 'boost', 'gtest', 'gmock', 'valgrind']
if d == 'gnustep' and not objc_found
message('Skipping gnustep because no ObjC compiler found')
else
diff --git a/test cases/rust/2 sharedlib/installed_files.txt b/test cases/rust/2 sharedlib/installed_files.txt
index 85acff2..680343d 100644
--- a/test cases/rust/2 sharedlib/installed_files.txt
+++ b/test cases/rust/2 sharedlib/installed_files.txt
@@ -1,2 +1,2 @@
usr/bin/prog?exe
-usr/lib/libstuff.rlib
+usr/lib/libstuff.so
diff --git a/test cases/rust/4 polyglot/installed_files.txt b/test cases/rust/4 polyglot/installed_files.txt
new file mode 100644
index 0000000..680343d
--- /dev/null
+++ b/test cases/rust/4 polyglot/installed_files.txt
@@ -0,0 +1,2 @@
+usr/bin/prog?exe
+usr/lib/libstuff.so
diff --git a/test cases/rust/4 polyglot/meson.build b/test cases/rust/4 polyglot/meson.build
new file mode 100644
index 0000000..a20d766
--- /dev/null
+++ b/test cases/rust/4 polyglot/meson.build
@@ -0,0 +1,5 @@
+project('rust and c polyglot executable', 'c', 'rust')
+
+l = library('stuff', 'stuff.rs', install : true)
+e = executable('prog', 'prog.c', link_with : l, install : true)
+test('polyglottest', e)
diff --git a/test cases/rust/4 polyglot/prog.c b/test cases/rust/4 polyglot/prog.c
new file mode 100644
index 0000000..18f2c36
--- /dev/null
+++ b/test cases/rust/4 polyglot/prog.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void f();
+
+int main() {
+ printf("Hello from C!\n");
+ f();
+}
diff --git a/test cases/rust/4 polyglot/stuff.rs b/test cases/rust/4 polyglot/stuff.rs
new file mode 100644
index 0000000..ecf623c
--- /dev/null
+++ b/test cases/rust/4 polyglot/stuff.rs
@@ -0,0 +1,6 @@
+#![crate_name = "stuff"]
+
+#[no_mangle]
+pub extern fn f() {
+ println!("Hello from Rust!");
+}
diff --git a/test cases/rust/5 polyglot static/installed_files.txt b/test cases/rust/5 polyglot static/installed_files.txt
new file mode 100644
index 0000000..2f7a397
--- /dev/null
+++ b/test cases/rust/5 polyglot static/installed_files.txt
@@ -0,0 +1,2 @@
+usr/bin/prog?exe
+usr/lib/libstuff.a
diff --git a/test cases/rust/5 polyglot static/meson.build b/test cases/rust/5 polyglot static/meson.build
new file mode 100644
index 0000000..76dc790
--- /dev/null
+++ b/test cases/rust/5 polyglot static/meson.build
@@ -0,0 +1,10 @@
+project('static rust and c polyglot executable', 'c', 'rust')
+
+deps = [
+ meson.get_compiler('c').find_library('dl'),
+ dependency('threads'),
+]
+
+l = static_library('stuff', 'stuff.rs', rust_crate_type : 'staticlib', install : true)
+e = executable('prog', 'prog.c', dependencies: deps, link_with : l, install : true)
+test('polyglottest', e)
diff --git a/test cases/rust/5 polyglot static/prog.c b/test cases/rust/5 polyglot static/prog.c
new file mode 100644
index 0000000..18f2c36
--- /dev/null
+++ b/test cases/rust/5 polyglot static/prog.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+void f();
+
+int main() {
+ printf("Hello from C!\n");
+ f();
+}
diff --git a/test cases/rust/5 polyglot static/stuff.rs b/test cases/rust/5 polyglot static/stuff.rs
new file mode 100644
index 0000000..ecf623c
--- /dev/null
+++ b/test cases/rust/5 polyglot static/stuff.rs
@@ -0,0 +1,6 @@
+#![crate_name = "stuff"]
+
+#[no_mangle]
+pub extern fn f() {
+ println!("Hello from Rust!");
+}
diff --git a/test cases/unit/10 d dedup/meson.build b/test cases/unit/10 d dedup/meson.build
new file mode 100644
index 0000000..08f3a6c
--- /dev/null
+++ b/test cases/unit/10 d dedup/meson.build
@@ -0,0 +1,6 @@
+project('d dedup', 'c')
+
+add_project_arguments('-D', 'FOO', '-D', 'BAR', language : 'c')
+
+executable('prog', 'prog.c')
+
diff --git a/test cases/unit/10 d dedup/prog.c b/test cases/unit/10 d dedup/prog.c
new file mode 100644
index 0000000..505f122
--- /dev/null
+++ b/test cases/unit/10 d dedup/prog.c
@@ -0,0 +1,14 @@
+#include<stdio.h>
+
+#ifndef FOO
+#error FOO is not defined.
+#endif
+
+#ifndef BAR
+#error BAR is not defined.
+#endif
+
+int main(int argc, char **argv) {
+ printf("All is well.\n");
+ return 0;
+}
diff --git a/test cases/vala/16 mixed dependence/meson.build b/test cases/vala/16 mixed dependence/meson.build
index e6967be..b44b47b 100644
--- a/test cases/vala/16 mixed dependence/meson.build
+++ b/test cases/vala/16 mixed dependence/meson.build
@@ -1,6 +1,10 @@
project('mixed dependence', 'vala', 'c')
-deps = [dependency('glib-2.0'), dependency('gobject-2.0')]
+cc = meson.get_compiler('c')
+
+deps = [dependency('glib-2.0'), dependency('gobject-2.0'),
+ # Should be ignored, see https://github.com/mesonbuild/meson/issues/1939
+ cc.find_library('z')]
mixer = static_library('mixer', 'mixer.vala', 'mixer-glue.c',
dependencies : deps)
diff --git a/test cases/vala/7 shared library/lib/meson.build b/test cases/vala/7 shared library/lib/meson.build
index 78646a8..edeeb96 100644
--- a/test cases/vala/7 shared library/lib/meson.build
+++ b/test cases/vala/7 shared library/lib/meson.build
@@ -1,4 +1,12 @@
-l = shared_library('valalib', 'mylib.vala', dependencies : valadeps)
+args = []
+# https://github.com/mesonbuild/meson/issues/1969
+if get_option('unity') == 'on'
+ vala_args = ['-H', 'mylib.h']
+endif
+
+l = shared_library('valalib', 'mylib.vala',
+ vala_args : args,
+ dependencies : valadeps)
shared_library('installed_vala_lib', 'mylib.vala',
dependencies : valadeps,
diff --git a/test cases/windows/1 basic/prog.c b/test cases/windows/1 basic/prog.c
index 8703980..58162a4 100644
--- a/test cases/windows/1 basic/prog.c
+++ b/test cases/windows/1 basic/prog.c
@@ -1,4 +1,4 @@
-#include <Windows.h>
+#include <windows.h>
int main(int argc, char **argv) {
return 0;