Debian Codegraph @

subprojects/meson-docs/docs/markdown/Release-notes-for-0.55.0.md

raw
1 ---
2 title: Release 0.55.0
3 short-description: Release notes for 0.55.0
4 ...
5
6 # New features
7
8 ## rpath removal now more careful
9
10 On Linux-like systems, Meson adds rpath entries to allow running apps
11 in the build tree, and then removes those build-time-only rpath
12 entries when installing. Rpath entries may also come in via LDFLAGS
13 and via .pc files. Meson used to remove those latter rpath entries by
14 accident, but is now more careful.
15
16 ## Added ability to specify targets in `meson compile`
17
18 It's now possible to specify targets in `meson compile`, which will
19 result in building only the requested targets.
20
21 Usage: `meson compile [TARGET [TARGET...]]`
22 `TARGET` has the following syntax: `[PATH/]NAME[:TYPE]`.
23 `NAME`: name of the target from `meson.build` (e.g. `foo` from `executable('foo', ...)`).
24 `PATH`: path to the target relative to the root `meson.build` file. Note: relative path for a target specified in the root `meson.build` is `./`.
25 `TYPE`: type of the target (e.g. `shared_library`, `executable` and etc)
26
27 `PATH` and/or `TYPE` can be omitted if the resulting `TARGET` can be used to uniquely identify the target in `meson.build`.
28
29 For example targets from the following code:
30 ```meson
31 shared_library('foo', ...)
32 static_library('foo', ...)
33 executable('bar', ...)
34 ```
35 can be invoked with `meson compile foo:shared_library foo:static_library bar`.
36
37 ## Test protocol for gtest
38
39 Due to the popularity of Gtest (google test) among C and C++
40 developers Meson now supports a special protocol for gtest. With this
41 protocol Meson injects arguments to gtests to output JUnit, reads that
42 JUnit, and adds the output to the JUnit it generates.
43
44 ## meson.add_*_script methods accept new types
45
46 All three (`add_install_script`, `add_dist_script`, and
47 `add_postconf_script`) now accept ExternalPrograms (as returned by
48 `find_program`), Files, and the output of `configure_file`. The dist and
49 postconf methods cannot accept other types because of when they are run.
50 While dist could, in theory, take other dependencies, it would require more
51 extensive changes, particularly to the backend.
52
53 ```meson
54 meson.add_install_script(find_program('foo'), files('bar'))
55 meson.add_dist_script(find_program('foo'), files('bar'))
56 meson.add_postconf_script(find_program('foo'), files('bar'))
57 ```
58
59 The install script variant is also able to accept custom_targets,
60 custom_target indexes, and build targets (executables, libraries), and
61 can use built executables a the script to run
62
63 ```meson
64 installer = executable('installer', ...)
65 meson.add_install_script(installer, ...)
66 meson.add_install_script('foo.py', installer)
67 ```
68
69 ## Machine file constants
70
71 Native and cross files now support string and list concatenation using
72 the `+` operator, and joining paths using the `/` operator. Entries
73 defined in the `[constants]` section can be used in any other section.
74 An entry defined in any other section can be used only within that
75 same section and only after it has been defined.
76
77 ```ini
78 [constants]
79 toolchain = '/toolchain'
80 common_flags = ['--sysroot=' + toolchain + '/sysroot']
81
82 [properties]
83 c_args = common_flags + ['-DSOMETHING']
84 cpp_args = c_args + ['-DSOMETHING_ELSE']
85
86 [binaries]
87 c = toolchain + '/gcc'
88 ```
89
90 ## Configure CMake subprojects with Meson.subproject_options
91
92 Meson now supports passing configuration options to CMake and
93 overriding certain build details extracted from the CMake subproject.
94
95 The new CMake configuration options object is very similar to the
96 [[@cfg_data]] object returned
97 by [[configuration_data]]. It
98 is generated by the `subproject_options` function
99
100 All configuration options have to be set *before* the subproject is
101 configured and must be passed to the `subproject` method via the
102 `options` key. Altering the configuration object won't have any effect
103 on previous `cmake.subproject` calls.
104
105 **Note:** The `cmake_options` kwarg for the `subproject` function is
106 now deprecated since it is replaced by the new `options` system.
107
108 ## find_program: Fixes when the program has been overridden by executable
109
110 When a program has been overridden by an executable, the returned
111 object of find_program() had some issues:
112
113 ```meson
114 # In a subproject:
115 exe = executable('foo', ...)
116 meson.override_find_program('foo', exe)
117
118 # In main project:
119 # The version check was crashing Meson.
120 prog = find_program('foo', version : '>=1.0')
121
122 # This was crashing Meson.
123 message(prog.path())
124
125 # New method to be consistent with built objects.
126 message(prog.full_path())
127 ```
128
129 ## Response files enabled on Linux, reined in on Windows
130
131 Meson used to always use response files on Windows,
132 but never on Linux.
133
134 It now strikes a happier balance, using them on both platforms,
135 but only when needed to avoid command line length limits.
136
137 ## `unstable-kconfig` module renamed to `unstable-keyval`
138
139 The `unstable-kconfig` module is now renamed to `unstable-keyval`. We
140 expect this module to become stable once it has some usage experience,
141 specifically in the next or the following release
142
143
144 ## Fatal warnings in `gnome.generate_gir()`
145
146 `gnome.generate_gir()` now has `fatal_warnings` keyword argument to
147 abort when a warning is produced. This is useful for example in CI
148 environment where it's important to catch potential issues.
149
150 ## b_ndebug support for D language compilers
151
152 D Language compilers will now set -release/--release/-frelease (depending on
153 the compiler) when the b_ndebug flag is set.
154
155 ## Meson test now produces JUnit xml from results
156
157 Meson will now generate a JUnit compatible XML file from test results.
158 it will be in the `meson-logs` directory and is called
159 `testlog.junit.xml`.
160
161 ## Config tool based dependencies no longer search PATH for cross compiling
162
163 Before 0.55.0 config tool based dependencies (llvm-config,
164 cups-config, etc), would search system $PATH if they weren't defined
165 in the cross file. This has been a source of bugs and has been
166 deprecated. It is now removed, config tool binaries must be specified
167 in the cross file now or the dependency will not be found.
168
169 ## Rename has_exe_wrapper -> can_run_host_binaries
170
171 The old name was confusing as it didn't really match the behavior of
172 the function. The old name remains as an alias (the behavior hasn't
173 changed), but is now deprecated.
174
175 ## String concatenation in meson_options.txt
176
177 It is now possible to use string concatenation (with the `+`
178 operator) in the `meson_options.txt` file. This allows splitting long
179 option descriptions.
180
181 ```meson
182 option(
183 'testoption',
184 type : 'string',
185 value : 'optval',
186 description : 'An option with a very long description' +
187 'that does something in a specific context'
188 )
189 ```
190
191 ## Wrap fallback URL
192
193 Wrap files can now define `source_fallback_url` and
194 `patch_fallback_url` to be used in case the main server is temporarily
195 down.
196
197 ## Clang coverage support
198
199 llvm-cov is now used to generate coverage information when clang is
200 used as the compiler.
201
202 ## Local wrap source and patch files
203
204 It is now possible to use the `patch_filename` and `source_filename`
205 value in a `.wrap` file without `*_url` to specify a local source /
206 patch file. All local files must be located in the
207 `subprojects/packagefiles` directory. The `*_hash` entries are
208 optional with this setup.
209
210 ## Local wrap patch directory
211
212 Wrap files can now specify `patch_directory` instead of
213 `patch_filename` in the case overlay files are local. Every files in
214 that directory, and subdirectories, will be copied to the subproject
215 directory. This can be used for example to add `meson.build` files to
216 a project not using Meson build system upstream. The patch directory
217 must be placed in `subprojects/packagefiles` directory.
218
219 ## Patch on all wrap types
220
221 `patch_*` keys are not limited to `wrap-file` any more, they can be
222 specified for all wrap types.
223
224 ## link_language argument added to all targets
225
226 Previously the `link_language` argument was only supposed to be
227 allowed in executables, because the linker used needs to be the linker
228 for the language that implements the main function. Unfortunately it
229 didn't work in that case, and, even worse, if it had been implemented
230 properly it would have worked for *all* targets. In 0.55.0 this
231 restriction has been removed, and the bug fixed. It now is valid for
232 `executable` and all derivative of `library`.
233
234 ## meson dist --no-tests
235
236 `meson dist` has a new option `--no-tests` to skip build and tests of
237 generated packages. It can be used to not waste time for example when
238 done in CI that already does its own testing.
239
240 ## Force fallback for
241
242 A newly-added `--force-fallback-for` command line option can now be
243 used to force fallback for specific subprojects.
244
245 Example:
246
247 ```
248 meson setup builddir/ --force-fallback-for=foo,bar
249 ```
250
251 ## Implicit dependency fallback
252
253 `dependency('foo')` now automatically fallback if the dependency is
254 not found on the system but a subproject wrap file or directory exists
255 with the same name.
256
257 That means that simply adding `subprojects/foo.wrap` is enough to add
258 fallback to any `dependency('foo')` call. It is however requires that
259 the subproject call `meson.override_dependency('foo', foo_dep)` to
260 specify which dependency object should be used for `foo`.
261
262 ## Wrap file `provide` section
263
264 Wrap files can define the dependencies it provides in the `[provide]`
265 section. When `foo.wrap` provides the dependency `foo-1.0` any call do
266 `dependency('foo-1.0')` will automatically fallback to that subproject
267 even if no `fallback` keyword argument is given. See [Wrap
268 documentation](Wrap-dependency-system-manual.md#provide_section).
269
270 ## `find_program()` fallback
271
272 When a program cannot be found on the system but a wrap file has its
273 name in the `[provide]` section, that subproject will be used as
274 fallback.
275
276 ## Test scripts are given the exe wrapper if needed
277
278 Meson will now set the `MESON_EXE_WRAPPER` as the properly wrapped and
279 joined representation. For Unix-like OSes this means python's
280 shelx.join, on Windows an implementation that attempts to properly
281 quote windows argument is used. This allow wrapper scripts to run test
282 binaries, instead of just skipping.
283
284 for example, if the wrapper is `['emulator', '--script']`, it will be passed
285 as `MESON_EXE_WRAPPER="emulator --script"`.
286
287 ## Added ability to specify backend arguments in `meson compile`
288
289 It's now possible to specify backend specific arguments in `meson compile`.
290
291 Usage: `meson compile [--vs-args=args] [--ninja-args=args]`
292
293 ```
294 --ninja-args NINJA_ARGS Arguments to pass to `ninja` (applied only on `ninja` backend).
295 --vs-args VS_ARGS Arguments to pass to `msbuild` (applied only on `vs` backend).
296 ```
297
298 These arguments use the following syntax:
299
300 If you only pass a single string, then it is considered to have all
301 values separated by commas. Thus invoking the following command:
302
303 ```
304 $ meson compile --ninja-args=-n,-d,explain
305 ```
306
307 would add `-n`, `-d` and `explain` arguments to ninja invocation.
308
309 If you need to have commas or spaces in your string values, then you
310 need to pass the value with proper shell quoting like this:
311
312 ```
313 $ meson compile "--ninja-args=['a,b', 'c d']"
314 ```
315
316 ## Introspection API changes
317
318 dumping the AST (--ast): **new in 0.55.0**
319 - prints the AST of a meson.build as JSON
320
321 ## `--backend=vs` now matches `-Db_vscrt=from_buildtype` behaviour in the Ninja backend
322
323 When `--buildtype=debugoptimized` is used with the Ninja backend, the
324 VS CRT option used is `/MD`, which is the [behaviour documented for
325 all
326 backends](https://mesonbuild.com/Builtin-options.html#b_vscrt-from_buildtype).
327 However, the Visual Studio backend was pass `/MT` in that case, which
328 is inconsistent.
329
330 If you need to use the MultiThreaded CRT, you should explicitly pass
331 `-Db_vscrt=mt`