Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong><em>UPDATED:</em></strong> Completely changed the answer to use the script that I use.</p> <p>You will also need to download <code>gas-preprocessor.pl</code> from <code>https://github.com/yuvi/gas-preprocessor</code>, put it in your path and make it executable.</p> <p>Then create a script (say <code>make_for_iphone.sh</code>) and put this in it:</p> <pre><code>export PLATFORM="iPhoneOS" export MIN_VERSION="4.0" export MAX_VERSION="5.0" export DEVROOT=/Developer/Platforms/${PLATFORM}.platform/Developer export SDKROOT=$DEVROOT/SDKs/${PLATFORM}${MAX_VERSION}.sdk export CC=$DEVROOT/usr/bin/llvm-gcc export LD=$DEVROOT/usr/bin/ld export CPP=$DEVROOT/usr/bin/cpp export CXX=$DEVROOT/usr/bin/llvm-g++ export AR=$DEVROOT/usr/bin/ar export LIBTOOL=$DEVROOT/usr/bin/libtool export NM=$DEVROOT/usr/bin/nm export CXXCPP=$DEVROOT/usr/bin/cpp export RANLIB=$DEVROOT/usr/bin/ranlib COMMONFLAGS="-pipe -gdwarf-2 -no-cpp-precomp -isysroot ${SDKROOT} -marm -fPIC" export LDFLAGS="${COMMONFLAGS} -fPIC" export CFLAGS="${COMMONFLAGS} -fvisibility=hidden" export CXXFLAGS="${COMMONFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden" FFMPEG_LIBS="libavcodec libavdevice libavformat libavutil libswscale" echo "Building armv6..." make clean ./configure \ --cpu=arm1176jzf-s \ --extra-cflags='-arch armv6 -miphoneos-version-min=${MIN_VERSION} -mthumb' \ --extra-ldflags='-arch armv6 -miphoneos-version-min=${MIN_VERSION}' \ --enable-cross-compile \ --arch=arm \ --target-os=darwin \ --cc=${CC} \ --sysroot=${SDKROOT} \ --prefix=installed \ --disable-network \ --disable-decoders \ --disable-muxers \ --disable-demuxers \ --disable-devices \ --disable-parsers \ --disable-encoders \ --disable-protocols \ --disable-filters \ --disable-bsfs \ --enable-decoder=h264 \ --enable-decoder=svq3 \ --enable-gpl \ --enable-pic \ --disable-doc perl -pi -e 's/HAVE_INLINE_ASM 1/HAVE_INLINE_ASM 0/' config.h make -j3 mkdir -p build.armv6 for i in ${FFMPEG_LIBS}; do cp ./$i/$i.a ./build.armv6/; done echo "Building armv7..." make clean ./configure \ --cpu=cortex-a8 \ --extra-cflags='-arch armv7 -miphoneos-version-min=${MIN_VERSION} -mthumb' \ --extra-ldflags='-arch armv7 -miphoneos-version-min=${MIN_VERSION}' \ --enable-cross-compile \ --arch=arm \ --target-os=darwin \ --cc=${CC} \ --sysroot=${SDKROOT} \ --prefix=installed \ --disable-network \ --disable-decoders \ --disable-muxers \ --disable-demuxers \ --disable-devices \ --disable-parsers \ --disable-encoders \ --disable-protocols \ --disable-filters \ --disable-bsfs \ --enable-decoder=h264 \ --enable-decoder=svq3 \ --enable-gpl \ --enable-pic \ --disable-doc perl -pi -e 's/HAVE_INLINE_ASM 1/HAVE_INLINE_ASM 0/' config.h make -j3 mkdir -p build.armv7 for i in ${FFMPEG_LIBS}; do cp ./$i/$i.a ./build.armv7/; done mkdir -p build.universal for i in ${FFMPEG_LIBS}; do lipo -create ./build.armv7/$i.a ./build.armv6/$i.a -output ./build.universal/$i.a; done for i in ${FFMPEG_LIBS}; do cp ./build.universal/$i.a ./$i/$i.a; done make install </code></pre> <p>This compiles both armv6 and armv7 versions and puts them into a fat library using <code>lipo</code>. It installs to a folder underneath where you run the script from called <code>installed</code>.</p> <p>Note that at the moment I've had to turn off inline assembly using a <code>perl</code> inline replace to change <code>HAVE_INLINE_ASM</code> from <code>1</code> to <code>0</code>. This is because of this problem with <code>gas-preprocessor.pl</code> - <a href="https://github.com/yuvi/gas-preprocessor/issues/16" rel="noreferrer">https://github.com/yuvi/gas-preprocessor/issues/16</a>.</p> <p>Also note that this has turned off all encoders, decoders, muxers, demuxers, etc except for the H264 decoder. Just change the configure lines to compile what you want for your use case.</p> <p>Please remember also that this has enabled GPL code - so you should be aware about what that means for iPhone apps. If you're not aware then you should do some reading about that.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload