Skip to content

Commit

Permalink
Rust: Added feature flag to disable buildscript on docs.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
cdxker committed Jun 5, 2023
1 parent aa89978 commit 1396532
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bindings/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "april_asr"
version = "0.1.21-dev1"
version = "0.1.21-dev2"
edition = "2021"
authors = ["fastfists <[email protected]>", "abb128"]

license = "GPL-3.0"
email = "[email protected]"
authors = ["fastfists", "abb128"]
readme = "README.md"
documentation = "https://docs.rs/april_asr"
repository = "https://github.com/abb128/april-asr"
description = "Offline open source speech recognition API based on next-generation Kaldi"
Expand All @@ -17,3 +18,16 @@ bindgen = "0.65.1"
flate2 = "1.0.26"
tar = "0.4.38"
ureq = "2.6.2"

[features]
default = []

# Disable build script, used to prevent issues with docs.rs
disable-sys-build-script = []


[package.metadata.docs.rs]
# Disable the build.rs on https://docs.rs since it can cause
# issue there and it's not needed.
features = ["disable-sys-build-script"]

6 changes: 6 additions & 0 deletions bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use std::{
const APRIL_RELEASE_URL: &str = "http://github.com/arguflow/april-asr/releases/download/v-0.0.1/libaprilasr.so";
const ONNX_RELEASE_URL: &str = "http://github.com/microsoft/onnxruntime/releases/download/v1.13.1/onnxruntime-linux-x64-1.13.1.tgz";

#[cfg(feature = "disable-sys-build-script")]
fn main() {
println!("Build script disabled!");
}

#[cfg(not(feature = "disable-sys-build-script"))]
fn main() {
// Tell cargo to look for shared libraries in the specified directory
copy_shared_objects().expect("Failed to copy shared objects to target directory");
Expand Down

0 comments on commit 1396532

Please sign in to comment.