| 1 |
--- |
| 2 |
title: Release 0.52.0 |
| 3 |
short-description: Release notes for 0.52.0 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
## Gettext targets are ignored if `gettext` is not installed |
| 9 |
|
| 10 |
Previously the `i18n` module has errored out when `gettext` tools are |
| 11 |
not installed on the system. Starting with this version they will |
| 12 |
become no-ops instead. This makes it easier to build projects on |
| 13 |
minimal environments (such as when bootstrapping) that do not have |
| 14 |
translation tools installed. |
| 15 |
|
| 16 |
## Support taking environment values from a dictionary |
| 17 |
|
| 18 |
`environment()` now accepts a dictionary as first argument. If |
| 19 |
provided, each key/value pair is added into the `environment_object` |
| 20 |
as if `set()` method was called for each of them. |
| 21 |
|
| 22 |
On the various functions that take an `env:` keyword argument, you may |
| 23 |
now give a dictionary. |
| 24 |
|
| 25 |
## alias_target |
| 26 |
|
| 27 |
``` meson |
| 28 |
runtarget alias_target(target_name, dep1, ...) |
| 29 |
``` |
| 30 |
|
| 31 |
This function creates a new top-level target. Like all top-level |
| 32 |
targets, this integrates with the selected backend. For instance, with |
| 33 |
Ninja you can run it as `ninja target_name`. This is a dummy target |
| 34 |
that does not execute any command, but ensures that all dependencies |
| 35 |
are built. Dependencies can be any build target (e.g. return value of |
| 36 |
executable(), custom_target(), etc) |
| 37 |
|
| 38 |
|
| 39 |
## Enhancements to the pkg_config_path argument |
| 40 |
|
| 41 |
Setting sys_root in the [properties] section of your cross file will |
| 42 |
now set PKG_CONFIG_SYSROOT_DIR automatically for host system |
| 43 |
dependencies when cross compiling. |
| 44 |
|
| 45 |
## The Meson test program now accepts an additional "--gdb-path" argument to specify the GDB binary |
| 46 |
|
| 47 |
`meson test --gdb testname` invokes GDB with the specific test case. However, sometimes GDB is not in the path or a GDB replacement is wanted. |
| 48 |
Therefore, a `--gdb-path` argument was added to specify which binary is executed (per default `gdb`): |
| 49 |
|
| 50 |
```console |
| 51 |
$ meson test --gdb --gdb-path /my/special/location/for/gdb testname |
| 52 |
$ meson test --gdb --gdb-path cgdb testname |
| 53 |
``` |
| 54 |
|
| 55 |
## Better support for illumos and Solaris |
| 56 |
|
| 57 |
illumos (and hopefully Solaris) support has been dramatically |
| 58 |
improved, and one can reasonably expect projects to compile. |
| 59 |
|
| 60 |
## Splitting of Compiler.get_function_attribute('visibility') |
| 61 |
|
| 62 |
On macOS there is no `protected` visibility, which results in the |
| 63 |
visibility check always failing. 0.52.0 introduces two changes to |
| 64 |
improve this situation: |
| 65 |
|
| 66 |
1. the "visibility" check no longer includes "protected" |
| 67 |
2. a new set of "split" checks are introduced which check for a single |
| 68 |
attribute instead of all attributes. |
| 69 |
|
| 70 |
These new attributes are: |
| 71 |
* visibility:default |
| 72 |
* visibility:hidden |
| 73 |
* visibility:internal |
| 74 |
* visibility:protected |
| 75 |
|
| 76 |
## Clang-tidy target |
| 77 |
|
| 78 |
If `clang-tidy` is installed and the project's source root contains a |
| 79 |
`.clang-tidy` (or `_clang-tidy`) file, Meson will automatically define |
| 80 |
a `clang-tidy` target that runs Clang-Tidy on all source files. |
| 81 |
|
| 82 |
If you have defined your own `clang-tidy` target, Meson will not |
| 83 |
generate its own target. |
| 84 |
|
| 85 |
## Add blocks dependency |
| 86 |
|
| 87 |
Add `dependency('blocks')` to use the Clang blocks extension. |
| 88 |
|
| 89 |
## Meson's builtin b_lundef is now supported on macOS |
| 90 |
|
| 91 |
This has always been possible, but there are some additional |
| 92 |
restrictions on macOS (mainly do to Apple only features). With the |
| 93 |
linker internal re-architecture this has become possible |
| 94 |
|
| 95 |
## Compiler and dynamic linker representation split |
| 96 |
|
| 97 |
0.52.0 includes a massive refactor of the representations of compilers to |
| 98 |
tease apart the representations of compilers and dynamic linkers (ld). This |
| 99 |
fixes a number of compiler/linker combinations. In particular this fixes |
| 100 |
use GCC and vanilla clang on macOS. |
| 101 |
|
| 102 |
## Add `depth` option to `wrap-git` |
| 103 |
|
| 104 |
To allow shallow cloning, an option `depth` has been added to `wrap-git`. |
| 105 |
This applies recursively to submodules when `clone-recursive` is set to `true`. |
| 106 |
|
| 107 |
Note that the git server may have to be configured to support shallow cloning |
| 108 |
not only for branches but also for tags. |
| 109 |
|
| 110 |
## Enhancements to the source_set module |
| 111 |
|
| 112 |
`SourceSet` objects now provide the `all_dependencies()` method, that |
| 113 |
complement the existing `all_sources()` method. |
| 114 |
|
| 115 |
## added `--only test(s)` option to run_project_tests.py |
| 116 |
|
| 117 |
Individual tests or a list of tests from run_project_tests.py can be selected like: |
| 118 |
``` |
| 119 |
python run_project_tests.py --only fortran |
| 120 |
|
| 121 |
python run_project_tests.py --only fortran python3 |
| 122 |
``` |
| 123 |
|
| 124 |
This assists Meson development by only running the tests for the |
| 125 |
portion of Meson being worked on during local development. |
| 126 |
|
| 127 |
## Experimental Webassembly support via Emscripten |
| 128 |
|
| 129 |
Meson now supports compiling code to Webassembly using the Emscripten |
| 130 |
compiler. As with most things regarding Webassembly, this support is |
| 131 |
subject to change. |
| 132 |
|
| 133 |
## Version check in `find_program()` |
| 134 |
|
| 135 |
A new `version` keyword argument has been added to `find_program` to |
| 136 |
specify the required version. See [`dependency()`](#dependency) for |
| 137 |
argument format. The version of the program is determined by running |
| 138 |
`program_name --version` command. If stdout is empty it fallbacks to |
| 139 |
stderr. If the output contains more text than simply a version number, |
| 140 |
only the first occurrence of numbers separated by dots is kept. If the |
| 141 |
output is more complicated than that, the version checking will have |
| 142 |
to be done manually using [`run_command()`](#run_command). |
| 143 |
|
| 144 |
## Added `vs_module_defs` to `shared_module()` |
| 145 |
|
| 146 |
Like `shared_library()`, `shared_module()` now accepts |
| 147 |
`vs_module_defs` argument for controlling symbol exports, etc. |
| 148 |
|
| 149 |
## Improved support for static libraries |
| 150 |
|
| 151 |
Static libraries had numerous shortcomings in the past, especially |
| 152 |
when using uninstalled static libraries. This release brings many |
| 153 |
internal changes in the way they are handled, including: |
| 154 |
|
| 155 |
- `link_whole:` of static libraries. In the example below, lib2 used to miss |
| 156 |
symbols from lib1 and was unusable. |
| 157 |
```meson |
| 158 |
lib1 = static_library(sources) |
| 159 |
lib2 = static_library(other_sources, link_whole : lib1, install : true) |
| 160 |
``` |
| 161 |
- `link_with:` of a static library with an uninstalled static library. In the |
| 162 |
example below, lib2 now implicitly promote `link_with:` to `link_whole:` because |
| 163 |
the installed lib2 would otherwise be unusable. |
| 164 |
```meson |
| 165 |
lib1 = static_library(sources, install : false) |
| 166 |
lib2 = static_library(sources, link_with : lib1, install : true) |
| 167 |
``` |
| 168 |
- pkg-config generator do not include uninstalled static libraries. In the example |
| 169 |
below, the generated `.pc` file used to be unusable because it contained |
| 170 |
`Libs.private: -llib1` and `lib1.a` is not installed. `lib1` is now omitted |
| 171 |
from the `.pc` file because the `link_with:` has been promoted to |
| 172 |
`link_whole:` (see above) and thus lib1 is not needed to use lib2. |
| 173 |
```meson |
| 174 |
lib1 = static_library(sources, install : false) |
| 175 |
lib2 = both_libraries(sources, link_with : lib1, install : true) |
| 176 |
pkg.generate(lib2) |
| 177 |
``` |
| 178 |
|
| 179 |
Many projects have been using `extract_all_objects()` to work around |
| 180 |
those issues, and hopefully those hacks could now be removed. Since |
| 181 |
this is a pretty large change, please double check if your static |
| 182 |
libraries behave correctly, and report any regression. |
| 183 |
|
| 184 |
## Enhancements to the kconfig module |
| 185 |
|
| 186 |
`kconfig.load()` may now accept a `configure_file()` as input file. |
| 187 |
|
| 188 |
## Added `include_type` kwarg to `dependency` |
| 189 |
|
| 190 |
The `dependency()` function now has a `include_type` kwarg. It can take the |
| 191 |
values `'preserve'`, `'system'` and `'non-system'`. If it is set to `'system'`, |
| 192 |
all include directories of the dependency are marked as system dependencies. |
| 193 |
|
| 194 |
The default value of `include_type` is `'preserve'`. |
| 195 |
|
| 196 |
Additionally, it is also possible to check and change the |
| 197 |
`include_type` state of an existing dependency object with the new |
| 198 |
`include_type()` and `as_system()` methods. |
| 199 |
|
| 200 |
## Enhancements to `configure_file()` |
| 201 |
|
| 202 |
`input:` now accepts multiple input file names for `command:`-configured file. |
| 203 |
|
| 204 |
`depfile:` keyword argument is now accepted. The dependency file can |
| 205 |
list all the additional files the configure target depends on. |
| 206 |
|
| 207 |
## Projects args can be set separately for build and host machines (potentially breaking change) |
| 208 |
|
| 209 |
Simplify `native` flag behavior in `add_global_arguments`, |
| 210 |
`add_global_link_arguments`, `add_project_arguments` and |
| 211 |
`add_project_link_arguments`. The rules are now very simple: |
| 212 |
|
| 213 |
- `native: true` affects `native: true` targets |
| 214 |
|
| 215 |
- `native: false` affects `native: false` targets |
| 216 |
|
| 217 |
- No native flag is the same as `native: false` |
| 218 |
|
| 219 |
This further simplifies behavior to match the "build vs host" decision |
| 220 |
done in last release with `c_args` vs `build_c_args`. The underlying |
| 221 |
motivation in both cases is to execute the same commands whether the |
| 222 |
overall build is native or cross. |
| 223 |
|
| 224 |
## Allow checking if a variable is a disabler |
| 225 |
|
| 226 |
Added the function `is_disabler(var)`. Returns true if a variable is a disabler |
| 227 |
and false otherwise. |
| 228 |
|
| 229 |
|
| 230 |
## gtkdoc-check support |
| 231 |
|
| 232 |
`gnome.gtkdoc()` now has a `check` keyword argument. If `true` runs it |
| 233 |
will run `gtkdoc-check` when running unit tests. Note that this has |
| 234 |
the downside of rebuilding the doc for each build, which is often very |
| 235 |
slow. It usually should be enabled only in CI. |
| 236 |
|
| 237 |
## `gnome.gtkdoc()` returns target object |
| 238 |
|
| 239 |
`gnome.gtkdoc()` now returns a target object that can be passed as |
| 240 |
dependency to other targets using generated doc files (e.g. in |
| 241 |
`content_files` of another doc). |
| 242 |
|
| 243 |
## Dist is now a top level command |
| 244 |
|
| 245 |
Previously creating a source archive could only be done with `ninja |
| 246 |
dist`. Starting with this release Meson provides a top level `dist` |
| 247 |
that can be invoked directly. It also has a command line option to |
| 248 |
determine which kinds of archives to create: |
| 249 |
|
| 250 |
```meson |
| 251 |
meson dist --formats=xztar,zip |
| 252 |
``` |