rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

Add support to build for `x86_64-linux-android`

Open secext2022 opened this issue 2 years ago • 0 comments
trafficstars

We need to modify build.rs to build for x86_64-linux-android:

diff '--color=auto' -ru -x Cargo.lock workdir-1/v8-0.75.0/build.rs workdir/v8-0.75.0/build.rs
--- workdir-1/v8-0.75.0/build.rs	2023-08-21 13:43:23.899828209 +0800
+++ workdir/v8-0.75.0/build.rs	2023-08-22 15:10:35.935818835 +0800
@@ -145,7 +145,7 @@
     let clang_base_path = clang_download();
     gn_args.push(format!("clang_base_path={:?}", clang_base_path));
 
-    if cfg!(target_os = "android") && cfg!(target_arch = "aarch64") {
+    if cfg!(target_os = "android") {
       gn_args.push("treat_warnings_as_errors=false".to_string());
     }
   }
@@ -180,9 +180,19 @@
       maybe_install_sysroot("arm64");
       maybe_install_sysroot("amd64");
     };
+    if target_triple == "x86_64-linux-android" {
+      gn_args.push(r#"target_cpu="x64""#.to_string());
+      gn_args.push("use_sysroot=true".to_string());
+      maybe_install_sysroot("amd64");
+    }
 
-    if target_triple == "aarch64-linux-android" {
-      gn_args.push(r#"v8_target_cpu="arm64""#.to_string());
+    if target_triple.contains("android") {
+      if target_triple == "aarch64-linux-android" {
+        gn_args.push(r#"v8_target_cpu="arm64""#.to_string());
+      }
+      if target_triple == "x86_64-linux-android" {
+        gn_args.push(r#"v8_target_cpu="x64""#.to_string());
+      }
       gn_args.push(r#"target_os="android""#.to_string());
 
       gn_args.push("treat_warnings_as_errors=false".to_string());

(https://github.com/fm-elpac/v8-src/tree/v8-0.75)

secext2022 avatar Aug 24 '23 01:08 secext2022