@@ -38,7 +38,6 @@ fn generate_bindings(defs: Vec<&str>, headerpaths: Vec<PathBuf>) {
38
38
#[ cfg( not( feature = "bindgen" ) ) ]
39
39
fn generate_bindings ( _: Vec < & str > , _: Vec < PathBuf > ) { }
40
40
41
- #[ cfg( feature = "pkg-config" ) ]
42
41
fn pkg_config ( ) -> ( Vec < & ' static str > , Vec < PathBuf > ) {
43
42
let library = pkg_config:: Config :: new ( )
44
43
. statik ( true )
@@ -48,11 +47,6 @@ fn pkg_config() -> (Vec<&'static str>, Vec<PathBuf>) {
48
47
( vec ! [ "PKG_CONFIG" ] , library. include_paths )
49
48
}
50
49
51
- #[ cfg( not( feature = "pkg-config" ) ) ]
52
- fn pkg_config ( ) -> ( Vec < & ' static str > , Vec < PathBuf > ) {
53
- unimplemented ! ( )
54
- }
55
-
56
50
#[ cfg( not( feature = "legacy" ) ) ]
57
51
fn set_legacy ( _config : & mut cc:: Build ) { }
58
52
@@ -217,6 +211,9 @@ fn compile_zstd() {
217
211
}
218
212
219
213
fn main ( ) {
214
+ #[ cfg( not( feature = "non-cargo" ) ) ]
215
+ println ! ( "cargo:rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG" ) ;
216
+
220
217
let target_arch =
221
218
std:: env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap_or_default ( ) ;
222
219
let target_os = std:: env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap_or_default ( ) ;
@@ -226,7 +223,9 @@ fn main() {
226
223
}
227
224
228
225
// println!("cargo:rustc-link-lib=zstd");
229
- let ( defs, headerpaths) = if cfg ! ( feature = "pkg-config" ) {
226
+ let ( defs, headerpaths) = if cfg ! ( feature = "pkg-config" )
227
+ || env:: var_os ( "ZSTD_SYS_USE_PKG_CONFIG" ) . is_some ( )
228
+ {
230
229
pkg_config ( )
231
230
} else {
232
231
if !Path :: new ( "zstd/lib" ) . exists ( ) {
0 commit comments