Commit Graph

467 Commits

Author SHA1 Message Date
Dylan Baker 456844a4f3 vala: Disable unity builds
Our approach to unity builds with vala is broken, you cannot unify the
generated C files, as they contain duplicate symbols. We would need to
instead combine the files while they are still in their vala form, then
convert that to C and compile the unified C file.

This does not fix the linked issue, as this removed the ability to do
vala unity builds, but it does allow running vala with `--unity=on`.

Related: #5280
2021-02-05 16:31:33 -08:00
Xavier Claessens b5100fe86a gnome: Add post_install() method
Various GNOME projects have scripts that does similar task, better do it
directly in meson. This ensures it's done correctly regarding usage of
subprojects and pkg-config. See for example this gtk bug:
https://gitlab.gnome.org/GNOME/gtk/-/issues/3626.

Fixes: #8268
2021-02-05 15:08:47 -05:00
Luke Drummond 46e3480f7c Introduce `fs.read` to read a file as a string
Following #7890, this patch introduces the ability to read the contents
of a file to the fs module.

This patch introduces the ability to read files at configure time, but
has some restrictions:
    - binary files are not supported (I don't think this will prove a
    problem, and if people are wanting to do something with binary
    files, they should probably be shelling out to their own script).
    - Only files outside the build directory allowed. This limitation
      should prevent build loops.
Given that reading an arbitrary file at configure time can affect the
configuration in almost arbitrary ways, meson should force a reconfigure
when the given file changes. This is non-configurable, but this can
easily be changed with a future keyword argument.
2021-02-04 17:34:11 +00:00
Xavier Claessens 95c0790711 minstall: Add --dry-run option
Closes: #1281
2021-02-04 16:24:38 +00:00
Luca Weiss 673aff3595 Fix some typos in the release notes snippets 2021-02-03 11:15:14 -08:00
Dylan Baker 6f532b72c8 Add support for LLVM's thinLTO
This uses a separate option, b_lto_mode. It works in conjunction with
b_lto_threads.

Fixes #7493
2021-02-02 12:42:48 -08:00
Dylan Baker bffc94b08f compilers: Add support for using multiple threads with lto
Both Clang and GCC support using multiple threads for preforming link
time optimizaions, and they can now be configured using the
`-Db_lto_threads` option.

Fixes #7820
2021-02-02 12:42:48 -08:00
Jussi Pakkanen 474f4813c4 Capitalize "Meson" consistently as it is a proper name. [skip ci] 2021-01-31 19:49:20 +00:00
Paolo Bonzini 4bde7f31ae copy editing for 0.57 release notes [skip ci] 2021-01-31 15:11:30 +00:00
Xavier Claessens 6c6b5d77d6 add_install_script: add skip_if_destdir kwarg
It is common, at least in GNOME projects, to have scripts that must be
run only in the final destination, to update system icon cache, etc.
Skipping them from Meson ensures we can properly log that they have not
been run instead of relying on such scripts to to it (they don't
always).
2021-01-30 21:28:21 +00:00
Jussi Pakkanen c67e0a8a67
Merge pull request #8264 from xclaesse/ep-misc
external_project: misc improvements
2021-01-30 11:30:16 +00:00
Jussi Pakkanen f0fbb31ccf
Merge pull request #8200 from bonzini/mtest-asyncio-logs
mtest: improvements to logging
2021-01-30 09:52:43 +00:00
Xavier Claessens ef7dfa97fc external_project: Add release snippet 2021-01-29 19:02:48 -05:00
Jussi Pakkanen 3f0a0c1582 Can read project version from a file. 2021-01-29 16:42:59 +00:00
Dylan Baker f808c955ea intepreter: Allow using file objects for the script_name of add_*_script
It's a bit silly and conveluted to have to call find_program on the
output of configure_file, so let's just allow passing files as the
script name.
2021-01-27 21:59:55 +00:00
Xavier Claessens 633264984b custom_target: Add env kwarg 2021-01-27 09:00:54 -05:00
Xavier Claessens e4137ae3ec test: Make timeout <= 0 infinite duraction 2021-01-27 08:26:20 -05:00
Xavier Claessens baa9eeebe4 dist: Allow packaging subproject in same git repo as main project 2021-01-26 21:32:03 -05:00
Paolo Bonzini ec02753fbf docs: add documentation snippet for meson test console output changes 2021-01-22 12:18:59 +01:00
Paolo Bonzini adb1b2f3f6 interpreter: accept external programs and dependencies for summary 2021-01-21 08:54:35 -05:00
Marios Staikopoulos f8681b12e1 MSVC and Clang-Cl Compiler Argument Cleanup
This commit performs some cleanup for the msvc and clang-cl arguments.

* "Disable Debug" (`/Od`) is no longer manually specified for optimization levels {`0`,`g`} (it is already the default for MSVC).
* "Run Time Checking" (`/RTC1`) removed from `debug` buildtype by default
* Clang-CL `debug` buildtype arguments now match MSVC arguments
* There is now no difference between `buildtype` flags and `debug` + `optimization` flags
2021-01-20 14:11:16 -05:00
Jussi Pakkanen 8133a7b9a4 Keep buildtype the same even if user changes debug and/or optimization. 2021-01-19 20:25:55 +00:00
Marios Staikopoulos a3d8dc546c Removal of /ZI on MSVC Debug
The /ZI flag adds in "Edit and Continue" debug information, which will
cause massive slowdown. It is not a flag that we should be adding by
default to debug builds.

/Zi will still be added.
2021-01-17 21:03:35 +00:00
Paolo Bonzini ea2f34e286 mtest: allow quickly interrupting the test run
The new behavior of interrupting the longest running test with Ctrl-C is useful
when tests hang, but not when the run is completely broken for some reason.
Psychology tells us that the user will compulsively spam Ctrl-C in this case,
so exit if three Ctrl-C's are detected within a second.
2021-01-14 22:00:51 +00:00
Eli Schwartz adfcf77109
summary: align left, not align middle
aligning along the left is, I think, what most projects want to do.
Aligning along the middle looks subjectively ugly, and objectively
prevents me from further indenting an element, e.g.

  Build information:
    prefix                : /usr
    sysconfdir            : /etc
        conf file         : /etc/myprogram.conf
2021-01-12 19:19:00 -05:00
Luke Elliott 9efcdba0d5 Allow '//' as project function id due to git bash path conversion.
See https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path
2021-01-12 17:42:57 +00:00
Dylan Baker 3d80a88bd3 modules: Add an unstable-rust module
Like other language specific modules this module is module for holding
rust specific helpers. This commit adds a test() function, which
simplifies using rust's internal unittest mechanism.

Rust tests are generally placed in the same code files as they are
testing, in contrast to languages like C/C++ and python which generally
place the tests in separate translation units. For meson this is
somewhat problematic from a repetition point of view, as the only
changes are generally adding --test, and possibly some dependencies.

The rustmod.test() method provides a mechanism to remove the repatition:
it takes a rust target, copies it, and then addes the `--test` option,
then creates a Test() target with the `rust` protocol. You can pass
additional dependencies via the `dependencies` keyword. This all makes
for a nice, DRY, test definition.
2021-01-05 15:10:50 -08:00
Dylan Baker d89ec98b47 mtest: Add support for rust unit tests
Rust has it's own built in unit test format, which is invoked by
compiling a rust executable with the `--test` flag to rustc. The tests
are then run by simply invoking that binary. They output a custom test
format, which this patch adds parsing support for. This means that we
can report each subtest in the junit we generate correctly, which should
be helpful for orchestration systems like gitlab and jenkins which can
parse junit XML.
2021-01-05 10:23:41 -08:00
Paolo Bonzini 79e2c52a15 mtest: only build what is needed for the tests
It is a usual workflow to fix something and retest to see if it is fixed using a
particular test.  When tests start to become numerous, it becomes time consuming
for "meson test" to relink all of them (and in fact rebuild the whole project)
where the user has already specified the tests they want to run, as well as
the tests' dependencies.

Teach meson to be smart and only build what is needed for the test (or suite)
that were specified.

Fixes: #7473
Related: #7830
2020-12-14 10:53:36 +01:00
Jussi Pakkanen c21b04ba08 Add prelinking support for static libraries. 2020-12-03 22:58:07 +02:00
Paolo Bonzini 0deab2ee9e
compiler: allow non-built internal dependencies as arguments
Allow methods on the compiler object to receive internal dependencies,
as long as they only specify compiler/linker arguments or other
dependencies that satisfy the same requirements.

This is useful if you're using internal dependencies to add special
"-D" flags such as -DNCURSES_WIDECHAR, -D_XOPEN_SOURCE_EXTENDED or
-DGLIB_STATIC_COMPILATION.
2020-11-24 00:03:35 +02:00
Jason Ekstrand 15bbf1ea75 Handle cmake dependencies which require a specified version
Some CMake packages fail to find at all if no version is specified.
This commit adds a cmake_version parameter to dependency() to allow you
to specify the requested version.
2020-11-21 07:55:10 -08:00
Jussi Pakkanen c8af3c8d29 Revert "Add thinlto support. Closes #7493."
This reverts commit 3e6fbde94c.
2020-11-17 17:51:23 +02:00
Eli Schwartz 8992729ade doc: fix typo [skip ci] 2020-11-12 12:46:29 -08:00
Jones 8351e85bbd
interpreter: Add get_keys function for configuration_data (#7887) 2020-11-12 20:43:17 +02:00
Jussi Pakkanen 3e6fbde94c Add thinlto support. Closes #7493. 2020-11-08 16:00:05 +02:00
Dylan Baker 7860a6aeab rust: implement support for --edition
Using the std option, so now `rust_std=..` will work. I've chosen to use
"std" even though rust calls these "editions", as meson refers to
language versions as "standards", which makes meson feel more uniform,
and be less surprising.

Fixes: #5100
2020-11-05 21:24:20 +02:00
Jussi Pakkanen bca90722ec Bump minimum supported Python version to 3.6. Closes #6297. 2020-10-30 11:18:11 +02:00
Jussi Pakkanen f16d31607e Bump version number for release. This is the 10 000th commit! 2020-10-30 10:25:24 +02:00
Xavier Claessens bcf369ea3c Fix consistency in variables kwarg
Share common code to extract the `variables` kwarg in
declare_dependency() and pkg.generate().
2020-10-16 18:09:56 +03:00
Daniel Mensinger 7c377e5a5d intro: Add extra_files key to intro output (fixes #7310) 2020-10-15 01:56:59 +03:00
Xavier Claessens 173c115834 Add wrap mode to disable auto promote 2020-10-13 17:55:16 -04:00
Xavier Claessens 6333ee88c1 Merge wraps from subprojects into wraps from main project
wraps from subprojects are now merged into the list of wraps from main
project, so they can be used to download dependencies of dependencies
instead of having to promote wraps manually. If multiple projects
provides the same wrap file, the first one to be configured wins.

This also fix usage of sub-subproject that don't have wrap files. We can
now configure B when its source tree is at
`subprojects/A/subprojects/B/`. This has the implication that we cannot
assume that subproject "foo" is at `self.subproject_dir / 'foo'` any
more.
2020-10-13 17:55:16 -04:00
Daniel Mensinger e36f713a7f include_type: Add CMake subporject dependency method (fixes #6879) 2020-10-13 23:51:25 +03:00
Jussi Pakkanen 3372c58ca6
Merge pull request #7816 from mensinda/cmCross
cmake: Cross compilation support
2020-10-13 23:38:51 +03:00
Nirbheek Chauhan 55cf399ff8 mtest: Allow filtering tests by subproject
You could always specify a list of tests to run by passing the names as
arguments to `meson test`. If there were multiple tests with that name (in the
same project or different subprojects), all of them would be run. Now you can:

1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname`
1. Run all tests defined in a specific subproject: `meson test subprojectname:`

Also forbid ':' in test names. We already forbid this elsewhere, so
should not be a big deal.
2020-10-13 19:01:15 +03:00
Daniel Mensinger f5c9bf96b3
cmake: Add cross docs 2020-10-13 17:04:20 +02:00
Xavier Claessens dccff1f2bc msubprojects: Handle wrap-file to wrap-git case 2020-10-13 11:12:49 +00:00
Xavier Claessens 3ade5bbd92 msubprojects: Handle change of URL in wrap-git 2020-10-13 11:12:49 +00:00
Paolo Bonzini 726b822054 dependency: support boolean argument "allow_fallback"
Sometimes, distros want to configure a project so that it does not
use any bundled library.  In this case, meson.build might want
to do something like this, where slirp is a combo option
with values auto/system/internal:

  slirp = dependency('', required: false)
  if get_option('slirp') != 'internal'
    slirp = dependency('slirp',
                       required: get_option('slirp') == 'system')
  endif
  if not slirp.found()
    slirp = subproject('libslirp', ...) .variable('...')
  endif

and we cannot use "fallback" because the "system" value should never
look for a subproject.

This worked until 0.54.x, but in 0.55.x this breaks because of the
automatic subproject search.  Note that the desired effect here is
backwards compared to the policy of doing an automatic search on
"required: true"; we only want to do the search if "required" is false!

It would be possible to look for the dependency with  `required: false`
and issue the error manually, but it's ugly and it may produce an error
message that looks "different" from Meson's.

Instead, with this change it is possible to achieve this effect in an
even simpler way:

  slirp = dependency('slirp',
                     required: get_option('slirp') != 'auto',
                     allow_fallback: get_option('slirp') == 'system' ? false : ['slirp', 'libslirp_dep'])

The patch also adds support for "allow_fallback: true", which is
simple and enables automatic fallback to a wrap even for non-required
dependencies.
2020-10-08 12:24:07 +02:00