chiark / gitweb /
build.rs: Set --cfg=nix_ge_0_27, not nix_0_27
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Feb 2024 01:46:52 +0000 (01:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 25 Feb 2024 17:13:37 +0000 (17:13 +0000)
Don't use exact semver matching.  Use the test for all later versions,
in the hope that the later version will be similar.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
build.rs
src/compat.rs

index d52f7474ba52e709be1e440c0bfbc1cfdbdf5c6a..f3f2d9ae42f60bc4414c04a02057abd8aa63b796 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -57,8 +57,8 @@ fn main(){
 
   let nix = &nix.version;
   let nix: semver::Version = nix.parse().expect(nix);
-  for test in ["0.27"] {
-    let cfg = test.replace('.', "_");
+  for test in [">=0.27"] {
+    let cfg = test.replace('.', "_").replace(">=", "ge_");
     let test: semver::VersionReq = test.parse().unwrap();
     if test.matches(&nix) {
       println!("cargo:rustc-cfg=nix_{cfg}");
index eef04fe047b85878050e0cc4d8f206c156f7a71b..75d478d7a1efd207f493f996dfbf6e121f0bc5ba 100644 (file)
@@ -9,7 +9,7 @@ use crate::prelude::*;
 pub unsafe fn writev(fd: c_int, iov: &[IoSlice]) -> nix::Result<usize> {
   nix::sys::uio::writev(
     { cfg_if! {
-      if #[cfg(nix_0_27)] {
+      if #[cfg(nix_ge_0_27)] {
         BorrowedFd::borrow_raw(fd)
       } else {
         fd