Search code examples
androidmupdf

android mupdf for MIPS and x86 arch


im currently using MuPDF in my android application, when i built it from source (based on ReadMe.txt) it's only generate .so file for armeabi and armeabi-v7a but not x86 and MIPS, when i run the app on arm arch devices (Samsung Galaxy Tab 7), it looks good. But not in mips arch. my question is how i can generate x86 and MIPS shared object file? if any other solution, i will appreciate it...

PS: i'm using android ndk r8d, i tried to change with android-ndk-r6b but i got same problem.


Solution

  • If you look in android/jni/Application.mk within the mupdf source you will see a line:

    APP_ABI = armeabi armeabi-v7a
    

    You can make this:

    APP_ABI = armeabi armeabi-v7a x86 mips
    

    or even:

    APP_ABI = all
    

    to enable the other architectures.

    This will cause problems currently as android/jni/Core.mk and android/jni/Core2.mk files define -DARCH_ARM and -DARCH_THUMB (as at the time they were written, Android only supported ARM processors). This needs a bit of magic with the preprocessor:

    ifeq ($(TARGET_ARCH),arm)
    LOCAL_CFLAGS += -DARCH_ARM -DARCH_THUMB -DARCH_ARM_CAN_LOAD_UNALIGNED
    ifdef NDK_PROFILER
    LOCAL_CFLAGS += -pg -DNDK_PROFILER -O2
    endif
    endif
    LOCAL_CFLAGS += -DAA_BITS=8
    

    I will get fixes put in for these - watch our git repo over the next couple of days. EDIT: Fix is now committed.