@@ -618,28 +618,29 @@ fn maybe_search_include(include_paths: &[PathBuf], header: &str) -> Option<Strin
618618 }
619619}
620620
621- fn link_to_libraries ( statik : bool ) {
621+ fn link_to_libraries ( statik : bool , target_os : & str ) {
622622 let ffmpeg_ty = if statik { "static" } else { "dylib" } ;
623623 for lib in LIBRARIES {
624624 let feat_is_enabled = lib. feature_name ( ) . and_then ( |f| env:: var ( & f) . ok ( ) ) . is_some ( ) ;
625625 if !lib. is_feature || feat_is_enabled {
626626 println ! ( "cargo:rustc-link-lib={}={}" , ffmpeg_ty, lib. name) ;
627627 }
628628 }
629- if env:: var ( "CARGO_FEATURE_BUILD_ZLIB" ) . is_ok ( ) && cfg ! ( target_os = "linux" ) {
629+ if env:: var ( "CARGO_FEATURE_BUILD_ZLIB" ) . is_ok ( ) && target_os == "linux" {
630630 println ! ( "cargo:rustc-link-lib=z" ) ;
631631 }
632632}
633633
634634fn main ( ) {
635635 let statik = env:: var ( "CARGO_FEATURE_STATIC" ) . is_ok ( ) ;
636+ let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
636637
637638 let include_paths: Vec < PathBuf > = if env:: var ( "CARGO_FEATURE_BUILD" ) . is_ok ( ) {
638639 println ! (
639640 "cargo:rustc-link-search=native={}" ,
640641 search( ) . join( "lib" ) . to_string_lossy( )
641642 ) ;
642- link_to_libraries ( statik) ;
643+ link_to_libraries ( statik, & target_os ) ;
643644 if fs:: metadata ( & search ( ) . join ( "lib" ) . join ( "libavutil.a" ) ) . is_err ( ) {
644645 fs:: create_dir_all ( & output ( ) ) . expect ( "failed to create build directory" ) ;
645646 fetch ( ) . unwrap ( ) ;
@@ -676,7 +677,7 @@ fn main() {
676677 "cargo:rustc-link-search=native={}" ,
677678 ffmpeg_dir. join( "lib" ) . to_string_lossy( )
678679 ) ;
679- link_to_libraries ( statik) ;
680+ link_to_libraries ( statik, & target_os ) ;
680681 vec ! [ ffmpeg_dir. join( "include" ) ]
681682 } else if let Some ( paths) = try_vcpkg ( statik) {
682683 // vcpkg doesn't detect the "system" dependencies
@@ -729,7 +730,7 @@ fn main() {
729730 . include_paths
730731 } ;
731732
732- if statik && cfg ! ( target_os = "macos" ) {
733+ if statik && target_os == "macos" {
733734 let frameworks = vec ! [
734735 "AppKit" ,
735736 "AudioToolbox" ,
0 commit comments