Debian Codegraph @

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

raw
1 ---
2 title: Release 0.47
3 short-description: Release notes for 0.47
4 ...
5
6 # New features
7
8 ## Allow early return from a script
9
10 Added the function `subdir_done()`. Its invocation exits the current
11 script at the point of invocation. All previously invoked build
12 targets and commands are build/executed. All following ones are
13 ignored. If the current script was invoked via `subdir()` the parent
14 script continues normally.
15
16 ## Concatenate string literals returned from `get_define()`
17
18 After obtaining the value of a preprocessor symbol consecutive string
19 literals are merged into a single string literal. For example a
20 preprocessor symbol's value `"ab" "cd"` is returned as `"abcd"`.
21
22 ## ARM compiler(version 6) for C and CPP
23
24 Cross-compilation is now supported for ARM targets using ARM compiler
25 version 6 - ARMCLANG. The required ARMCLANG compiler options for
26 building a shareable library are not included in the current Meson
27 implementation for ARMCLANG support, so it cannot build shareable
28 libraries. This current Meson implementation for ARMCLANG support can
29 not build assembly files with arm syntax (we need to use armasm
30 instead of ARMCLANG for the `.s` files with this syntax) and only
31 supports GNU syntax.
32
33 The default extension of the executable output is `.axf`. The
34 environment path should be set properly for the ARM compiler
35 executables. The `--target`, `-mcpu` options with the appropriate
36 values should be mentioned in the cross file as shown in the snippet
37 below.
38
39 ```ini
40 [properties]
41 c_args = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
42 cpp_args = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
43 ```
44
45 Note:
46 - The current changes are tested on Windows only.
47 - PIC support is not enabled by default for ARM,
48 if users want to use it, they need to add the required arguments
49 explicitly from cross-file(`c_args`/`cpp_args`) or some other way.
50
51 ## New base build option for LLVM (Apple) bitcode support
52
53 When building with clang on macOS, you can now build your static and
54 shared binaries with embedded bitcode by enabling the `b_bitcode`
55 [base option](Builtin-options.md#base-options) by passing
56 `-Db_bitcode=true` to Meson.
57
58 This is better than passing the options manually in the environment
59 since Meson will automatically disable conflicting options such as
60 `b_asneeded`, and will disable bitcode support on targets that don't
61 support it such as `shared_module()`.
62
63 Since this requires support in the linker, it is currently only
64 enabled when using Apple ld. In the future it can be extended to clang
65 on other platforms too.
66
67 ## New compiler check: `check_header()`
68
69 The existing compiler check `has_header()` only checks if the header
70 exists, either with the `__has_include` C++11 builtin, or by running
71 the pre-processor.
72
73 However, sometimes the header you are looking for is unusable on some
74 platforms or with some compilers in a way that is only detectable at
75 compile-time. For such cases, you should use `check_header()` which
76 will include the header and run a full compile.
77
78 Note that `has_header()` is much faster than `check_header()`, so it
79 should be used whenever possible.
80
81 ## New action `copy:` for `configure_file()`
82
83 In addition to the existing actions `configuration:` and `command:`,
84 [[configure_file]] now accepts a
85 keyword argument `copy:` which specifies a new action to copy the file
86 specified with the `input:` keyword argument to a file in the build
87 directory with the name specified with the `output:` keyword argument.
88
89 These three keyword arguments are, as before, mutually exclusive. You
90 can only do one action at a time.
91
92 ## New keyword argument `encoding:` for `configure_file()`
93
94 Add a new keyword to
95 [[configure_file]] that allows
96 the developer to specify the input and output file encoding. The
97 default value is the same as before: UTF-8.
98
99 In the past, Meson would not handle non-UTF-8/ASCII files correctly,
100 and in the worst case would try to coerce it to UTF-8 and mangle the
101 data. UTF-8 is the standard encoding now, but sometimes it is
102 necessary to process files that use a different encoding.
103
104 For additional details see [#3135](https://github.com/mesonbuild/meson/pull/3135).
105
106 ## New keyword argument `output_format:` for `configure_file()`
107
108 When called without an input file, `configure_file` generates a C
109 header file by default. A keyword argument was added to allow
110 specifying the output format, for example for use with nasm or yasm:
111
112 ```meson
113 conf = configuration_data()
114 conf.set('FOO', 1)
115
116 configure_file('config.asm',
117 configuration: conf,
118 output_format: 'nasm')
119 ```
120
121 ## Substitutions in `custom_target(depfile:)`
122
123 The `depfile` keyword argument to `custom_target` now accepts the `@BASENAME@`
124 and `@PLAINNAME@` substitutions.
125
126 ## Deprecated `build_always:` for custom targets
127
128 Setting `build_always` to `true` for a custom target not only marks
129 the target to be always considered out of date, but also adds it to
130 the set of default targets. This option is therefore deprecated and
131 the new option `build_always_stale` is introduced.
132
133 `build_always_stale` *only* marks the target to be always considered
134 out of date, but does not add it to the set of default targets. The
135 old behaviour can be achieved by combining `build_always_stale` with
136 `build_by_default`.
137
138 The documentation has been updated accordingly.
139
140 ## New built-in object type: dictionary
141
142 Meson dictionaries use a syntax similar to python's dictionaries, but
143 have a narrower scope: they are immutable, keys can only be string
144 literals, and initializing a dictionary with duplicate keys causes a
145 fatal error.
146
147 Example usage:
148
149 ```meson
150 d = {'foo': 42, 'bar': 'baz'}
151
152 foo = d.get('foo')
153 foobar = d.get('foobar', 'fallback-value')
154
155 foreach key, value : d
156 Do something with key and value
157 endforeach
158 ```
159
160 ## Array options treat `-Dopt=` and `-Dopt=[]` as equivalent
161
162 Prior to this change passing -Dopt= to an array opt would be
163 interpreted as `['']` (an array with an empty string), now `-Dopt=` is
164 the same as `-Dopt=[]`, an empty list.
165
166 ## Feature detection based on `meson_version:` in `project()`
167
168 Meson will now print a `WARNING:` message during configuration if you
169 use a function or a keyword argument that was added in a Meson version
170 that's newer than the version specified inside `project()`. For
171 example:
172
173 ```meson
174 project('featurenew', meson_version: '>=0.43')
175
176 cdata = configuration_data()
177 cdata.set('FOO', 'bar')
178 message(cdata.get_unquoted('FOO'))
179 ```
180
181 This will output:
182
183 ```
184 The Meson build system
185 Version: 0.47.0.dev1
186 Source dir: C:\path\to\srctree
187 Build dir: C:\path\to\buildtree
188 Build type: native build
189 Project name: featurenew
190 Project version: undefined
191 Build machine cpu family: x86_64
192 Build machine cpu: x86_64
193 WARNING: Project targeting '>=0.43' but tried to use feature introduced in '0.44.0': configuration_data.get_unquoted()
194 Message: bar
195 Build targets in project: 0
196 WARNING: Project specifies a minimum meson_version '>=0.43' which conflicts with:
197 * 0.44.0: {'configuration_data.get_unquoted()'}
198 ```
199
200 ## New type of build option for features
201
202 A new type of [option called `feature`](Build-options.md#features) can
203 be defined in `meson_options.txt` for the traditional `enabled /
204 disabled / auto` tristate. The value of this option can be passed to
205 the `required` keyword argument of functions `dependency()`,
206 `find_library()`, `find_program()` and `add_languages()`.
207
208 A new global option `auto_features` has been added to override the
209 value of all `auto` features. It is intended to be used by packagers
210 to have full control on which feature must be enabled or disabled.
211
212 ## New options to `gnome.gdbus_codegen()`
213
214 You can now pass additional arguments to gdbus-codegen using the
215 `extra_args` keyword. This is the same for the other gnome function
216 calls.
217
218 Meson now automatically adds autocleanup support to the generated
219 code. This can be modified by setting the autocleanup keyword.
220
221 For example:
222
223 ```meson
224 sources += gnome.gdbus_codegen('com.mesonbuild.Test',
225 'com.mesonbuild.Test.xml',
226 autocleanup : 'none',
227 extra_args : ['--pragma-once'])
228 ```
229
230 ## Made 'install' a top level Meson command
231
232 You can now run `meson install` in your build directory and it will do
233 the install. It has several command line options you can toggle the
234 behaviour that is not in the default `ninja install` invocation. This
235 is similar to how `meson test` already works.
236
237 For example, to install only the files that have changed, you can do:
238
239 ```console
240 $ meson install --only-changed
241 ```
242
243 ## `install_mode:` keyword argument extended to all installable targets
244
245 It is now possible to pass an `install_mode` argument to all
246 installable targets, such as `executable()`, libraries, headers, man
247 pages and custom/generated targets.
248
249 The `install_mode` argument can be used to specify the file mode in
250 symbolic format and optionally the owner/uid and group/gid for the
251 installed files.
252
253 ## New built-in option `install_umask` with a default value 022
254
255 This umask is used to define the default permissions of files and
256 directories created in the install tree. Files will preserve their
257 executable mode, but the exact permissions will obey the
258 `install_umask`.
259
260 The `install_umask` can be overridden in the Meson command-line:
261
262 ```console
263 $ meson --install-umask=027 builddir/
264 ```
265
266 A project can also override the default in the `project()` call:
267
268 ```meson
269 project('myproject', 'c',
270 default_options : ['install_umask=027'])
271 ```
272
273 To disable the `install_umask`, set it to `preserve`, in which case
274 permissions are copied from the files in their origin.
275
276 ## Octal and binary string literals
277
278 Octal and binary integer literals can now be used in build and option files.
279
280 ```meson
281 int_493 = 0o755
282 int_1365 = 0b10101010101
283 ```
284
285 ## New keyword arguments: 'check' and 'capture' for `run_command()`
286
287 If `check:` is `true`, then the configuration will fail if the command
288 returns a non-zero exit status. The default value is `false` for
289 compatibility reasons.
290
291 `run_command()` used to always capture the output and stored it for
292 use in build files. However, sometimes the stdout is in a binary
293 format which is meant to be discarded. For that case, you can now set
294 the `capture:` keyword argument to `false`.
295
296 ## Windows resource files dependencies
297
298 The `compile_resources()` function of the `windows` module now takes
299 the `depend_files:` and `depends:` keywords.
300
301 When using binutils's `windres`, dependencies on files `#include`'d by
302 the preprocessor are now automatically tracked.
303
304 ## Polkit support for privileged installation
305
306 When running `install`, if installation fails with a permission error
307 and `pkexec` is available, Meson will attempt to use it to spawn a
308 permission dialog for privileged installation and retry the
309 installation.
310
311 If `pkexec` is not available, the old behaviour is retained and you
312 will need to explicitly run the install step with `sudo`.