Skip to content

Commit

Permalink
fix missing tools bbqsrc#38
Browse files Browse the repository at this point in the history
  • Loading branch information
harryfei committed Mar 13, 2022
1 parent 70733bd commit f01ef58
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,21 @@ fn toolchain_suffix(triple: &str, arch: &str, bin: &str) -> PathBuf {
.collect()
}

fn sysroot_suffix(arch: &str) -> PathBuf {
fn toolchain_bin_suffix(arch: &str, bin: &str) -> PathBuf {
[
"toolchains",
"llvm",
"prebuilt",
arch,
"sysroot"
"bin",
&format!("{}{}", bin, BIN_EXT),
]
.iter()
.collect()
}

fn sysroot_suffix(arch: &str) -> PathBuf {
["toolchains", "llvm", "prebuilt", arch, "sysroot"]
.iter()
.collect()
}
Expand All @@ -82,7 +89,11 @@ pub(crate) fn run(
cargo_manifest: &Path,
bindgen: bool,
) -> std::process::ExitStatus {
let target_ar = Path::new(&ndk_home).join(toolchain_suffix(triple, ARCH, "ar"));
let mut target_ar = ndk_home.join(toolchain_suffix(triple, ARCH, "ar"));
if !target_ar.exists() {
target_ar = ndk_home.join(toolchain_bin_suffix(ARCH, "llvm-ar"));
}

let target_linker = Path::new(&ndk_home).join(clang_suffix(triple, ARCH, platform, ""));
let target_cxx = Path::new(&ndk_home).join(clang_suffix(triple, ARCH, platform, "++"));
let target_sysroot = Path::new(&ndk_home).join(sysroot_suffix(ARCH));
Expand Down Expand Up @@ -136,7 +147,10 @@ pub(crate) fn run(
}

pub(crate) fn strip(ndk_home: &Path, triple: &str, bin_path: &Path) -> std::process::ExitStatus {
let target_strip = Path::new(&ndk_home).join(toolchain_suffix(triple, ARCH, "strip"));
let mut target_strip = ndk_home.join(toolchain_suffix(triple, ARCH, "strip"));
if !target_strip.exists() {
target_strip = ndk_home.join(toolchain_bin_suffix(ARCH, "llvm-strip"));
}

log::debug!("strip: {}", &target_strip.display());

Expand Down

0 comments on commit f01ef58

Please sign in to comment.