From 64818cd0d8e5a4f7d9bfabb47ff02d4d5f2d8834 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 29 Mar 2018 03:25:41 -0400 Subject: [PATCH 1/3] Support i686-linux-android target. --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index b844d1b..322a9f9 100644 --- a/build.rs +++ b/build.rs @@ -26,7 +26,7 @@ fn android_main() { "arm64-v8a" } else if target.contains("arm") { "armeabi" - } else if target.contains("x86") { + } else if target.contains("x86") || target.contains("i686") { "x86" } else { panic!("Invalid target architecture {}", target); From cb112f38649d5a458ef1c95605007f02c5e6ac07 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 29 Mar 2018 03:26:02 -0400 Subject: [PATCH 2/3] Set NDK_PROJECT_PATH and use absolute paths. --- build.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 322a9f9..3e3fe91 100644 --- a/build.rs +++ b/build.rs @@ -32,10 +32,11 @@ fn android_main() { panic!("Invalid target architecture {}", target); }; + let src_path = env::var("CARGO_MANIFEST_DIR").unwrap(); + if Command::new(ndk_path.join("ndk-build")) .arg(format!("APP_ABI={}", abi)) - .arg("-C") - .arg("src/jni/") + .env("NDK_PROJECT_PATH", format!("{}/src", src_path)) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .status().unwrap().code().unwrap() != 0 @@ -47,7 +48,7 @@ fn android_main() { let out_dir = env::var("OUT_DIR").ok().expect("Cargo should have set the OUT_DIR environment variable"); if Command::new("cp") - .arg(format!("src/obj/local/{}/libblurdroid.a", abi)) + .arg(format!("{}/src/obj/local/{}/libblurdroid.a", src_path, abi)) .arg(&format!("{}", out_dir)) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) @@ -59,7 +60,7 @@ fn android_main() { if Command::new("mkdir") .arg("-p") - .arg("target/java/classes/") + .arg(&format!("{}/target/java/classes/", out_dir)) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .status().unwrap().code().unwrap() != 0 @@ -68,12 +69,12 @@ fn android_main() { process::exit(1) } - let java_files = fs::read_dir("src/java/hu/uszeged/bluetooth").unwrap().map(|p| p.unwrap().path()).collect::>(); + let java_files = fs::read_dir(format!("{}/src/java/hu/uszeged/bluetooth", src_path)).unwrap().map(|p| p.unwrap().path()).collect::>(); let java_files = java_files.iter().map(|p| p.as_os_str().to_str().unwrap()).collect::>(); if Command::new("javac") .arg("-d") - .arg("target/java/classes/") + .arg(&format!("{}/target/java/classes/", out_dir)) .arg("-cp") .arg(find_android_platform(sdk_path)) .args(java_files.as_slice()) @@ -89,7 +90,7 @@ fn android_main() { .arg("cvf") .arg(&format!("{}/blurdroid.jar", out_dir)) .arg("-C") - .arg("target/java/classes/") + .arg(&format!("{}/target/java/classes/", out_dir)) .arg("hu") .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) From a62859c0901474b6ac4921847a88aa0e74a95c58 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 29 Mar 2018 03:27:00 -0400 Subject: [PATCH 3/3] Bump version. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6100d47..2e0182b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blurdroid" -version = "0.1.4" +version = "0.1.5" description = "Bluetooth lib for Rust using Android's bluedroid" readme = "README.md" authors = ["Attila Dusnoki "]