Permalink
Browse files

Scripts for include x264

  • Loading branch information...
gabriel committed Apr 3, 2010
1 parent 08d8fc8 commit f264fc46835cbffea7c254b86fb53b4791a35cf3
Showing with 389 additions and 26 deletions.
  1. +23 −6 README → README.md
  2. +16 −5 build-armv6
  3. +16 −8 build-armv7
  4. +18 −7 build-i386
  5. +16 −0 build-x264-armv6
  6. +18 −0 build-x264-i386
  7. +5 −0 combine-libs
  8. +24 −0 combine-x264-libs
  9. +253 −0 gas-preprocessor.pl
View
@@ -1,6 +1,23 @@
Build scripts for ffmpeg on iPhone SDK 3.0 (and iPhone Simulator SDK).
-You'll need to get the latest gas-preprocessor and install it in /usr/local/bin or some other directory in your $PATH via http://github.com/yuvi/gas-preprocessor/
+=== Scripts
+
+- `build-[arch]`: Build scripts for each arch; Run these first and then `combine-ffmpeg-libs`
+- `combine-libs`: Creates universal binaries; Runs lipo -create on each of the ffmpeg static libs
+
+- `build-x264-[arch]`: x264 build scripts for each arch; Run these before normal build script to include x264 support
+- `combine-x264-libs`: Creates universal binaries; Runs lipo -create on each of the x264 static libs
+
+=== Revision
+
+The current ffmpeg trunk doesn't build with arm, so had to go back to r22404 in order to build arm targets. The i386 build does work on trunk (r22610) when I tried last.
+
+The changes that broke compilation are from:
+http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=af29d08a05d35c3b74e48d5f6c5cd56f1770eeca
+
+The gas-preprocessor breaks because of nested macros in arm/asm.S; I believe there are other issues as well though.
+
+=== Background
For background, follow this thread:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/076618.html
@@ -9,11 +26,11 @@ To make lipo'able libraries, you need to use gcc-4.2 with extra cflags instead o
The armv6 arch doesn't seem to be working properly so you can force building via armv7 on your 3GS until we figure that out.
-The combine-ffmpeg-libs script will call lipo -create on each of the static libs.
+=== X264
-The current ffmpeg trunk doesn't build with arm, so had to go back to r22404 in order to build arm targets. The i386 build does work on trunk (r22610) when I tried last.
+For x264 support in ffmpeg, run those build scripts first, and the ffmpeg build scripts will include it.
-The changes that broke compilation are from:
-http://git.ffmpeg.org/?p=ffmpeg;a=commitdiff;h=af29d08a05d35c3b74e48d5f6c5cd56f1770eeca
+=== Gas preprocessor
+
+Uses a modified gas preprocessor via http://github.com/yuvi/gas-preprocessor/
-The gas-preprocessor breaks because of nested macros in arm/asm.S; I believe there are other issues as well though.
View
@@ -2,16 +2,27 @@
trap exit ERR
-DIR=ffmpeg-armv6
-CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+FFMPEG_DIR=ffmpeg-armv6
+SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
-svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $DIR
+svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $FFMPEG_DIR
-cd $DIR
+cd $FFMPEG_DIR
mkdir -p dist
+# Default configure options
+CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+
+# Add x264 if we built that
+X264_DIST="$SCRIPT_DIR/x264-armv6/dist"
+if [ -d "$X264_DIST" ]; then
+ CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libx264 --extra-ldflags=-L$X264_DIST/lib --extra-cflags=-I$X264_DIST/include"
+fi
+
+echo "Configure options: $CONFIGURE_OPTIONS"
+
./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --prefix="dist" --enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s --extra-cflags='-arch armv6' --extra-ldflags='-arch armv6' $CONFIGURE_OPTIONS
make && make install
-echo "Installed: $DIR/dist"
+echo "Installed: $FFMPEG_DIR/dist"
View
@@ -2,19 +2,27 @@
trap exit ERR
-DIR=ffmpeg-armv7
-CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+FFMPEG_DIR=ffmpeg-armv7
+SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
-# -r22274
-svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $DIR
+svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $FFMPEG_DIR
-cd $DIR
+cd $FFMPEG_DIR
mkdir -p dist
-# ./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --prefix="dist" --enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic --enable-gpl --enable-postproc --enable-swscale
+# Default configure options
+CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+
+# Add x264 if we built that
+X264_DIST="$SCRIPT_DIR/x264-i386/dist"
+if [ -d "$X264_DIST" ]; then
+ CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libx264 --extra-ldflags=-L$X264_DIST/lib --extra-cflags=-I$X264_DIST/include"
+fi
+
+echo "Configure options: $CONFIGURE_OPTIONS"
-./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --prefix="dist" --enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --enable-pic $CONFIGURE_OPTIONS
+./configure --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 --as="$SCRIPT_DIR/gas-preprocessor.pl /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2" --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --prefix="dist" --enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --extra-cflags="-arch armv7" --extra-ldflags="-arch armv7" --enable-pic $CONFIGURE_OPTIONS
make && make install
-echo "Installed: $DIR/dist"
+echo "Installed: $FFMPEG_DIR/dist"
View
@@ -2,17 +2,28 @@
trap exit ERR
-DIR=ffmpeg-i386
-CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+FFMPEG_DIR=ffmpeg-i386
+SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
-# Works at r22610 as well
-svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $DIR
+# Build at 22403 to be consistent with arm builds, tho also works at trunk when I tested (r22610)
+svn co -r22403 svn://svn.ffmpeg.org/ffmpeg/trunk $FFMPEG_DIR
-cd $DIR
+cd $FFMPEG_DIR
mkdir -p dist
-./configure --cc=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1 --as='gas-preprocessor.pl /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk --extra-cflags="-mdynamic-no-pic" --prefix="dist" $CONFIGURE_OPTIONS
+# Default configure options
+CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
+
+# Add x264 if we built that
+X264_DIST="$SCRIPT_DIR/x264-i386/dist"
+if [ -d "$X264_DIST" ]; then
+ CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libx264 --extra-ldflags=-L$X264_DIST/lib --extra-cflags=-I$X264_DIST/include"
+fi
+
+echo "Configure options: $CONFIGURE_OPTIONS"
+
+./configure --cc=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1 --as="$SCRIPT_DIR/gas-preprocessor.pl /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1" --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk --extra-cflags="-mdynamic-no-pic" --prefix="dist" $CONFIGURE_OPTIONS
make && make install
-echo "Installed: $DIR/dist"
+echo "Installed: $FFMPEG_DIR/dist"
View
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+trap exit ERR
+
+DIR=x264-armv6
+
+git clone git://git.videolan.org/x264.git $DIR
+
+cd $DIR
+mkdir -p dist
+
+CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 ./configure --host=arm-apple-darwin --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --prefix='dist' --extra-cflags='-arch armv6' --extra-ldflags='-arch armv6' --enable-pic --disable-asm
+
+make && make install
+
+echo "Installed: $DIR/dist"
View
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+trap exit ERR
+
+DIR=x264-i386
+
+git clone git://git.videolan.org/x264.git $DIR
+
+cd $DIR
+mkdir -p dist
+
+CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1 ./configure --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk --prefix='dist'
+
+make && make install
+
+echo "Installed: $DIR/dist"
+
+
View
@@ -7,6 +7,7 @@ BUILD_LIBS="libavcodec.a libavdevice.a libavfilter.a libavformat.a libavutil.a l
OUTPUT_DIR="ffmpeg-uarch"
mkdir -p $OUTPUT_DIR/lib
mkdir -p $OUTPUT_DIR/include
+mkdir -p $OUTPUT_DIR/share
for LIB in $BUILD_LIBS; do
LIPO_CREATE=""
@@ -16,8 +17,12 @@ for LIB in $BUILD_LIBS; do
OUTPUT="$OUTPUT_DIR/lib/$LIB"
echo "Creating: $OUTPUT"
lipo -create $LIPO_CREATE -output $OUTPUT
+ lipo -info $OUTPUT
done
echo "Copying headers from ffmpeg-i386..."
cp -R ffmpeg-i386/dist/include/* $OUTPUT_DIR/include
+echo "Copying share from ffmpeg-i386..."
+cp -R ffmpeg-i386/dist/share/* $OUTPUT_DIR/share
+
View
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+ARCHS="armv6 armv7 i386"
+
+BUILD_LIBS="libx264.a"
+
+OUTPUT_DIR="x264-uarch"
+mkdir -p $OUTPUT_DIR/lib
+mkdir -p $OUTPUT_DIR/include
+
+for LIB in $BUILD_LIBS; do
+ LIPO_CREATE=""
+ for ARCH in $ARCHS; do
+ LIPO_CREATE="$LIPO_CREATE-arch $ARCH x264-$ARCH/dist/lib/$LIB "
+ done
+ OUTPUT="$OUTPUT_DIR/lib/$LIB"
+ echo "Creating: $OUTPUT"
+ lipo -create $LIPO_CREATE -output $OUTPUT
+ lipo -info $OUTPUT
+done
+
+echo "Copying headers from x264-i386..."
+cp -R x264-i386/dist/include/* $OUTPUT_DIR/include
+
Oops, something went wrong.

0 comments on commit f264fc4

Please sign in to comment.