Skip to content

Instantly share code, notes, and snippets.

@nddrylliog
Created June 28, 2013 20:28
Show Gist options
  • Save nddrylliog/5887834 to your computer and use it in GitHub Desktop.
Save nddrylliog/5887834 to your computer and use it in GitHub Desktop.
Compiling libfreetype2 for Android

There's a repo to make it easier to use Freetype on Android: cdave1/freetype2-android.

With the ooc conventions for Android packages, jni/freetype2 will be created for ooc-freetype2, and it expects the freetype2 C library to be put in jni/c_freetype2, so let's do just that.

  • Clone freetype2-android
  • cd freetype2-android/Android/jni
  • ndk-build freetype2-static

After that, there is freetype2-android/Android/obj/local/armeabi/libfreetype2-static.a. The headers are in freetype2-android/include/. All we need is to prepare our nice folder like every other C lib we cross-compiled. The folder structure is something like that:

- c_freetype2
  - include
    - (all the includes, copied)
  - lib
    - libfreetype2-static.a (copied)
  - Android.mk

And in the Android.mk we can put something like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := c_freetype2
LOCAL_SRC_FILES := lib/libfreetype2-static.a
include $(PREBUILT_STATIC_LIBRARY)

That should work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment