diff --git a/Cargo.lock b/Cargo.lock index 0631ae4c6..30f02752b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2973,6 +2973,7 @@ version = "0.0.0-dev.0" dependencies = [ "cc", "tectonic_bridge_graphite2", + "tectonic_cfg_support", "tectonic_dep_support", ] diff --git a/crates/bridge_harfbuzz/Cargo.toml b/crates/bridge_harfbuzz/Cargo.toml index 0bf7d5bc9..b6f9e84ee 100644 --- a/crates/bridge_harfbuzz/Cargo.toml +++ b/crates/bridge_harfbuzz/Cargo.toml @@ -25,6 +25,7 @@ tectonic_bridge_graphite2 = { path = "../bridge_graphite2", version = "0.0.0-dev [build-dependencies] cc = "^1.0.66" tectonic_dep_support = { path = "../dep_support", version = "0.0.0-dev.0" } +tectonic_cfg_support = { path = "../cfg_support", version = "0.0.0-dev.0" } [features] external-harfbuzz = [] @@ -32,3 +33,4 @@ external-harfbuzz = [] [package.metadata.internal_dep_versions] tectonic_bridge_graphite2 = "2722731f9e32c6963fe8c8566a201b33672c5c5a" tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc" +tectonic_cfg_support = "thiscommit:aeRoo7oa" diff --git a/crates/bridge_harfbuzz/build.rs b/crates/bridge_harfbuzz/build.rs index 0a26c8688..71d6841f0 100644 --- a/crates/bridge_harfbuzz/build.rs +++ b/crates/bridge_harfbuzz/build.rs @@ -5,6 +5,8 @@ #[cfg(feature = "external-harfbuzz")] mod inner { + use std::env; + use tectonic_cfg_support::target_cfg; use tectonic_dep_support::{Configuration, Dependency, Spec}; struct HarfbuzzSpec; @@ -39,7 +41,16 @@ mod inner { let mut sep = "cargo:include-path="; + let is_macos_external = + target_cfg!(target_os = "macos") && env::var("CARGO_FEATURE_EXTERNAL_HARFBUZZ").is_ok(); + dep.foreach_include_path(|p| { + // HACK: On macOS, the default brew harfbuzz for some reason points into the harfbuzz + // folder itself, so we need to go up one level to the includes folder. + if is_macos_external && p.ends_with("harfbuzz") { + print!("{}{}", sep, p.parent().unwrap().to_str().unwrap()); + sep = ";"; + } print!("{}{}", sep, p.to_str().unwrap()); sep = ";"; });