Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85d46d22 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

Merge "floss: Fix build for arm cross-compiling" am: 7aca3a59

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1859987

Change-Id: Ifb11d61d5a05ce2ce3bfbf802a3c0bedf75795f3
parents f1236ed5 7aca3a59
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,3 +27,4 @@ pkg-config = "0.3.19"
[[bin]]
name = "btclient"
path = "src/main.rs"
build = "build.rs"
+12 −0
Original line number Diff line number Diff line
use pkg_config::Config;

fn main() {
    let target_dir = std::env::var_os("CARGO_TARGET_DIR").unwrap();
    println!("cargo:rustc-link-search=native={}", target_dir.into_string().unwrap());

    // When cross-compiling, pkg-config is looking for dbus at the host libdir instead of the
    // sysroot. Adding this dependency here forces the linker to include the current sysroot's
    // libdir and fixes the build issues.
    Config::new().probe("dbus-1").unwrap();
    println!("cargo:rerun-if-changed=build.rs");
}
+4 −0
Original line number Diff line number Diff line
@@ -25,5 +25,9 @@ serde_json = "1.0"
syslog = "4.0"
tokio = { version = "1.0", features = ["fs", "macros", "rt-multi-thread", "sync"] }

[build-dependencies]
pkg-config = "0.3.19"

[[bin]]
name = "btmanagerd"
build = "build.rs"
+12 −0
Original line number Diff line number Diff line
use pkg_config::Config;

fn main() {
    let target_dir = std::env::var_os("CARGO_TARGET_DIR").unwrap();
    println!("cargo:rustc-link-search=native={}", target_dir.into_string().unwrap());

    // When cross-compiling, pkg-config is looking for dbus at the host libdir instead of the
    // sysroot. Adding this dependency here forces the linker to include the current sysroot's
    // libdir and fixes the build issues.
    Config::new().probe("dbus-1").unwrap();
    println!("cargo:rerun-if-changed=build.rs");
}
+2 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use num_traits::cast::{FromPrimitive, ToPrimitive};
use std::cmp;
use std::fmt::{Debug, Formatter, Result};
use std::mem;
use std::os::raw::c_char;
use std::sync::{Arc, Mutex};
use std::vec::Vec;
use topshim_macros::cb_variant;
@@ -408,7 +409,7 @@ impl BluetoothProperty {
                record.channel = sr.channel;
                let name_len = len - mem::size_of::<BtServiceRecord>();
                record.name.copy_from_slice(
                    &(sr.name.as_bytes().iter().map(|x| *x as i8).collect::<Vec<i8>>())
                    &(sr.name.as_bytes().iter().map(|x| *x as c_char).collect::<Vec<c_char>>())
                        [0..name_len],
                );
            }
Loading