Skip to content

Commit

Permalink
Fix Mac build
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Dec 5, 2024
1 parent 26bd444 commit 85ab2ac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ windows = { version = "0.58.0", features = ["Win32_System_Console", "Win32_Syste
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

[target.'cfg(target_os = "macos")'.build-dependencies]
system-deps = "7"

[dev-dependencies]
pretty_assertions = "1.4.1"
test-case = "3.3.1"
Expand Down Expand Up @@ -79,3 +82,6 @@ pkg-fmt = "tgz"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-v{ version }-mac{ archive-suffix }"
pkg-fmt = "tgz"

[package.metadata.system-deps]
"gstreamer-1.0" = "1.14"
22 changes: 22 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#[cfg(docsrs)]
fn main() {}

#[cfg(not(docsrs))]
fn main() {
println!("cargo:rerun-if-env-changed=MADAMIRU_VERSION");
println!("cargo:rerun-if-changed=assets/windows/manifest.xml");
Expand All @@ -9,4 +13,22 @@ fn main() {
res.set_manifest_file("assets/windows/manifest.xml");
res.compile().unwrap();
}

// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1516
#[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);
}
}
}

0 comments on commit 85ab2ac

Please sign in to comment.