[Android] [PATCH 7/7] src: Enforce x86 build checking as well

Edward Wang edward.c.wang at compdigitec.com
Sun Jul 15 22:27:34 CEST 2012


---
 vlc-android/src/org/videolan/vlc/Util.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index ba0f315..8ab20c5 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -220,12 +220,17 @@ public class Util {
         boolean NO_FPU = properties.getProperty("NO_FPU").equals("1");
         boolean NO_ARMV6 = properties.getProperty("NO_ARMV6").equals("1");
         boolean hasNeon = false, hasFpu = false, hasArmV6 = false, hasArmV7 = false;
+        boolean hasX86 = false;
 
         try {
             FileReader fileReader = new FileReader("/proc/cpuinfo");
             BufferedReader br = new BufferedReader(fileReader);
             String line;
             while((line = br.readLine()) != null) {
+                if(!hasX86 && line.contains("vendor_id")) {
+                    hasX86 = true;
+                    break;
+                }
                 if(!hasNeon && line.contains("neon"))
                     hasNeon = true;
                 if(!hasArmV7 && line.contains("ARMv7")) {
@@ -245,6 +250,13 @@ public class Util {
             return false;
         }
 
+        // Enforce proper architecture to prevent problems
+        if(ANDROID_ABI.equals("x86") && !hasX86) {
+            errorMsg = "x86 build on non-x86 device";
+            isCompatible = false;
+            return false;
+        }
+
         if(ANDROID_ABI.equals("armeabi-v7a") && !hasArmV7) {
             errorMsg = "ARMv7 build on non-ARMv7 device";
             isCompatible = false;
@@ -261,10 +273,12 @@ public class Util {
                 return false;
             }
         }
-        if(!NO_NEON && !hasNeon) {
-            errorMsg = "NEON build on non-NEON device";
-            isCompatible = false;
-            return false;
+        if(ANDROID_ABI.equals("armeabi") || ANDROID_ABI.equals("armeabi-v7a")) {
+            if(!NO_NEON && !hasNeon) {
+                errorMsg = "NEON build on non-NEON device";
+                isCompatible = false;
+                return false;
+            }
         }
         errorMsg = null;
         isCompatible = true;
-- 
1.7.5.4



More information about the Android mailing list