首先去https://github.com/yuvi/gas-preprocessor/
下载gas-preprocessor.pl, 然后 复制到 /usr/sbin/目录下(当然, 你可以放在任何目录下, 只要保证--as='/${path}/gas-preprocessor.pl'路径正确)
http://ffmpeg.org/download.html 下载ffmpeg源码, git或者直接下载
终端执行以下指令
#armv7s
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pic --enable-cross-compile --enable-decoder=h264 --enable-libmp3lame \
--arch=arm --disable-asm \
--target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk \
--cpu=cortex-a8 \
--extra-cflags='-arch armv7s -I/Users/khan/Downloads/lame-3.99.5/include ' \
--extra-ldflags='-arch armv7s -L/Users/khan/Downloads/lame-3.99.5/build -lmp3lame -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' \
--prefix=/Users/khan/Downloads/ffmpeg/arm7s.lib
make
make install
make clean
#armv7
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pic --enable-cross-compile --enable-decoder=h264 --enable-libmp3lame \
--disable-asm --arch=arm \
--target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk \
--cpu=cortex-a8 \
--extra-cflags='-arch armv7 -I/Users/khan/Downloads/lame-3.99.5/include ' \
--extra-ldflags='-arch armv7 -L/Users/khan/Downloads/lame-3.99.5/build -lmp3lame -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk' \
--prefix=/Users/khan/Downloads/ffmpeg/arm7.lib
make
make install
make clean
#i686
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-pic --enable-cross-compile --enable-decoder=h264 --enable-libmp3lame \
--disable-asm --arch=i686 --cpu=i686 --disable-armv5te \
--target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk \
--extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/system \
--extra-cflags='-arch i686 -I/Users/khan/Downloads/lame-3.99.5/include ' \
--extra-ldflags='-arch i686 -L/Users/khan/Downloads/lame-3.99.5/build -lmp3lame ' \
--prefix=/Users/khan/Downloads/ffmpeg/i686.lib
make
make install
make clean
--prefix=/Users/khan/Downloads/ffmpeg/i686.lib/里为编译后的目标文件
然后将各个目录下的lib lipo一下 就可以同时在模拟器和各种该指令集的真机上运行了
lipo -create i686.lib/lib/libavcodec.a arm7.lib/lib/libavcodec.a arm7s.lib/lib/libavcodec.a -output build/libavcodec.a
lipo -create i686.lib/lib/libavdevice.a arm7.lib/lib/libavdevice.a arm7s.lib/lib/libavdevice.a -output build/libavdevice.a
lipo -create i686.lib/lib/libavfilter.a arm7.lib/lib/libavfilter.a arm7s.lib/lib/libavfilter.a -output build/libavfilter.a
lipo -create i686.lib/lib/libavformat.a arm7.lib/lib/libavformat.a arm7s.lib/lib/libavformat.a -output build/libavformat.a
lipo -create i686.lib/lib/libavutil.a arm7.lib/lib/libavutil.a arm7s.lib/lib/libavutil.a -output build/libavutil.a
lipo -create i686.lib/lib/libswresample.a arm7.lib/lib/libswresample.a arm7s.lib/lib/libswresample.a -output build/libswresample.a
lipo -create i686.lib/lib/libswscale.a arm7.lib/lib/libswscale.a arm7s.lib/lib/libswscale.a -output build/libswscale.a