-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workaround for linking against macOS SDK's relocatable dylibs
See rust-lang/cargo#5077 (comment) and rust-lang/rust#127100 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1516>
- Loading branch information
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[cfg(docsrs)] | ||
fn main() {} // prevent linking libraries to avoid documentation failure | ||
|
||
// https://github.com/rust-lang/cargo/issues/5077#issuecomment-1284482987 | ||
#[cfg(not(docsrs))] | ||
fn main() { | ||
#[cfg(target_os = "macos")] | ||
match system_deps::Config::new().probe() { | ||
Ok(deps) => { | ||
let usr = std::path::Path::new("/usr/lib"); | ||
let usr_local = std::path::Path::new("/usr/local/lib"); | ||
for dep in deps.all_link_paths() { | ||
if dep != &usr && dep != &usr_local { | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,{:?}", dep.as_os_str()); | ||
} | ||
} | ||
} | ||
Err(s) => { | ||
println!("cargo:warning={s}"); | ||
std::process::exit(1); | ||
} | ||
} | ||
} |