Skip to content

Commit bd9f871

Browse files
committed
Rust: Deprecate staticlib, rlib, cdylib and dylib crate types
Meson already knows if it's a shared or static library, user only need to specify the ABI (Rust or C).
1 parent 66ab5e2 commit bd9f871

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
## New `clib` value for `rust_crate_type`
22

3-
Similar to `lib` value but for building a C ABI static or shared library
4-
depending on the value of `default_library` when using `library()`.
3+
Similar to the `lib` value that was already accepted, but for building a C ABI
4+
static or shared library depending on the value of `default_library` when using
5+
`library()`.
6+
7+
`staticlib`, `rlib`, `cdylib` and `dylib` values are now deprecated because
8+
Meson already knows if it's a shared or static library, user only need to specify
9+
the ABI (Rust or C).

docs/yaml/functions/_build_target_base.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,16 @@ kwargs:
292292
If the target is an [[executable]] this defaults to "bin", the only
293293
allowed value.
294294
295-
If it is a [[static_library]] it defaults to "lib", and may be "lib", "clib"
296-
"staticlib", or "rlib". "clib" and "staticlib" means a C ABI library,
297-
"lib" and "rlib" means a Rust ABI.
298-
299-
If it is a [[shared_library]] it defaults to "lib", and may be "lib", "clib",
300-
"dylib", "cdylib", or "proc-macro". "clib" and "cdylib" means a C ABI library,
301-
"lib" and "dylib" means a Rust ABI, and "proc-macro" is a special rust
302-
procedural macro crate.
303-
304-
"proc-macro" is new in 0.62.0.
305-
"clib" is new in 1.2.0.
295+
If it is a [[static_library]] it defaults to "lib" which builds a Rust ABI
296+
library (rlib), "clib" builds a C ABI library (staticlib).
297+
*Since 1.2.0* "clib" value has been added, "staticlib" and "rlib" values
298+
have been deprecated.
299+
300+
If it is a [[shared_library]] it defaults to "lib" which builds a Rust ABI
301+
library (dylib), "clib" value builds a C ABI library (cdylib).
302+
*Since 0.62.0* "proc-macro" value builds a special rust procedural macro crate.
303+
*Since 1.2.0* "clib" value has been added, "cdylib" and "dylib" values
304+
have been deprecated.
306305
307306
rust_dependency_map:
308307
type: dict[str]

mesonbuild/build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ def process_kwargs(self, kwargs):
12461246
FeatureNew.single_use('Rust crate type "proc-macro"', '0.62.0', self.subproject)
12471247
if self.rust_crate_type == 'clib':
12481248
FeatureNew.single_use('Rust crate type "clib"', '1.2.0', self.subproject)
1249+
if self.rust_crate_type in {'staticlib', 'rlib', 'cdylib', 'dylib'}:
1250+
FeatureDeprecated.single_use(f'Rust crate type {self.rust_crate_type!r}', '1.2.0', self.subproject,
1251+
'Use "lib" for Rust ABI and "clib" for C ABI')
12491252

12501253
rust_dependency_map = kwargs.get('rust_dependency_map', {})
12511254
if not isinstance(rust_dependency_map, dict):

0 commit comments

Comments
 (0)