Bohl's Blog

my digital life

building FFmpeg on Windows (8 of n)

Here are the next steps:

  • I created a clone of the FFmpeg-repository on Github. The patches (from the previous posts) are included in the branch "cygicl" - find it here.
  • The tool for automatically creating the VisualStudio-project can be found on CodePlex - find it here.
  • The scripts tweakpaths.sh and iclwrap.sh are included in the branch on Github.

So - here is a script that will execute all tasks in one sweep - i.e. get the git-repository, compile FFmpeg with ICL, tweak the headers so that they work for both x86 and x64, download the VisualStudio-project-generator-tool and run it:

#/bin/sh

if (icl.exe 2>&1 | grep -q "IA-32"); then
    arch="x86_32"
elif (icl.exe 2>&1 | grep -q " Intel(R) 64"); then
    arch="x86_64"
else
    echo "Could not determine whether to use x86_32 or x86_64."
	exit 1
fi

echo "Building for architecture '$arch'"

git clone https://github.com/ptahmose/FFmpeg.git

cd FFmpeg

git checkout cygicl

# need to add the current path so that "iclwrap.sh" is found
PATH=$PATH:$(pwd)
export PATH
./configure --enable-inline-asm --enable-gpl --enable-nonfree --disable-doc --toolchain=cygicl --host-cc=gcc --arch=$arch

sed 's/%define ARCH_X86_32 [0-1]//' < config.asm | sed 's/%define ARCH_X86_64 [0-1]//' > config.asm_out
sed 's/%define HAVE_ALIGNED_STACK [0-1]/%if ARCH_X86_32 == 1\n %define HAVE_ALIGNED_STACK 0\n%elif ARCH_X86_64 == 1\n %define HAVE_ALIGNED_STACK 1\n%endif/' < config.asm_out > config.asm
rm config.asm_out

sed 's/#define ARCH_X86_32 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_32 0\n#elif defined( _M_IX86)\n #define ARCH_X86_32 1\n#endif\n/' < config.h | sed 's/#define ARCH_X86_64 [0-1]/#if defined( _M_X64)\n #define ARCH_X86_64 1\n#elif defined( _M_IX86)\n #define ARCH_X86_64 0\n#endif\n/' > config.h_out
sed 's/#define HAVE_ALIGNED_STACK [0-1]/#if defined( _M_X64)\n #define HAVE_ALIGNED_STACK 1\n#elif defined( _M_IX86)\n #define HAVE_ALIGNED_STACK 0\n#endif\n/' < config.h_out > config.h
rm config.h_out

make --dry-run  --always-make > makelog.txt

make -j "$(grep -c processor /proc/cpuinfo)" 

wget -O MakeVSProject4FFmpeg.exe 'http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=makevsproject4ffmpeg&DownloadId=699890&FileTime=130174523610900000&Build=20602'
chmod +x MakeVSProject4FFmpeg.exe
./MakeVSProject4FFmpeg.exe --projname vsFFmpeg --makefileoutput makelog.txt --parse_includes

make  TARGET_EXEC=tweakpaths.sh fate SAMPLES=/cygdrive/z/fate-suite/  -j "$(grep -c processor /proc/cpuinfo)"

You will have to change the path in the last statement to the folder where your FATE-samples reside. That's it - now you should find a file "vsFFmpeg.vcxproj" in the FFmpeg-folder, which you can open with VisualStudio 2012. It should build without errors (for x86 and x64 in Debug and Release), and the executables should also pass FATE without problems. Nice!

Kommentar schreiben

Loading