| 1 |
--- |
| 2 |
title: Release 0.62.0 |
| 3 |
short-description: Release notes for 0.62.0 |
| 4 |
... |
| 5 |
|
| 6 |
# New features |
| 7 |
|
| 8 |
## Bash completion scripts sourced in `meson devenv` |
| 9 |
|
| 10 |
If bash-completion scripts are being installed and the shell is bash, they will |
| 11 |
be automatically sourced. |
| 12 |
|
| 13 |
## Setup GDB auto-load for `meson devenv` |
| 14 |
|
| 15 |
When GDB helper scripts (*-gdb.py, *-gdb.gdb, and *-gdb.csm) are installed with |
| 16 |
a library name that matches one being built, Meson adds the needed auto-load |
| 17 |
commands into `<builddir>/.gdbinit` file. When running gdb from top build |
| 18 |
directory, that file is loaded by gdb automatically. |
| 19 |
|
| 20 |
## Print modified environment variables with `meson devenv --dump` |
| 21 |
|
| 22 |
With `--dump` option, all environment variables that have been modified are |
| 23 |
printed instead of starting an interactive shell. It can be used by shell |
| 24 |
scripts that wish to setup their environment themselves. |
| 25 |
|
| 26 |
## New `method` and `separator` kwargs on `environment()` and `meson.add_devenv()` |
| 27 |
|
| 28 |
It simplifies this common pattern: |
| 29 |
```meson |
| 30 |
env = environment() |
| 31 |
env.prepend('FOO', ['a', 'b'], separator: ',') |
| 32 |
meson.add_devenv(env) |
| 33 |
``` |
| 34 |
|
| 35 |
becomes one line: |
| 36 |
```meson |
| 37 |
meson.add_devenv({'FOO': ['a', 'b']}, method: 'prepend', separator: ',') |
| 38 |
``` |
| 39 |
|
| 40 |
or two lines: |
| 41 |
```meson |
| 42 |
env = environment({'FOO': ['a', 'b']}, method: 'prepend', separator: ',') |
| 43 |
meson.add_devenv(env) |
| 44 |
``` |
| 45 |
|
| 46 |
## New custom dependency for libdl |
| 47 |
|
| 48 |
``` |
| 49 |
dependency('dl') |
| 50 |
``` |
| 51 |
|
| 52 |
will now check for the functionality of libdl.so, but first check if it is |
| 53 |
provided in the libc (for example in libc on OpenBSD or in musl libc on linux). |
| 54 |
|
| 55 |
## pkgconfig.generate will now include variables for builtin directories when referenced |
| 56 |
|
| 57 |
When using the `variables:` family of kwargs to `pkgconfig.generate` to refer |
| 58 |
to installed paths, traditionally only `prefix`, `includedir`, and `libdir` |
| 59 |
were available by default, and generating a correct (relocatable) pkg-config |
| 60 |
file required manually constructing variables for e.g. `datadir`. |
| 61 |
|
| 62 |
Meson now checks each variable to see if it begins with a reference to a |
| 63 |
standard directory, and if so, adds it to the list of directories for which a |
| 64 |
builtin variable is created. |
| 65 |
|
| 66 |
For example, before it was necessary to do this: |
| 67 |
```meson |
| 68 |
pkgconfig.generate( |
| 69 |
name: 'bash-completion', |
| 70 |
description: 'programmable completion for the bash shell', |
| 71 |
dataonly: true, |
| 72 |
variables: { |
| 73 |
'prefix': get_option('prefix'), |
| 74 |
'datadir': join_paths('${prefix}', get_option('datadir')), |
| 75 |
'sysconfdir': join_paths('${prefix}', get_option('sysconfdir')), |
| 76 |
|
| 77 |
'compatdir': '${sysconfdir}/bash_completion.d', |
| 78 |
'completionsdir': '${datadir}/bash-completion/completions', |
| 79 |
'helpersdir': '${datadir}/bash-completion/helpers', |
| 80 |
}, |
| 81 |
install_dir: join_paths(get_option('datadir'), 'pkgconfig'), |
| 82 |
) |
| 83 |
``` |
| 84 |
|
| 85 |
Now the first three variables are not needed. |
| 86 |
|
| 87 |
## New keyword argument `verbose` for tests and benchmarks |
| 88 |
|
| 89 |
The new keyword argument `verbose` can be used to mark tests and benchmarks |
| 90 |
that must always be logged verbosely on the console. This is particularly |
| 91 |
useful for long-running tests, or when a single Meson test() is wrapping |
| 92 |
an external test harness. |
| 93 |
|
| 94 |
## CMake support for versions <3.17.0 is deprecated |
| 95 |
|
| 96 |
Support for CMake versions below 3.17.0 is now deprecated for *both* CMake |
| 97 |
dependencies and subprojects. |
| 98 |
|
| 99 |
## Removal of the RPM module |
| 100 |
|
| 101 |
Due to lack of interest, lack of maintainership, and lack of a clear purpose, |
| 102 |
the RPM module has been removed. |
| 103 |
|
| 104 |
Users interested in one-shot tools to generate an RPM spec file template for |
| 105 |
distro packaging, are encouraged develop an external tool that reads the |
| 106 |
introspection data. |
| 107 |
|
| 108 |
For more details, see https://github.com/mesonbuild/meson/issues/9764 |
| 109 |
|
| 110 |
## CMake server API support is removed |
| 111 |
|
| 112 |
Support for the |
| 113 |
[deprecated (since CMake 3.15)](https://cmake.org/cmake/help/latest/release/3.15.html#deprecated-and-removed-features) |
| 114 |
and now |
| 115 |
[removed (since CMake 3.20)](https://cmake.org/cmake/help/latest/release/3.20.html#deprecated-and-removed-features) |
| 116 |
CMake server API is dropped from Meson. |
| 117 |
|
| 118 |
The new CMake minimum version for CMake subprojects is now CMake 3.14. |
| 119 |
|
| 120 |
## Rust proc-macro crates |
| 121 |
|
| 122 |
Rust has these handy things called proc-macro crates, which are a bit like a |
| 123 |
compiler plugin. We can now support them, simply build a [[shared_library]] with |
| 124 |
the `rust_crate_type` set to `proc-macro`. |
| 125 |
|
| 126 |
```meson |
| 127 |
proc = shared_library( |
| 128 |
'proc', |
| 129 |
'proc.rs', |
| 130 |
rust_crate_type : 'proc-macro', |
| 131 |
install : false, |
| 132 |
) |
| 133 |
|
| 134 |
user = executable('user, 'user.rs', link_with : proc) |
| 135 |
``` |
| 136 |
|
| 137 |
## found programs now have a version method |
| 138 |
|
| 139 |
The return value of [[find_program]] can now check the exact version of the |
| 140 |
found program, independent of the minimum version requirement. This can be used |
| 141 |
e.g. to perform different actions depending on the exact version detected. |
| 142 |
|
| 143 |
## Minimum required Python version updated to 3.7 |
| 144 |
|
| 145 |
Meson now requires at least Python version 3.7 to run as Python 3.6 reached EOL |
| 146 |
on December 2021. In practice this should only affect people developing on |
| 147 |
Ubuntu Bionic, who will need to manually install python3.8 from the official |
| 148 |
repositories. |
| 149 |
|
| 150 |
|
| 151 |
## Added support for XML translations using itstool |
| 152 |
|
| 153 |
XML files can now be translated easier by using `itstool` via |
| 154 |
`i18n.itstool_join()`. This ensures the XML is translated correctly |
| 155 |
based on the defined ITS rules for the specific XML layout. |
| 156 |
|
| 157 |
## JNI System Dependency Modules |
| 158 |
|
| 159 |
The JNI system dependency now supports a `modules` keyword argument which is a |
| 160 |
list containing any of the following: `jvm`, `awt`. |
| 161 |
|
| 162 |
```meson |
| 163 |
jni_dep = dependency('jni', version: '>= 1.8.0', modules: ['jvm', 'awt']) |
| 164 |
``` |
| 165 |
|
| 166 |
This will add appropriate linker arguments to your target. |
| 167 |
|
| 168 |
## New unstable wayland module |
| 169 |
|
| 170 |
This module can search for protocol xml files from the wayland-protocols |
| 171 |
package, and generate .c and .h files using wayland-scanner. |
| 172 |
|
| 173 |
## Experimental command to convert environments to cross files |
| 174 |
|
| 175 |
Meson has a new command `env2mfile` that can be used to convert |
| 176 |
"environment variable based" cross and native compilation environments |
| 177 |
to Meson machine files. This is especially convenient for e.g. distro |
| 178 |
packagers so they can easily generate unambiguous configuration files |
| 179 |
for package building. |
| 180 |
|
| 181 |
As an example here's how you would generate a cross file that takes |
| 182 |
its settings from the `CC`, `CXX`, `CFLAGS` etc environment variables. |
| 183 |
|
| 184 |
meson env2mfile --cross --system=baremetal --cpu=armv7 --cpu-family=arm -o armcross.txt |
| 185 |
|
| 186 |
The command also has support for generating Debian build files using |
| 187 |
system introspection: |
| 188 |
|
| 189 |
meson env2mfile --cross --debarch armhf -o debarmhf_cross.txt |
| 190 |
|
| 191 |
Note how you don't need to specify any system details, the command |
| 192 |
gets them transparently via `dpkg-architecture`. |
| 193 |
|
| 194 |
Creating a native file is done in the same way: |
| 195 |
|
| 196 |
meson env2mfile --native -o current_system.txt |
| 197 |
|
| 198 |
This system will detect if the `_FOR_BUILD` environment variables are |
| 199 |
enabled and then uses them as needed. |
| 200 |
|
| 201 |
With this you should be able to convert any envvar-based cross build |
| 202 |
setup to cross and native files and then use those. This means, among |
| 203 |
other things, that you can then run your compilations from any shell, |
| 204 |
not just the special one that has all the environment variables set. |
| 205 |
|
| 206 |
As this functionality is still a bit in flux, the specific behaviour |
| 207 |
and command line arguments to use are subject to change. Because of |
| 208 |
this the main documentation has not yet been updated. |
| 209 |
|
| 210 |
Please try this for your use cases and report to us if it is working. |
| 211 |
Patches to make the autodetection work on other distros and platforms |
| 212 |
are also welcome. |
| 213 |
|
| 214 |
## Added optional '--allow-dirty' flag for the 'dist' command |
| 215 |
|
| 216 |
An optional `--allow-dirty` flag has been added to the `dist` command. |
| 217 |
|
| 218 |
Previously, if uncommitted changes were present, Meson would warn about |
| 219 |
this but continue with the dist process. It now errors out instead. The |
| 220 |
error can be suppressed by using the `--allow-dirty` option. |
| 221 |
|
| 222 |
## ldconfig is no longer run on install |
| 223 |
|
| 224 |
Due to various issues of fragility and concern that it doesn't predictably do |
| 225 |
the right thing, meson no longer runs ldconfig during `meson install`, and |
| 226 |
users who need it run should run it themselves, instead. |
| 227 |
|
| 228 |
## Added support for Texas Instruments MSP430 and ARM compilers |
| 229 |
|
| 230 |
Meson now supports the TI [MSP430](https://www.ti.com/tool/MSP-CGT) and |
| 231 |
[ARM](https://www.ti.com/tool/ARM-CGT) toolchains. The compiler and linker are |
| 232 |
identified as `ti` and `ti-ar`, respectively. To maintain backwards |
| 233 |
compatibility with existing build definitions, the [C2000 |
| 234 |
toolchain](https://www.ti.com/tool/C2000-CGT) is still identified as `c2000` and |
| 235 |
`ar2000`. |
| 236 |
|
| 237 |
## cmake.configure_package_config_file can now take a dict |
| 238 |
|
| 239 |
The `configuration` kwarg of the `configure_package_config_file()` function |
| 240 |
from the `cmake` module can now take a dict object, just like the regular |
| 241 |
`configure_file()` function. |
| 242 |
|
| 243 |
## Deprecated `java.generate_native_header()` in favor of the new `java.generate_native_headers()` |
| 244 |
|
| 245 |
`java.generate_native_header()` was only useful for the most basic of |
| 246 |
situations. It didn't take into account that in order to generate native |
| 247 |
headers, you had to have all the referenced Java files. It also didn't take |
| 248 |
into account inner classes. Do not use this function from `0.62.0` onward. |
| 249 |
|
| 250 |
`java.generate_native_headers()` has been added as a replacement which should account for the previous function's shortcomings. |
| 251 |
|
| 252 |
```java |
| 253 |
// Outer.java |
| 254 |
|
| 255 |
package com.mesonbuild; |
| 256 |
|
| 257 |
public class Outer { |
| 258 |
private static native void outer(); |
| 259 |
|
| 260 |
public static class Inner { |
| 261 |
private static native void inner(); |
| 262 |
} |
| 263 |
} |
| 264 |
``` |
| 265 |
|
| 266 |
With the above file, an invocation would look like the following: |
| 267 |
|
| 268 |
```meson |
| 269 |
java = import('java') |
| 270 |
|
| 271 |
native_headers = java.generate_native_headers( |
| 272 |
'Outer.java', |
| 273 |
package: 'com.mesonbuild', |
| 274 |
classes: ['Outer', 'Outer.Inner'] |
| 275 |
) |
| 276 |
``` |
| 277 |
|
| 278 |
## New option to choose python installation environment |
| 279 |
|
| 280 |
It is now possible to specify `-Dpython.install_env` and choose how python modules are installed. |
| 281 |
|
| 282 |
- `venv`: assume that a virtualenv is active and install to that |
| 283 |
- `system`: install to the global site-packages of the selected interpreter |
| 284 |
(the one that the venv module calls --system-site-packages) |
| 285 |
- `prefix`: preserve existing behavior |
| 286 |
- `auto`: autodetect whether to use venv or system |
| 287 |
|
| 288 |
## JDK System Dependency Renamed from `jdk` to `jni` |
| 289 |
|
| 290 |
The JDK system dependency is useful for creating native Java modules using the |
| 291 |
JNI. Since the purpose is to find the JNI, it has been decided that a better |
| 292 |
name is in fact "jni". Use of `dependency('jdk')` should be replaced with |
| 293 |
`dependency('jni')`. |
| 294 |
|
| 295 |
## i18n.merge_file no longer arbitrarily leaves your project half-built |
| 296 |
|
| 297 |
The i18n module partially accounts for builds with NLS disabled, by disabling |
| 298 |
gettext compiled translation catalogs if it cannot build them. Due to |
| 299 |
implementation details, this also disabled important data files created via |
| 300 |
merge_file, leading to important desktop files etc. not being installed. |
| 301 |
|
| 302 |
This overreaction has been fixed. It is no longer possible to have NLS-disabled |
| 303 |
builds which break the project by not installing important files which have |
| 304 |
nothing to do with NLS (other than including some). |
| 305 |
|
| 306 |
If you were depending on not having the Gettext tools installed and |
| 307 |
successfully mis-building your project, you may need to make your project |
| 308 |
actually work with NLS disabled, for example by providing some version of your |
| 309 |
files which is still installed even when merge_file cannot be run. |
| 310 |
|
| 311 |
## All directory options now support paths outside of prefix |
| 312 |
|
| 313 |
Previously, Meson only allowed most directory options to be relative to prefix. |
| 314 |
This restriction has been now lifted, bringing us in line with Autotools and |
| 315 |
CMake. It is also useful for platforms like Nix, which install projects into |
| 316 |
multiple independent prefixes. |
| 317 |
|
| 318 |
As a consequence, `get_option` might return absolute paths for any |
| 319 |
directory option, if a directory outside of prefix is passed. This |
| 320 |
is technically a backwards incompatible change but its effect |
| 321 |
should be minimal, thanks to widespread use of `join_paths`/ |
| 322 |
`/` operator and pkg-config generator module. |
| 323 |
|
| 324 |
## `meson install --strip` |
| 325 |
|
| 326 |
It is now possible to strip targets using `meson install --strip` even if |
| 327 |
`-Dstrip=true` option was not set during configuration. This allows doing |
| 328 |
stripped and not stripped installations without reconfiguring the build. |
| 329 |
|
| 330 |
## Support for ARM Ltd. Clang toolchain |
| 331 |
|
| 332 |
Support for the `armltdclang` compiler has been added. This differs from the |
| 333 |
existing `armclang` toolchain in that it is a fork of Clang by ARM Ltd. and |
| 334 |
supports native compilation. The Keil `armclang` toolchain only supports |
| 335 |
cross-compilation to embedded devices. |
| 336 |
|
| 337 |
## structured_sources() |
| 338 |
|
| 339 |
A new function, `structured_sources()` has been added. This function allows |
| 340 |
languages like Rust which depend on the filesystem layout at compile time to mix |
| 341 |
generated and static sources. |
| 342 |
|
| 343 |
```meson |
| 344 |
executable( |
| 345 |
'main', |
| 346 |
structured_sources( |
| 347 |
'main.rs, |
| 348 |
{'mod' : generated_mod_rs}, |
| 349 |
) |
| 350 |
) |
| 351 |
``` |
| 352 |
|
| 353 |
Meson will then at build time copy the files into the build directory (if |
| 354 |
necessary), so that the desired file structure is laid out, and compile that. In |
| 355 |
this case: |
| 356 |
|
| 357 |
``` |
| 358 |
root/ |
| 359 |
main.rs |
| 360 |
mod/ |
| 361 |
mod.rs |
| 362 |
``` |
| 363 |
|
| 364 |
## New custom dependency for OpenSSL |
| 365 |
|
| 366 |
Detecting an OpenSSL installation in a cross-platform manner can be |
| 367 |
complicated. Officially, pkg-config is supported by upstream. Unofficially, |
| 368 |
cmake includes a FindOpenSSL using a different name and which requires |
| 369 |
specifying modules. |
| 370 |
|
| 371 |
Meson will now allow the pkg-config name to work in all cases using the following lookup order: |
| 372 |
- prefer pkg-config if at all possible |
| 373 |
- attempt to probe the system for the standard library naming, and retrieve the version from the headers |
| 374 |
- if all else fails, check if cmake can find it |
| 375 |
|
| 376 |
## D features in `declare_dependency` |
| 377 |
|
| 378 |
`declare_dependency`accepts parameters for D specific features. |
| 379 |
Accepted new parameters are `d_module_versions` and `d_import_dirs`. |
| 380 |
|
| 381 |
This can be useful to propagate conditional compilation versions. E.g.: |
| 382 |
|
| 383 |
```meson |
| 384 |
my_lua_dep = declare_dependency( |
| 385 |
# ... |
| 386 |
d_module_versions: ['LUA_53'], |
| 387 |
d_import_dirs: include_directories('my_lua_folder'), |
| 388 |
) |
| 389 |
``` |
| 390 |
|
| 391 |
## arch_independent kwarg in cmake.write_basic_package_version_file |
| 392 |
|
| 393 |
The `write_basic_package_version_file()` function from the `cmake` module |
| 394 |
now supports an `arch_independent` kwarg, so that architecture checks in |
| 395 |
the generated Package Version file are skipped, reproducing the behaviour of |
| 396 |
CMake's [ARCH_INDEPENDENT](https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#command:write_basic_package_version_file) |
| 397 |
option. |
| 398 |
|
| 399 |
## `dataonly` Pkgconfig Default Install Path |
| 400 |
|
| 401 |
The default install path for `dataonly` pkgconfig files has changed from |
| 402 |
`${libdir}/pkgconfig` to `${datadir}/pkgconfig`. |
| 403 |
|
| 404 |
## JAR default install dir |
| 405 |
|
| 406 |
The previous default for `jar()` was `libdir`. With this release, it has been |
| 407 |
changed to `datadir/java`. Please open an issue if this is not a sane default |
| 408 |
for your system. |
| 409 |
|