[Android] Util: Add MIPS detection

Edward Wang git at videolan.org
Wed Nov 14 03:32:53 CET 2012


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Tue Nov 13 21:32:27 2012 -0500| [53c70f5673e9f593a6010b40c5356a1f65813197] | committer: Edward Wang

Util: Add MIPS detection

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=53c70f5673e9f593a6010b40c5356a1f65813197
---

 vlc-android/src/org/videolan/vlc/Util.java |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 601a58a..b292d10 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -292,7 +292,8 @@ public class Util {
         String ANDROID_ABI = properties.getProperty("ANDROID_ABI");
         boolean NO_FPU = properties.getProperty("NO_FPU","0").equals("1");
         boolean NO_ARMV6 = properties.getProperty("NO_ARMV6","0").equals("1");
-        boolean hasNeon = false, hasFpu = false, hasArmV6 = false, hasArmV7 = false;
+        boolean hasNeon = false, hasFpu = false, hasArmV6 = false,
+                hasArmV7 = false, hasMips = false;
         boolean hasX86 = false;
 
         if(CPU_ABI.equals("x86")) {
@@ -321,7 +322,10 @@ public class Util {
                 // (see kernel sources arch/x86/kernel/cpu/proc.c)
                 if(line.contains("clflush size"))
                     hasX86 = true;
-                // TODO: MIPS - "microsecond timers"; see arch/mips/kernel/proc.c
+                // "microsecond timers" is specific to MIPS.
+                // see arch/mips/kernel/proc.c
+                if(line.contains("microsecond timers"))
+                    hasMips = true;
                 if(!hasNeon && line.contains("neon"))
                     hasNeon = true;
                 if(!hasFpu && line.contains("vfp"))
@@ -346,6 +350,16 @@ public class Util {
             return false;
         }
 
+        if(ANDROID_ABI.equals("mips") && !hasMips) {
+            errorMsg = "MIPS build on non-MIPS device";
+            isCompatible = false;
+            return false;
+        } else if(hasMips && ANDROID_ABI.contains("armeabi")) {
+            errorMsg = "ARM build on MIPS device";
+            isCompatible = false;
+            return false;
+        }
+
         if(ANDROID_ABI.equals("armeabi-v7a") && !hasArmV7) {
             errorMsg = "ARMv7 build on non-ARMv7 device";
             isCompatible = false;



More information about the Android mailing list