Debian Codegraph @

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

raw
1 ---
2 title: Release 0.44
3 short-description: Release notes for 0.44
4 ...
5
6 # New features
7
8 ## Added warning function
9
10 This function prints its argument to the console prefixed by
11 "WARNING:" in yellow color. A simple example:
12
13 warning('foo is deprecated, please use bar instead')
14
15
16 ## Adds support for additional Qt5-Module keyword `moc_extra_arguments`
17
18 When `moc`-ing sources, the `moc` tool does not know about any
19 preprocessor macros. The generated code might not match the input
20 files when the linking with the moc input sources happens.
21
22 This amendment allows to specify a a list of additional arguments
23 passed to the `moc` tool. They are called `moc_extra_arguments`.
24
25
26 ## Prefix-dependent defaults for sysconfdir, localstatedir and sharedstatedir
27
28 These options now default in a way consistent with
29 [FHS](http://refspecs.linuxfoundation.org/fhs.shtml) and common usage.
30
31 If prefix is `/usr`, default sysconfdir to `/etc`, localstatedir to `/var` and
32 sharedstatedir to `/var/lib`.
33
34 If prefix is `/usr/local` (the default), default localstatedir to
35 `/var/local` and sharedstatedir to `/var/local/lib`.
36
37
38 ## An array type for user options
39
40 Previously to have an option that took more than one value a string
41 value would have to be created and split, but validating this was
42 difficult. A new array type has been added to the `meson_options.txt`
43 for this case. It works like a 'combo', but allows more than one
44 option to be passed. The values can optionally be validated against a
45 list of valid values. When used on the command line (with -D), values
46 are passed as a comma separated list.
47
48 ```meson
49 option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one'])
50 ```
51
52 These can be overwritten on the command line,
53
54 ```meson
55 meson _build -Darray_opt=two,three
56 ```
57
58 ## LLVM dependency supports both dynamic and static linking
59
60 The LLVM dependency has been improved to consistently use dynamic
61 linking. Previously recent version (>= 3.9) would link dynamically
62 while older versions would link statically.
63
64 Now LLVM also accepts the `static` keyword to enable statically
65 linking to LLVM modules instead of dynamically linking.
66
67
68 ## Added `if_found` to subdir
69
70 Added a new keyword argument to the `subdir` command. It is given a
71 list of dependency objects and the function will only recurse in the
72 subdirectory if they are all found. Typical usage goes like this.
73
74 ```meson
75 d1 = dependency('foo') # This is found
76 d2 = dependency('bar') # This is not found
77
78 subdir('somedir', if_found : [d1, d2])
79 ```
80
81 In this case the subdirectory would not be entered since `d2` could
82 not be found.
83
84 ## `get_unquoted()` method for the `configuration` data object
85
86 New convenience method that allows reusing a variable value
87 defined quoted. Useful in C for config.h strings for example.
88
89
90 ## Added disabler object
91
92 A disabler object is a new kind of object that has very specific
93 semantics. If it is used as part of any other operation such as an
94 argument to a function call, logical operations etc, it will cause the
95 operation to not be evaluated. Instead the return value of said
96 operation will also be the disabler object.
97
98 For example if you have an setup like this:
99
100 ```meson
101 dep = dependency('foo')
102 lib = shared_library('mylib', 'mylib.c',
103 dependencies : dep)
104 exe = executable('mytest', 'mytest.c',
105 link_with : lib)
106 test('mytest', exe)
107 ```
108
109 If you replace the dependency with a disabler object like this:
110
111 ```meson
112 dep = disabler()
113 lib = shared_library('mylib', 'mylib.c',
114 dependencies : dep)
115 exe = executable('mytest', 'mytest.c',
116 link_with : lib)
117 test('mytest', exe)
118 ```
119
120 Then the shared library, executable and unit test are not
121 created. This is a handy mechanism to cut down on the number of `if`
122 statements.
123
124
125 ## Config-Tool based dependencies gained a method to get arbitrary options
126
127 A number of dependencies (CUPS, LLVM, pcap, WxWidgets, GnuStep) use a
128 config tool instead of pkg-config. As of this version they now have a
129 `get_configtool_variable` method, which is analogous to the
130 `get_pkgconfig_variable` for pkg config.
131
132 ```meson
133 dep_llvm = dependency('LLVM')
134 llvm_inc_dir = dep_llvm.get_configtool_variable('includedir')
135 ```
136
137 ## Embedded Python in Windows MSI packages
138
139 Meson now ships an internal version of Python in the MSI installer
140 packages. This means that it can run Python scripts that are part of
141 your build transparently. That is, if you do the following:
142
143 ```meson
144 myprog = find_program('myscript.py')
145 ```
146
147 Then Meson will run the script with its internal Python version if necessary.
148
149 ## Libwmf dependency now supports libwmf-config
150
151 Earlier, `dependency('libwmf')` could only detect the library with
152 pkg-config files. Now, if pkg-config files are not found, Meson will
153 look for `libwmf-config` and if it's found, will use that to find the
154 library.