The debian repository at http://apt.arrozcru.org hosts the cross-development toolchain and dependencies used.
1 First add my gpg key to your system
$ gpg --keyserver www.keyserver.net --recv-key 0x25E635F9
$ gpg --export --armor 0x25E635F9 | sudo apt-key add -
[ enter your password ]
2 Now add the repository to your sources.list file
$ echo "deb http://apt.arrozcru.org ./" | sudo tee -a /etc/apt/sources.list
$ echo "deb-src http://apt.arrozcru.org ./" | sudo tee -a /etc/apt/sources.list
3 Now update your package list
$ sudo apt-get update
4 search mingw32 packages
apt-cache search mingw32-
the result is:
mingw32-binutils - Minimalist GNU win32 (cross) binutils
mingw32-runtime - Minimalist GNU win32 (cross) runtime
mingw32-libcloog-ppl - mingw32 libcloog-ppl
mingw32-libfaad2 - mingw32 libfaad2
mingw32-librtmp - mingw32 librtmp
mingw32-libgmp - mingw32 libgmp
mingw32-libtheora - mingw32 libtheora
mingw32-libxvid - mingw32 libxvid
mingw32-bzip2 - mingw32 bzip2
mingw32-libogg - mingw32 libogg
mingw32-polarssl - mingw32 polarssl
mingw32-libopenjpeg - mingw32 libopenjpeg
mingw32-liboil - mingw32 liboil
mingw32-liborc - mingw32 liborc
mingw32-libgsm - mingw32 libgsm
mingw32-libvpx - mingw32 libvpx
mingw32-libx264 - mingw32 libx264
mingw32-libvorbis - mingw32 libvorbis
mingw32-libschroedinger - mingw32 libschroedinger
mingw32-libmp3lame - mingw32 libmp3lame
mingw32-libppl - mingw32 libppl
mingw32-libopencore-amr - mingw32 libopencore-amr
mingw32-libspeex - mingw32 libspeex
mingw32-zlib - mingw32 zlib
mingw32-libmpfr - mingw32 libmpfr
mingw32-libsdl - mingw32 libsdl
mingw32-openssl - mingw32 openssl
5 NULL
6 recompile the cross-toolchain
6.1 create a local directory
$ mkdir cross
$ cd cross
6.2 install necessary compile envionment
$ sudo apt-get install dpkg-dev debhelper autotools-dev libmpfr-dev libgmp3-dev libppl0.10-dev libcloog-ppl-dev libmpc-dev
6.3 recompile and install mingw32-w32api and mingw32-runtime
(should be in the /cross directory)
apt-get source --compile mingw32-w32api
sudo dpkg -i mingw32-w32api*.deb
apt-get source --compile mingw32-runtime
sudo dpkg -i mingw32-runtime*.deb
6.4 recompile and install mingw32-binutils
(should be in the /cross directory)
$ apt-get source --compile mingw32-binutils
$ sudo dpkg -i mingw32-binutils_*.deb
6.5 recompile and install mingw32-gcc-4.4
(should be in the /cross directory)
(it depends on the compilation of mingw32-w32api and mingw32-runtime)
$ apt-get source --compile mingw32-gcc-4.4
$ sudo dpkg -i mingw32-gcc-4.4_*.deb
6.6 test if i686-mingw32-gcc works
i686-mingw32-gcc --version
the result is:
i686-mingw32-gcc (GCC) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6.7 recompile and install mingw32-pthreads and mingw32-directx
(note: they are need by i686-mingw32-gcc to create a win32 execute file)
apt-get source --compile mingw32-pthreads
sudo dpkg -i mingw32-pthreads*.deb
apt-get source --compile mingw32-directx
sudo dpkg -i mingw32-directx*.deb
7 use apt-get to install the rest of the pre-compiled libraries
note: you can also recompile and install the rest libraries as step 6 has done.
7.1
NULL
7.2
sudo apt-get install mingw32-lib*
(those libs include: mingw32-libcloog-ppl mingw32-libfaad2 mingw32-libgmp mingw32-libgsm mingw32-libmp3lame mingw32-libmpfr mingw32-libogg mingw32-liboil mingw32-libopencore-amr mingw32-libopenjpeg mingw32-liborc mingw32-libppl mingw32-libschroedinger mingw32-libsdl mingw32-libspeex mingw32-libtheora mingw32-libvorbis mingw32-libvpx mingw32-libx264 mingw32-libxvid
)
7.3
sudo apt-get install mingw32-bzip2 mingw32-zlib mingw32-polarssl mingw32-openssl
7.4
sudo apt-get install liborc-dev
8 install asm compiler
sudo apt-get install yasm
9 configure
(change to ffmpeg source directory and then execute thus command)
./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i686-mingw32- --extra-libs='-lx264 -lpthread'
or
./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i686-mingw32- --extra-libs='-lx264 -lpthread' --prefix=/usr --enable-gpl --enable-pthreads --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-pthreads
(configure error can be found in config.err or config.log)
10 make
make