emblemparade.com

Notes on Compiling Various C Libraries for the Android NDK

It’s not so easy! You can’t just use the “./configure and make” build system most libraries come with. Instead, at the very least you’re going to have to create your own custom “Android.mk”, which lists the .c files you need and sets up gcc correctly.

Well, that’s the best-case scenario. Some libraries require some minimal patching or other trickery. Here are my notes for some.

SDL 2.0.3

SDL_mixer 2.0.0

libogg 1.3.1

libpng 1.6.9

Pixman 0.32.4

ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS := -DPACKAGE="pixman" -D_USE_MATH_DEFINES -DPIXMAN_NO_TLS -DUSE_X86_MMX -DUSE_SSE2
else
LOCAL_CFLAGS := -DPACKAGE="pixman" -D_USE_MATH_DEFINES -DPIXMAN_NO_TLS -DUSE_ARM_NEON -DUSE_ARM_SIMD
endif
#if defined(USE_ARM_SIMD) || defined(USE_ARM_NEON) || defined(USE_ARM_IWMMXT)
    imp = _pixman_arm_get_implementations (imp);
#else
    imp = _pixman_x86_get_implementations (imp);
#endif
    //imp = _pixman_ppc_get_implementations (imp);
    //imp = _pixman_mips_get_implementations (imp);

Cairo 1.12.16

#ifndef __ANDROID__
struct lconv *locale_data;
#endif
...
#ifndef __ANDROID__
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
#else
decimal_point = ".";
#endif

(I’ve opened a bug about this.)

Lua 5.2.3

#ifdef __ANDROID__
#define getlocaledecpoint() ('.')
#endif

See also this Stack Overflow post.

exceptions4c 3.0.0

SimCList 1.6

Dec 31, 1969, 18:00 CST