BuildingFreeTypeForiOS - mattbichay/test GitHub Wiki

Table of Contents

Building FreeType for iOS

The only dependencies libRocket has is on the FreeType library. The library has build configurations for most platforms, but unfortunately not iOS. This document describes how to build libfreetype.a as a universal binary for iOS and the Mac (i386, x86_64, arm6, arm7).

NOTE: You can download a prebuilt version of these libraries from the download section.

Download the Source

Download the latest freetype sourcecode from sourceforge.

Open a terminal and extract the archive:

Compiling the library

We have to compile the library four times, once for each architecture.

i386

This forces configure to use the i386 architecture and build the library. The built library is located at objs/.libs/libfreetype.a. We copy this to our top level folder and build the next architecture.

x86_64

Similar build setup for x86_64, notice the addition of make clean, we want to completely remove the i386 code.

arm6

Arm6 is used on iPhone 3G and earlier. There are quite a few arguments that need to be passed to configure to make it build for arm6. I'm going under the assumption that you're targeting iOS 3.2 using gcc-4.2 as your compiler. If this is not what you want, please update the arguments below accordingly.

arm7

Arm7 is used on iPhone 3GS and newer. We do the exact same options as above, but pass arm7 as the architecture (remember to update the CFLAGS and the LDFLAGS)

Bringing it all together as a universal library

We now have 4 individual libraries. To combine them into a single universal library use the lipo tool.

And thats it.

You can check which architectures are in a library with the -info argument.

⚠️ **GitHub.com Fallback** ⚠️