ffmpeg IOS 模拟器的编译。。。

#!/bin/tcsh -f
set targetDir="./i386"
if (! -d $targetDir ) mkdir $targetDir

rm -f $targetDir/*.a
make clean

./configure \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-ffprobe \
--disable-debug
--disable-yasm \
--disable-armv5te \
--disable-swscale-alpha \
--enable-nonfree \
--enable-gpl \
--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' \
--extra-ldflags='-arch i386 -miphoneos-version-min=4.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk \
--prefix=compiled/i386 \
--target-os=darwin \
--arch=i386 \
--cpu=i386 \
--extra-cflags='-arch i386 -miphoneos-version-min=4.3 -mdynamic-no-pic' \
--disable-asm \
--target-os=darwin \

make

mv libavcodec/libavcodec.a $targetDir
mv libavformat/libavformat.a $targetDir
mv libavutil/libavutil.a $targetDir
mv libswscale/libswscale.a $targetDir

希望各位大牛不吝赐教,详细点,再来些关于--cc,--as,--sysroot之类的解释、、、

编译FFmpeg for iOS 模拟器的过程中,一些参数的含义如下:

  • --cc: 指定编译器的路径,在这里指定为Xcode安装目录下的gcc。
  • --as: 指定汇编器的路径,在这里使用gas-preprocessor.pl脚本来预处理gcc汇编器生成的汇编文件。
  • --sysroot: 指定SDK的安装目录。
  • --extra-cflags: 指定额外的编译选项。在这里指定了-arch i386,表示编译出的代码运行在i386架构的CPU上;-miphoneos-version-min=4.3表示生成的代码至少要支持iOS 4.3及以上的版本;-mdynamic-no-pic表示不使用位置无关代码(Position-Independent Code)。
  • --target-os: 指定目标操作系统,在这里指定为darwin,表示编译出的代码运行在Darwin操作系统(包括Mac OS X和iOS)上。