@@ -18,11 +18,16 @@ exclude = [
"Makefile.am",
]
+[features]
+v2_1 = []
+
[dependencies]
[build-dependencies]
bindgen = "0.63"
system-deps = "2.0"
-[package.metadata.system-deps]
-libgpiod = "2"
+[package.metadata.system-deps.libgpiod]
+name = "libgpiod"
+version = "2"
+v2_1 = { version = "2.1" }
@@ -19,7 +19,8 @@ exclude = [
]
[features]
-vnext = []
+v2_1 = ["libgpiod-sys/v2_1"]
+vnext = ["v2_1"]
[dependencies]
errno = "0.2.8"
@@ -28,6 +28,7 @@ C library will be exposed by default.
Setting flags allows to increase the base version and export features of newer
versions:
+- `v2_1`: Minimum version of `2.1.x`
- `vnext`: The upcoming, still unreleased version of the C lib
## License
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: 2022 Linaro Ltd.
// SPDX-FileCopyrightText: 2022 Viresh Kumar <viresh.kumar@linaro.org>
-#[cfg(feature = "vnext")]
+#[cfg(feature = "v2_1")]
use std::ffi::CStr;
use std::os::unix::prelude::AsRawFd;
use std::time::Duration;
@@ -32,7 +32,7 @@ impl Request {
}
/// Get the name of the chip this request was made on.
- #[cfg(feature = "vnext")]
+ #[cfg(feature = "v2_1")]
pub fn chip_name(&self) -> Result<&str> {
// SAFETY: The `gpiod_line_request` is guaranteed to be live as long
// as `&self`
@@ -60,7 +60,7 @@ mod line_request {
use super::*;
#[test]
- #[cfg(feature = "vnext")]
+ #[cfg(feature = "v2_1")]
fn chip_name() {
const GPIO: Offset = 2;
let mut config = TestConfig::new(NGPIO).unwrap();
This is just a demo of a release bump to better illustrate what was sketched in the previous commit. Signed-off-by: Erik Schilling <erik.schilling@linaro.org> --- bindings/rust/libgpiod-sys/Cargo.toml | 9 +++++++-- bindings/rust/libgpiod/Cargo.toml | 3 ++- bindings/rust/libgpiod/README.md | 1 + bindings/rust/libgpiod/src/line_request.rs | 4 ++-- bindings/rust/libgpiod/tests/line_request.rs | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-)