Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set -ex

# On macOS, test with the deployment target set to Rust's minimum:
# https://doc.rust-lang.org/rustc/platform-support/apple-darwin.html#os-version
if [ "$TARGET" = "x86_64-apple-darwin" ]; then
export MACOSX_DEPLOYMENT_TARGET=10.12
fi
if [ "$TARGET" = "aarch64-apple-darwin" ]; then
export MACOSX_DEPLOYMENT_TARGET=11.0
fi

# For musl on CI always use openssl-src dependency and build from there.
if [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then
features="--features static-ssl"
Expand Down
44 changes: 4 additions & 40 deletions curl-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ fn main() {
.status();
}

if target.contains("apple") {
// On (older) OSX we need to link against the clang runtime,
// which is hidden in some non-default path.
//
// More details at https://github.com/alexcrichton/curl-rust/issues/279.
if let Some(path) = macos_link_search_path() {
println!("cargo:rustc-link-lib=clang_rt.osx");
println!("cargo:rustc-link-search={}", path);
}
}

let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let include = dst.join("include");
let build = dst.join("build");
Expand Down Expand Up @@ -408,7 +397,10 @@ fn main() {

if target.contains("-apple-") {
cfg.define("__APPLE__", None)
.define("HAVE_MACH_ABSOLUTE_TIME", None);
.define("HAVE_MACH_ABSOLUTE_TIME", None)
// Rust's `std` provides the necessary symbols since:
// https://github.com/rust-lang/rust/pull/138944
.define("HAVE_BUILTIN_AVAILABLE", None);
} else {
cfg.define("HAVE_CLOCK_GETTIME_MONOTONIC", None)
.define("HAVE_GETTIMEOFDAY", None)
Expand Down Expand Up @@ -576,31 +568,3 @@ fn curl_config_reports_http2() -> bool {

true
}

fn macos_link_search_path() -> Option<String> {
let output = cc::Build::new()
.get_compiler()
.to_command()
.arg("--print-search-dirs")
.output()
.ok()?;
if !output.status.success() {
println!(
"failed to run 'clang --print-search-dirs', continuing without a link search path"
);
return None;
}

let stdout = String::from_utf8_lossy(&output.stdout);
for line in stdout.lines() {
if line.contains("libraries: =") {
let path = line.split('=').nth(1)?;
if !path.is_empty() {
return Some(format!("{}/lib/darwin", path));
}
}
}

println!("failed to determine link search path, continuing without it");
None
}
Loading