Files
mail/platform/ohos/backend/build.rs
T
springmin 8861d4b7f2 ohos: add the OpenHarmony platform host
Tier-3 community port (maintainer: springmin), rebased onto the merged
document-provider abstraction (#84) and the opener seam (#80).

- platform/ohos: Slint backend (XComponent window adapter, software renderer
  with the experimental femtovg/wgpu path, input/IME, clipboard, system
  fonts), the NAPI cdylib that builds a PlatformContext (app-private paths,
  DocumentProvider over the ArkTS pickers, Asset Store credential store,
  loopback OAuth broker, external URL opener, notification publisher) and
  calls flectar_mail::run, the demo crate, the ArkTS shell and the build and
  packaging scripts (bundle name configurable, defaults to
  com.flectar.mail_ohos).
- src/platform/ohos.rs: PDFium directory, renderer name, thread priority,
  preview lifecycle, email font directory; OpenHarmony stays under the
  mobile capability alias.
- patches/fontique + crates/fontique: the Fontconfig opt-out as a patch queue
  applied by the platform/ohos workspace, verified from quality.yml.
- .github/workflows/ohos.yml: manually dispatched tier-3 workflow, unsigned by
  default, signing material only from the FLECTAR_OHOS_* secrets.
- src/documents.rs: run_request blocks the calling thread on mobile hosts;
  the picker covers the window, and keeping the presentation thread idle is
  what OpenHarmony needs (verified on device; desktop keeps the runtime
  request for the native dialog).
- The email renderer and the compose editor load platform::email_font_dir()
  and the Han fallback, so CJK mail bodies and composed text render with the
  platform fonts.
- New-mail notifications: a publisher seam fed by CoreEvent::MailNew; the host
  publishes through @kit.NotificationKit.
2026-10-23 08:42:42 +08:00

33 lines
1.3 KiB
Rust

//! Supplies the OHOS native library search path for the `#[link]` attributes in
//! `ffi.rs` (libace_napi.z.so, libace_ndk.z.so, libnative_window.so,
//! libhilog_ndk.z.so, ...).
//!
//! The SDK location is discovered from the environment so the repository stays
//! free of machine-specific absolute paths. Library locations are only needed
//! for the link step; at run time the app linker namespace resolves the same
//! sonames from the system partitions.
fn main() {
let mut candidates = Vec::new();
if let Ok(sdk_native) = std::env::var("OHOS_SDK_NATIVE") {
candidates.push(format!("{sdk_native}/sysroot/usr/lib/aarch64-linux-ohos"));
}
if let Ok(home) = std::env::var("HOME") {
candidates.push(format!(
"{home}/.harmonybrew/opt/ohos-sdk-native/sysroot/usr/lib/aarch64-linux-ohos"
));
// The versioned Cellar path as a fallback for hosts without `opt` links.
candidates.push(format!(
"{home}/.harmonybrew/Cellar/ohos-sdk-native/26.0.0.18/sysroot/usr/lib/aarch64-linux-ohos"
));
}
for candidate in candidates {
if std::path::Path::new(&candidate).is_dir() {
println!("cargo:rustc-link-search=native={candidate}");
}
}
println!("cargo:rerun-if-env-changed=OHOS_SDK_NATIVE");
}