From 23887875e1785f6a1e6451541400de74709c464e Mon Sep 17 00:00:00 2001 From: Thomas Orozco Date: Fri, 6 Dec 2019 16:46:06 +0000 Subject: [PATCH] Allow delegating all linking This is helpful when an external build system (e.g. Buck) is taking care of linking liblz4, and we don't want the Rust compiler to emit any linking arguments. To do so, this adds a flag to just bail out of the build script and not build any native crate if LZ4_SYS_DELEGATE_LINKING is set in the environment. --- lz4-sys/build.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lz4-sys/build.rs b/lz4-sys/build.rs index bd591adaa..521db6006 100644 --- a/lz4-sys/build.rs +++ b/lz4-sys/build.rs @@ -5,6 +5,14 @@ use std::error::Error; use std::path::PathBuf; fn main() { + let k = "LZ4_SYS_DELEGATE_LINKING"; + + println!("cargo:rerun-if-env-changed={}", k); + + if env::var(k).is_ok() { + return; + } + match run() { Ok(()) => (), Err(err) => {