Xcode を使わずに iOS 向けのコードをコンパイルする方法

# armv7
clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -c mattn.c
ar mattn-armv7.a mattn.o
ranlib mattn-armv7.a
# i386
clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -c mattn.c
ar mattn-i386.a mattn.o
ranlib mattn-i386.a
# lipo
lipo -create -arch armv7 mattn-armv7.a -arch i386 mattn-i386.a -output mattn.a

こんな感じでできる。簡単。

古い手順は iOS static library cross-compile script. · GitHub にまとまってるけど、最近の Xcode だと微妙に違うのでメモ。