From 2df4fc955928e4be6d52c537e34a544e4f9f8d13 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 20 Aug 2024 14:10:48 -0400 Subject: [PATCH] rust: Attempt to fix build on docs.rs Copy over the pattern we have in ostree to add a feature that disables our build script (which pulls in a requirement on the libcomposefs C library, which doesn't exist in the docs.rs build env) when we detect we're being built on docs.rs. Signed-off-by: Colin Walters --- rust/composefs-sys/Cargo.toml | 4 ++++ rust/composefs-sys/build.rs | 1 + rust/composefs/Cargo.toml | 1 + 3 files changed, 6 insertions(+) diff --git a/rust/composefs-sys/Cargo.toml b/rust/composefs-sys/Cargo.toml index bda05ecf..82c7653b 100644 --- a/rust/composefs-sys/Cargo.toml +++ b/rust/composefs-sys/Cargo.toml @@ -9,11 +9,15 @@ build = "build.rs" license = "MIT OR Apache-2.0" readme = "README.md" +[package.metadata.docs.rs] +features = ["dox"] + [package.metadata.system-deps.composefs] name = "composefs" version = "1" [features] +dox = [] # Depend on 1.0.4 APIs v1_0_4 = [] diff --git a/rust/composefs-sys/build.rs b/rust/composefs-sys/build.rs index d66b1a5a..54331fb7 100644 --- a/rust/composefs-sys/build.rs +++ b/rust/composefs-sys/build.rs @@ -1,4 +1,5 @@ fn main() { + #[cfg(not(feature = "dox"))] if let Err(s) = system_deps::Config::new().probe() { println!("cargo:warning={s}"); std::process::exit(1); diff --git a/rust/composefs/Cargo.toml b/rust/composefs/Cargo.toml index fdf3fbf5..64c1fba9 100644 --- a/rust/composefs/Cargo.toml +++ b/rust/composefs/Cargo.toml @@ -14,6 +14,7 @@ name = "composefs" path = "src/lib.rs" [features] +dox = ["composefs-sys/dox"] # Depend on 1.0.4 APIs v1_0_4 = ["composefs-sys/v1_0_4"]