Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add openharmony platform #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boring-sys/build/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) struct Config {
pub(crate) target: String,
pub(crate) target_arch: String,
pub(crate) target_os: String,
pub(crate) target_env: String,
pub(crate) features: Features,
pub(crate) env: Env,
}
Expand Down Expand Up @@ -44,6 +45,7 @@ impl Config {
let target = env::var("TARGET").unwrap();
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();

let features = Features::from_env();
let env = Env::from_env(
Expand All @@ -65,6 +67,7 @@ impl Config {
target,
target_arch,
target_os,
target_env,
features,
env,
};
Expand Down
11 changes: 11 additions & 0 deletions boring-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,17 @@ fn main() {
builder = builder
.clang_arg("--sysroot")
.clang_arg(sysroot.display().to_string());

let c_target = format!(
"{}-{}-{}",
&config.target_arch, &config.target_os, &config.target_env
);

// we need to add special platform header file with env for support cross building
let header = format!("{}/usr/include/{}", sysroot.display().to_string(), c_target);
if PathBuf::from(&header).is_dir() {
builder = builder.clang_arg("-I").clang_arg(&header);
}
}

let headers = [
Expand Down
4 changes: 3 additions & 1 deletion boring/src/asn1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ impl Asn1Time {
ffi::init();

unsafe {
let handle = cvt_p(ffi::ASN1_TIME_set(ptr::null_mut(), time))?;
// for higher musl version, need to convert i32 to i64
// https://github.com/rust-lang/libc/issues/1848
let handle = cvt_p(ffi::ASN1_TIME_set(ptr::null_mut(), time.into()))?;
Ok(Asn1Time::from_ptr(handle))
}
}
Expand Down