mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
Add workaround for linking against macOS SDK's relocatable dylibs
See https://github.com/rust-lang/cargo/issues/5077#issuecomment-1284482987 and https://github.com/rust-lang/rust/issues/127100 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1538>
This commit is contained in:
parent
a369f9e345
commit
43b0f4ec71
5 changed files with 55 additions and 0 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -513,6 +513,7 @@ dependencies = [
|
||||||
"pango",
|
"pango",
|
||||||
"pangocairo",
|
"pangocairo",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
"system-deps",
|
||||||
"uds",
|
"uds",
|
||||||
"windows",
|
"windows",
|
||||||
"winit",
|
"winit",
|
||||||
|
@ -2413,6 +2414,7 @@ dependencies = [
|
||||||
"gstreamer-pbutils",
|
"gstreamer-pbutils",
|
||||||
"gstreamer-video",
|
"gstreamer-video",
|
||||||
"objc",
|
"objc",
|
||||||
|
"system-deps",
|
||||||
"termion",
|
"termion",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,12 @@ windows = { version = "0.58", features=["Win32_Graphics_Direct3D11",
|
||||||
cocoa = "0.25"
|
cocoa = "0.25"
|
||||||
objc = "0.2.7"
|
objc = "0.2.7"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "macos")'.build-dependencies]
|
||||||
|
system-deps = "7"
|
||||||
|
|
||||||
|
[package.metadata.system-deps]
|
||||||
|
"gstreamer-1.0" = "1.14"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gl_generator = { version = "0.14", optional = true }
|
gl_generator = { version = "0.14", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,22 @@ fn generate_gl_bindings() {}
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
generate_gl_bindings();
|
generate_gl_bindings();
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/cargo/issues/5077#issuecomment-1284482987
|
||||||
|
#[cfg(all(not(docsrs), 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,12 @@ futures = "0.3"
|
||||||
cocoa = "0.25"
|
cocoa = "0.25"
|
||||||
objc = "0.2.7"
|
objc = "0.2.7"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "macos")'.build-dependencies]
|
||||||
|
system-deps = "7"
|
||||||
|
|
||||||
|
[package.metadata.system-deps]
|
||||||
|
"gstreamer-1.0" = "1.14"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "basic-tutorial-13"
|
name = "basic-tutorial-13"
|
||||||
required-features = ["termion"]
|
required-features = ["termion"]
|
||||||
|
|
23
tutorials/build.rs
Normal file
23
tutorials/build.rs
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue