Debian Codegraph @

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

raw
1 ---
2 title: Release 1.5.0
3 short-description: Release notes for 1.5.0
4 ...
5
6 # New features
7
8 Meson 1.5.0 was released on 10 July 2024
9 ## Support for `bztar` in `meson dist`
10
11 The `bztar` format is now supported in `meson dist`. This format is also known
12 as `bzip2`.
13
14 ## Cargo dependencies names now include the API version
15
16 Cargo dependencies names are now in the format `<package_name>-<version>-rs`:
17 - `package_name` is defined in `[package] name = ...` section of the `Cargo.toml`.
18 - `version` is the API version deduced from `[package] version = ...` as follow:
19 * `x.y.z` -> 'x'
20 * `0.x.y` -> '0.x'
21 * `0.0.x` -> '0'
22 It allows to make different dependencies for incompatible versions of the same
23 crate.
24 - `-rs` suffix is added to distinguish from regular system dependencies, for
25 example `gstreamer-1.0` is a system pkg-config dependency and `gstreamer-0.22-rs`
26 is a Cargo dependency.
27
28 That means the `.wrap` file should have `dependency_names = foo-1-rs` in their
29 `[provide]` section when `Cargo.toml` has package name `foo` and version `1.2`.
30
31 This is a breaking change (Cargo subprojects are still experimental), previous
32 versions were using `<package_name>-rs` format.
33
34 ## Added support `Cargo.lock` file
35
36 When a (sub)project has a `Cargo.lock` file at its root, it is loaded to provide
37 an automatic fallback for dependencies it defines, fetching code from
38 https://crates.io or git. This is identical as providing `subprojects/*.wrap`,
39 see [cargo wraps](Wrap-dependency-system-manual.md#cargo-wraps) dependency naming convention.
40
41 ## Meson now propagates its build type to CMake
42
43 When the CMake build type variable, `CMAKE_BUILD_TYPE`, is not set via the
44 `add_cmake_defines` method of the [`cmake options` object](CMake-module.md#cmake-options-object),
45 it is inferred from the [Meson build type](Builtin-options.md#details-for-buildtype).
46 Build types of the two build systems do not match perfectly. The mapping from
47 Meson build type to CMake build type is as follows:
48
49 - `debug` -> `Debug`
50 - `debugoptimized` -> `RelWithDebInfo`
51 - `release` -> `Release`
52 - `minsize` -> `MinSizeRel`
53
54 No CMake build type is set for the `plain` Meson build type. The inferred CMake
55 build type overrides any `CMAKE_BUILD_TYPE` environment variable.
56
57 ## compiler.run() method is now available for all languages
58
59 It used to be only implemented for C-like and D languages, but it is now available
60 for all languages.
61
62 ## dependencies created by compiler.find_library implement the `name()` method
63
64 Previously, for a [[@dep]] that might be returned by either [[dependency]] or
65 [[compiler.find_library]], the method might or might not exist with no way
66 of telling.
67
68 ## New version_argument kwarg for find_program
69
70 When finding an external program with `find_program`, the `version_argument`
71 can be used to override the default `--version` argument when trying to parse
72 the version of the program.
73
74 For example, if the following is used:
75 ```meson
76 foo = find_program('foo', version_argument: '-version')
77 ```
78
79 meson will internally run `foo -version` when trying to find the version of `foo`.
80
81 ## Meson configure handles changes to options in more cases
82
83 Meson configure now correctly handles updates to the options file without a full
84 reconfigure. This allows making a change to the `meson.options` or
85 `meson_options.txt` file without a reconfigure.
86
87 For example, this now works:
88 ```sh
89 meson setup builddir
90 git pull
91 meson configure builddir -Doption-added-by-pull=value
92 ```
93
94 ## New meson format command
95
96 This command is similar to `muon fmt` and allows to format a `meson.build`
97 document.
98
99 ## Added support for GCC's `null_terminated_string_arg` function attribute
100
101 You can now check if a compiler support the `null_terminated_string_arg`
102 function attribute via the `has_function_attribute()` method on the
103 [[@compiler]] object.
104
105 ```meson
106 cc = meson.get_compiler('c')
107
108 if cc.has_function_attribute('null_terminated_string_arg')
109 # We have it...
110 endif
111 ```
112
113 ## A new dependency for ObjFW is now supported
114
115 For example, you can create a simple application written using ObjFW like this:
116
117 ```meson
118 project('SimpleApp', 'objc')
119
120 objfw_dep = dependency('objfw', version: '>= 1.0')
121
122 executable('SimpleApp', 'SimpleApp.m',
123 dependencies: [objfw_dep])
124 ```
125
126 Modules are also supported. A test case using ObjFWTest can be created like
127 this:
128
129 ```meson
130 project('Tests', 'objc')
131
132 objfwtest_dep = dependency('objfw', version: '>= 1.1', modules: ['ObjFWTest'])
133
134 executable('Tests', ['FooTest.m', 'BarTest.m'],
135 dependencies: [objfwtest_dep])
136 ```
137
138 ## Support of indexed `@PLAINNAME@` and `@BASENAME@`
139
140 In `custom_target()` and `configure_file()` with multiple inputs,
141 it is now possible to specify index for `@PLAINNAME@` and `@BASENAME@`
142 macros in `output`:
143 ```
144 custom_target('target_name',
145 output: '@[email protected]',
146 input: [dep1, dep2],
147 command: cmd)
148 ```
149
150 ## Required kwarg on more `compiler` methods
151
152 The following `compiler` methods now support the `required` keyword argument:
153
154 - `compiler.compiles()`
155 - `compiler.links()`
156 - `compiler.runs()`
157
158 ```meson
159 cc.compiles(valid, name: 'valid', required : true)
160 cc.links(valid, name: 'valid', required : true)
161 cc.run(valid, name: 'valid', required : true)
162
163 assert(not cc.compiles(valid, name: 'valid', required : opt))
164 assert(not cc.links(valid, name: 'valid', required : opt))
165 res = cc.run(valid, name: 'valid', required : opt)
166 assert(res.compiled())
167 assert(res.returncode() == 0)
168 assert(res.stdout() == '')
169 assert(res.stderr() == '')
170 ```
171
172 ## The Meson test program supports a new "--interactive" argument
173
174 `meson test --interactive` invokes tests with stdout, stdin and stderr
175 connected directly to the calling terminal. This can be useful when running
176 integration tests that run in containers or virtual machines which can spawn a
177 debug shell if a test fails.
178
179 ## meson test now sets the `MESON_TEST_ITERATION` environment variable
180
181 `meson test` will now set the `MESON_TEST_ITERATION` environment variable to the
182 current iteration of the test. This will always be `1` unless `--repeat` is used
183 to run the same test multiple times.
184
185 ## The Meson test program supports a new "--max-lines" argument
186
187 By default `meson test` only shows the last 100 lines of test output from tests
188 that produce large amounts of output. This default can now be changed with the
189 new `--max-lines` option. For example, `--max-lines=1000` will increase the
190 maximum number of log output lines from 100 to 1000.
191
192 ## Basic support for TI Arm Clang (tiarmclang)
193
194 Support for TI's newer [Clang-based ARM toolchain](https://www.ti.com/tool/ARM-CGT).
195
196 ## Support for Texas Instruments C6000 C/C++ compiler
197
198 Meson now supports the TI C6000 C/C++ compiler use for the C6000 cpu family.
199 The example cross file is available in `cross/ti-c6000.txt`.
200
201 ## Wayland stable protocols can be versioned
202
203 The wayland module now accepts a version number for stable protocols.
204
205 ```meson
206 wl_mod = import('unstable-wayland')
207
208 wl_mod.find_protocol(
209 'linux-dmabuf',
210 state: 'stable'
211 version: 1
212 )
213 ```
214