Debian Codegraph @

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

raw
1 ---
2 title: Release 0.56.0
3 short-description: Release notes for 0.56.0
4 ...
5
6 # New features
7
8 ## Python 3.5 support will be dropped in the next release
9
10 The final [Python 3.5 release was 3.5.10 in
11 September](https://www.python.org/dev/peps/pep-0478/#id4). This
12 release series is now End-of-Life (EOL). The only LTS distribution
13 that still only ships Python 3.5 is Ubuntu 16.04, which will be [EOL
14 in April 2021](https://ubuntu.com/about/release-cycle).
15
16 Python 3.6 has numerous features that we find useful such as improved
17 support for the `typing` module, f-string support, and better
18 integration with the `pathlib` module.
19
20 As a result, we will begin requiring Python 3.6 or newer in Meson
21 0.57, which is the next release. Starting with Meson 0.56, we now
22 print a `NOTICE:` when a `meson` command is run on Python 3.5 to
23 inform users about this. This notice has also been backported into the
24 0.55.2 stable release.
25
26 ## `meson test` can now filter tests by subproject
27
28 You could always specify a list of tests to run by passing the names
29 as arguments to `meson test`. If there were multiple tests with that
30 name (in the same project or different subprojects), all of them would
31 be run. Now you can:
32
33 1. Run all tests with the specified name from a specific subproject: `meson test subprojname:testname`
34 1. Run all tests defined in a specific subproject: `meson test subprojectname:`
35
36 As before, these can all be specified multiple times and mixed:
37
38 ```sh
39 # Run:
40 # * All tests called 'name1' or 'name2' and
41 # * All tests called 'name3' in subproject 'bar' and
42 # * All tests in subproject 'foo'
43 $ meson test name1 name2 bar:name3 foo:
44 ```
45
46 ## Native (build machine) compilers not always required by `project()`
47
48 When cross-compiling, native (build machine) compilers for the
49 languages specified in `project()` are not required, if no targets use
50 them.
51
52 ## New `extra_files` key in target introspection
53
54 The target introspection (`meson introspect --targets`,
55 `intro-targets.json`) now has the new `extra_files` key which lists
56 all files specified via the `extra_files` kwarg of a build target (see
57 `executable()`, etc.)
58
59
60 ## Preliminary AIX support
61
62 AIX is now supported when compiling with gcc. A number of features are
63 not supported yet. For example, only gcc is supported (not xlC).
64 Archives with both 32-bit and 64-bit dynamic libraries are not
65 generated automatically. The rpath includes both the build and install
66 rpath, no attempt is made to change the rpath at install time. Most
67 advanced features (eg. link\_whole) are not supported yet.
68
69 ## Wraps from subprojects are automatically promoted
70
71 It is not required to promote wrap files for subprojects into the main
72 project any more. When configuring a subproject, Meson will look for
73 any wrap file or directory in the subproject's `subprojects/`
74 directory and add them into the global list of available subprojects,
75 to be used by any future `subproject()` call or `dependency()`
76 fallback. If a subproject with the same name already exists, the new
77 wrap file or directory is ignored. That means that the main project
78 can always override any subproject's wrap files by providing their
79 own, it also means the ordering in which subprojects are configured
80 matters, if 2 subprojects provide foo.wrap only the one from the first
81 subproject to be configured will be used.
82
83 This new behavior can be disabled by passing `--wrap-mode=nopromote`.
84
85 ## `meson.build_root()` and `meson.source_root()` are deprecated
86
87 Those function are common source of issue when used in a subproject
88 because they point to the parent project root which is rarely what is
89 expected and is a violation of subproject isolation.
90
91 `meson.current_source_dir()` and `meson.current_build_dir()` should be
92 used instead and have been available in all Meson versions. New
93 functions `meson.project_source_root()` and
94 `meson.project_build_root()` have been added in Meson 0.56.0 to get
95 the root of the current (sub)project.
96
97 ## `dep.as_link_whole()`
98
99 Dependencies created with `declare_dependency()` now has new method
100 `as_link_whole()`. It returns a copy of the dependency object with all
101 link_with arguments changed to link_whole. This is useful for example
102 for fallback dependency from a subproject built with
103 `default_library=static`.
104
105 ```meson
106 somelib = static_library('somelib', ...)
107 dep = declare_dependency(..., link_with: somelib)
108 library('someotherlib', ..., dependencies: dep.as_link_whole())
109 ```
110
111 ## Add support for all Windows subsystem types
112
113 It is now possible to build things like Windows kernel drivers with
114 the new `win_subsystem` keyword argument. This replaces the old
115 `gui_app` keyword argument, which is now deprecated. You should update
116 your project to use the new style like this:
117
118 ```meson
119 # Old way
120 executable(..., gui_app: 'true')
121 # New way
122 executable(..., win_subsystem: 'windows')
123 ```
124
125 The argument supports versioning [as described on MSDN
126 documentation](https://docs.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem).
127 Thus to build a Windows kernel driver with a specific version you'd
128 write something like this:
129
130 ```meson
131 executable(..., win_subsystem: 'native,6.02')
132 ```
133
134 ## Added NVidia HPC SDK compilers
135
136 Added support for `nvidia_hpc` NVidia HPC SDK compilers, which are currently in public beta testing.
137
138 ## Project and built-in options can be set in native or cross files
139
140 A new set of sections has been added to the cross and native files,
141 `[project options]` and `[<subproject_name>:project options]`, where
142 `subproject_name` is the name of a subproject. Any options that are
143 allowed in the project can be set from this section. They have the
144 lowest precedent, and will be overwritten by command line arguments.
145
146
147 ```meson
148 option('foo', type : 'string', value : 'foo')
149 ```
150
151 ```ini
152 [project options]
153 foo = 'other val'
154 ```
155
156 ```console
157 meson setup builddir/ --native-file my.ini
158 ```
159
160 Will result in the option foo having the value `other val`,
161
162 ```console
163 meson setup builddir/ --native-file my.ini -Dfoo='different val'
164 ```
165
166 Will result in the option foo having the value `different val`,
167
168
169 Subproject options are assigned like this:
170
171 ```ini
172 [zlib:project options]
173 foo = 'some val'
174 ```
175
176 Additionally Meson level options can be set in the same way, using the
177 `[built-in options]` section.
178
179 ```ini
180 [built-in options]
181 c_std = 'c99'
182 ```
183
184 These options can also be set on a per-subproject basis, although only
185 `default_library` and `werror` can currently be set:
186 ```ini
187 [zlib:built-in options]
188 default_library = 'static'
189 ```
190
191 ## `unstable-keyval` is now stable `keyval`
192
193 The `unstable-keyval` has been renamed to `keyval` and now promises stability
194 guarantees.
195
196 Meson will print a warning when you load an `unstable-` module that has been
197 stabilised (so `unstable-keyval` is still accepted for example).
198
199 ## CMake subproject cross compilation support
200
201 Meson now supports cross compilation for CMake subprojects. Meson will
202 try to automatically guess most of the required CMake toolchain
203 variables from existing entries in the cross and native files. These
204 variables will be stored in an automatically generate CMake toolchain
205 file in the build directory. The remaining variables that can't be
206 guessed can be added by the user in the new `[cmake]` cross/native
207 file section.
208
209 ## Machine file keys are stored case sensitive
210
211 Previous the keys were always lowered, which worked fine for the
212 values that were allowed in the machine files. With the addition of
213 per-project options we need to make these sensitive to case, as the
214 options in meson_options.txt are sensitive to case already.
215
216 ## Consistency between `declare_dependency()` and `pkgconfig.generate()` variables
217
218 The `variables` keyword argument in `declare_dependency()` used to
219 only support dictionary and `pkgconfig.generate()` only list of
220 strings. They now both support dictionary and list of strings in the
221 format `'name=value'`. This makes easier to share a common set of
222 variables for both:
223
224 ```meson
225 vars = {'foo': 'bar'}
226 dep = declare_dependency(..., variables: vars)
227 pkg.generate(..., variables: vars)
228 ```
229
230 ## Qt5 compile_translations now supports qresource preprocessing
231
232 When using qtmod.preprocess() in combination with
233 qtmod.compile_translations() to embed translations using rcc, it is no
234 longer required to do this:
235
236 ```meson
237 ts_files = ['list', 'of', 'files']
238 qtmod.compile_translations(ts_files)
239 # lang.qrc also contains the duplicated list of files
240 lang_cpp = qtmod.preprocess(qresources: 'lang.qrc')
241 ```
242
243 Instead, use:
244 ```meson
245 lang_cpp = qtmod.compile_translations(qresource: 'lang.qrc')
246 ```
247
248 which will automatically detect and generate the needed
249 compile_translations targets.
250
251 ## Controlling subproject dependencies with `dependency(allow_fallback: ...)`
252
253 As an alternative to the `fallback` keyword argument to `dependency`,
254 you may use `allow_fallback`, which accepts a boolean value. If `true`
255 and the dependency is not found on the system, Meson will fallback to
256 a subproject that provides this dependency, even if the dependency is
257 optional. If `false`, Meson will not fallback even if a subproject
258 provides this dependency.
259
260 ## Custom standard library
261
262 - It is not limited to cross builds any more, `<lang>_stdlib` property can be
263 set in native files.
264 - The variable name parameter is no longer required as long as the subproject
265 calls `meson.override_dependency('c_stdlib', mylibc_dep)`.
266
267 ## Improvements for the builtin curses dependency
268
269 This method has been extended to use config-tools, and a fallback to
270 find_library for lookup as well as pkg-config.
271
272 ## HDF5 dependency improvements
273
274 HDF5 has been improved so that the internal representations have been
275 split. This allows selecting pkg-config and config-tool dependencies
276 separately. Both work as proper dependencies of their type, so
277 `get_variable` and similar now work correctly.
278
279 It has also been fixed to use the selected compiler for the build instead of
280 the default compiler.
281
282 ## External projects
283
284 A new experimental module `unstable-external_project` has been added
285 to build code using other build systems than Meson. Currently only
286 supporting projects with a configure script that generates Makefiles.
287
288 ```meson
289 project('My Autotools Project', 'c',
290 meson_version : '>=0.56.0',
291 )
292
293 mod = import('unstable-external_project')
294
295 p = mod.add_project('configure',
296 configure_options : ['--prefix=@PREFIX@',
297 '--libdir=@LIBDIR@',
298 '--incdir=@INCLUDEDIR@',
299 '--enable-foo',
300 ],
301 )
302
303 mylib_dep = p.dependency('mylib')
304 ```
305
306
307 ## Per subproject `warning_level` option
308
309 `warning_level` can now be defined per subproject, in the same way as
310 `default_library` and `werror`.
311
312 ## `meson subprojects` command
313
314 A new `--types` argument has been added to all subcommands to run the
315 command only on wraps with the specified types. For example this
316 command will only print `Hello` for each git subproject: `meson
317 subprojects foreach --types git echo "Hello"`. Multiple types can be
318 set as comma separated list e.g. `--types git,file`.
319
320 Subprojects with no wrap file are now taken into account as well. This
321 happens for example for subprojects configured as git submodule, or
322 downloaded manually by the user and placed into the `subprojects/`
323 directory.
324
325 The `checkout` subcommand now always stash any pending changes before
326 switching branch. Note that `update` subcommand was already stashing
327 changes before updating the branch.
328
329 If the command fails on any subproject the execution continues with
330 other subprojects, but at the end an error code is now returned.
331
332 The `update` subcommand has been reworked:
333 - In the case the URL of `origin` is different as the `url` set in wrap file,
334 the subproject will not be updated unless `--reset` is specified (see below).
335 - In the case a subproject directory exists and is not a git repository but has
336 a `[wrap-git]`, Meson used to run git commands that would wrongly apply to the
337 main project. It now skip the subproject unless `--reset` is specified (see below).
338 - The `--rebase` behaviour is now the default for consistency: it was
339 already rebasing when current branch and revision are the same, it is
340 less confusing to rebase when they are different too.
341 - Add `--reset` mode that checkout the new branch and hard reset that
342 branch to remote commit. This new mode guarantees that every
343 subproject are exactly at the wrap's revision. In addition the URL of `origin`
344 is updated in case it changed in the wrap file. If the subproject directory is
345 not a git repository but has a `[wrap-git]` the directory is deleted and the
346 new repository is cloned.
347 - Local changes are always stashed first to avoid any data loss. In the
348 worst case scenario the user can always check reflog and stash list to
349 rollback.
350
351 ## Added CompCert C compiler
352
353 Added experimental support for the [CompCert formally-verified C
354 compiler](https://github.com/AbsInt/CompCert). The current state of
355 the implementation is good enough to build the [picolibc
356 project](https://github.com/picolibc/picolibc) with CompCert, but
357 might still need additional adjustments for other projects.
358
359 ## Dependencies listed in test and benchmark introspection
360
361 The introspection data for tests and benchmarks now includes the
362 target ids for executables and built files that are needed by the
363 test. IDEs can use this feature to update the build more quickly
364 before running a test.
365
366 ## `include_type` support for the CMake subproject object dependency method
367
368 The `dependency()` method of the CMake subproject object now also
369 supports the `include_type` kwarg which is similar to the sane kwarg
370 in the `dependency()` function.
371
372 ## Deprecate Dependency.get_pkgconfig_variable and Dependency.get_configtool_variable
373
374 These have been replaced with the more versatile `get_variable()` method
375 already, and shouldn't be used anymore.