Skip to content

Commit

Permalink
Link iconv on macOS via build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Minoru committed Jan 25, 2021
1 parent 3553014 commit 99202f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn main() {
let const_extern_fn_cargo_feature =
env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
let target = env::var("TARGET").unwrap();

if env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
Expand Down Expand Up @@ -82,6 +83,10 @@ fn main() {
}
println!("cargo:rustc-cfg=libc_const_extern_fn");
}

if target.contains("-apple-") {
println!("cargo:rustc-link-lib=iconv");
}
}

fn rustc_minor_nightly() -> Option<(u32, bool)> {
Expand Down
6 changes: 2 additions & 4 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,8 @@ cfg_if! {
if #[cfg(target_os = "l4re")] {
// required libraries for L4Re are linked externally, ATM
} else if #[cfg(feature = "std")] {
// cargo build. Most libraries are already pulled in by libstd dep
#[cfg_attr(
any(target_os = "macos", target_os = "ios"),
link(name = "iconv"))]
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
extern {}
} else if #[cfg(all(target_os = "linux",
target_env = "gnu",
Expand Down

0 comments on commit 99202f7

Please sign in to comment.