Merge pull request 'prevent libcwtch.so fetch on build.rs so docs can build, be published' (#15) from docsrs into main

Reviewed-on: #15
This commit is contained in:
Sarah Jamie Lewis 2022-04-26 19:12:02 +00:00
commit 58687001b6
1 changed files with 24 additions and 20 deletions

View File

@ -1,12 +1,15 @@
use std::{env, io};
use std::fs;
use std::path::Path;
use std::process::Command;
use std::{env, io};
use hex_literal::hex;
use sha2::{Digest, Sha512};
fn main() {
// Do not fetch lib on docs.rs as it cannot, build will fail, docs won't build
// https://docs.rs/about/builds
if std::env::var("DOCS_RS").is_err() {
let out_dir = env::var_os("OUT_DIR").unwrap();
println!("cargo:rustc-flags=-L {}", out_dir.to_str().unwrap());
println!("cargo:rustc-link-lib=Cwtch");
@ -30,4 +33,5 @@ fn main() {
let hash_bytes = hasher.finalize();
assert_eq!(hash_bytes[..], hex!("cb4368d72a46f8046261c50e6e9ecf170d8e606871d5de2c1e9e34303533c344f92f5d946d7e12614581dfa3ae8e638512af7f4623ed91b1ceb1570de14bf192")[..]);
}
}