ios编译freetype2备忘

要下载tar格式的,zip的回车不对,confg会有问题
下面是转载别人的
 
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, arm7).

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
$ ./configure CFLAGS="-arch i386"
$ make
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.
$ cp objs/.libs/libfreetype.a libfreetype-i386.a
x86_64
Similar build setup for x86_64, notice the addition of make clean, we want to completely remove the i386 code.
$ ./configure CFLAGS="-arch x86_64";make clean;make
$ cp objs/.libs/libfreetype.a libfreetype-x86_64.a
arm7
Arm7 is used on iPhone 3GS and newer. There are quite a few arguments that need to be passed to configure to make it build for arm7. I'm going under the assumption that you're targeting iOS 5.1 using gcc-4.2 as your compiler. If this is not what you want, please update the arguments below accordingly.
$ ./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc  CFLAGS="-arch armv7 -pipe -mdynamic-no-pic -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=5.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk" CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -miphoneos-version-min=5.1"
$ make clean;make
$ cp objs/.libs/libfreetype.a libfreetype-arm7.a

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.
$ lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-x86_64.a libfreetype-arm7.a
And thats it.
You can check which architectures are in a library with the -info argument.
$ lipo -info libfreetype.a
Architectures in the fat file: libfreetype.a are: armv7 i386 x86_64
Refer to the original text.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值