Building FFmbc for Win32 is best done on Ubuntu - no, honestly. It's easier to cross-compile on Linux than to make the whole compile environment on Windows. So here goes:
Get some tools and libraries
Assuming you're on an Ubuntu 10.04:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
sudo apt-get install autoconf2.13 pkg-config
sudo apt-get install git-core
=== GIT might need access through the SOCKS proxy ===
sudo apt-get install tsocks
Then, when you have to do a `git clone` or a `git pull` do this instead:
tsocks git clone git://
OR
tsocks git pull
== Building libraries ==
Decide and create the place where you are going to do all your building, and set an environment variable so that it is easy to script the install:
export PREFIX=/usr/local/i586-mingw32msvc
mkdir -p $PREFIX/src
sudo install -d $PREFIX/lib
sudo install -d $PREFIX/include
=== pthreads w32-2-8-0 ===
cd $PREFIX/src
wget http://www.mirrorservice.org/sites/sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
tar -zxf pthreads-w32-2-8-0-release.tar.gz
cd pthreads-w32-2-8-0-release/
make CROSS=i586-mingw32msvc- realclean GC-static
sudo /usr/bin/install -m 644 -c libpthreadGC2.a $PREFIX/lib/libpthreadGC2.a
sudo ln -sf $PREFIX/lib/libpthreadGC2.a $PREFIX/lib/libpthread.a
sudo /usr/bin/install -m 644 -c pthread.h $PREFIX/include/pthread.h
sudo /usr/bin/install -m 644 -c sched.h $PREFIX/include/sched.h
=== libxvid-1.2.2 ===
cd $PREFIX/src
wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz
tar -zxf xvidcore-1.2.2.tar.gz
cd xvidcore/build/generic
./configure \
--host=i586-mingw32msvc \
--prefix=$PREFIX
make xvidcore.a
sudo install -m 644 =build/xvidcore.a $PREFIX/lib/libxvidcore.a
sudo install -m 644 ../../src/xvid.h $PREFIX/include/xvid.h
=== zlib-1.2.5 ===
cd $PREFIX/src
wget http://zlib.net/zlib-1.2.5.tar.bz2
tar -jxf zlib-1.2.5.tar.bz2
cd zlib-1.2.5/
AR="/usr/bin/i586-mingw32msvc-ar" \
CC=/usr/bin/i586-mingw32msvc-gcc \
CPP=/usr/bin/i586-mingw32msvc-cpp \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
CXX=/usr/bin/i586-mingw32msvc-g++ \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
PATH=/usr/i586-mingw32msvc/bin:$PATH \
RANLIB=/usr/bin/i586-mingw32msvc-ranlib \
RC=/usr/bin/i586-mingw32msvc-windres \
WINDRES=/usr/bin/i586-mingw32msvc-windres \
./configure \
--prefix=$PREFIX
Edit '''Makefile''' to remove '''-lc''' from '''LDSHAREDLIBC''' on line 42
make
sudo make install
=== libpng-1.5.1 ===
cd $PREFIX/src
Download source viahttp://www.libpng.org/pub/png/libpng.html
tar -zxf libpng-1.5.1.tar.gz
cd libpng-1.5.1/
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
./configure \
--host=i586-mingw32msvc \
--prefix=$PREFIX \
--disable-shared \
--enable-static
make
sudo make install
=== openjpeg_v1_2 ===
cd $PREFIX/src
svn checkout http://openjpeg.googlecode.com/svn/trunk/ openjpeg-trunk
cd openjpeg-trunk
./bootstrap.sh
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared \
--enable-static
cd libopenjpeg
make
sudo make install
=== libogg-1.2.2 ===
cd $PREFIX/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz
tar -zxf libogg-1.2.2.tar.gz
cd libogg-1.2.2
./configure \
--host=i586-mingw32msvc \
--prefix=$PREFIX \
--disable-shared \
--enable-static
make
sudo make install
=== libvorbis-1.3.2 ===
cd $PREFIX/src
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
tar -jxf libvorbis-1.3.2.tar.bz2
cd libvorbis-1.3.2
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared \
--enable-static
make
sudo make install
=== libtheora-1.1.1 ===
cd $PREFIX/src
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar -jxf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared \
--enable-static
make
sudo make install
=== speex-1.2rc1 ===
cd $PREFIX/src
wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
tar -zxf speex-1.2rc1.tar.gz
cd speex-1.2rc1
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared \
--enable-static
make
sudo make install
=== dirac-1.0.2 ===
cd $PREFIX/src
wget http://downloads.sourceforge.net/project/dirac/dirac-codec/Dirac-1.0.2/dirac-1.0.2.tar.gz
tar -zxf dirac-1.0.2.tar.gz
cd dirac-1.0.2
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc
make
sudo make install
=== faac-1.28 ===
cd $PREFIX
wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
tar -zxf faac-1.28.tar.gz
cd faac-1.28
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared
cd libfaac
make
sudo make install
cd ../include
sudo make install
=== libgsm-1.0.13 ===
cd $PREFIX
apt-get source libgsm
cd libgsm-1.0.13
Edit '''Makefile'''
vim Makefile
Add this and comment out any definitions that clash:
AR = /usr/bin/i586-mingw32msvc-ar
ARFLAGS = cr
CC = /usr/bin/i586-mingw32msvc-gcc -ansi -pedantic
CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
CPP = /usr/bin/i586-mingw32msvc-cpp
CPPFLAGS = -I/usr/i586-mingw32msvc/include -I$PREFIX/include
CXX = /usr/bin/i586-mingw32msvc-g++
LD = $(CC)
LDFLAGS = -L/usr/i586-mingw32msvc/lib -L$PREFIX/lib
RANLIB = /usr/bin/i586-mingw32msvc-ranlib
RC = /usr/bin/i586-mingw32msvc-windres
WINDRES = /usr/bin/i586-mingw32msvc-windres
INSTALL_ROOT = $PREFIX
make
it'll '''fail''' with this error
./src/toast.o:toast.c:(.text+0x68b): undefined reference to `_fchmod'
./src/toast.o:toast.c:(.text+0x6c7): undefined reference to `_fchown'
collect2: ld returned 1 exit status
make: *** [bin/toast] Error 1
but never mind, as it's built what we need...
chmod 644 lib/libgsm.a
i586-mingw32msvc-ranlib lib/libgsm.a
sudo /usr/bin/install -c lib/libgsm.a $PREFIX/lib/libgsm.a
sudo /usr/bin/install -d $PREFIX/include/gsm
sudo /usr/bin/install -c inc/gsm.h $PREFIX/include/gsm/gsm.h
=== lame-398-4 ===
cd $PREFIX/src
wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz
tar -zxf lame-3.98.4.tar.gz
cd lame-3.98.4/
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--disable-shared
make
sudo make install
=== libx264 ===
cd $PREFIX/src
git clone git://git.videolan.org/x264.git
cd x264
./configure \
--host=i586-mingw32msvc \
--prefix=$PREFIX \
--cross-prefix=i586-mingw32msvc- \
--extra-cflags='--static -I $PREFIX/include -I /usr/i586-mingw32msvc/include/' \
--extra-ldflags='-static -L $PREFIX/lib -L /usr/i586-mingw32msvc/lib/'
make
sudo make install
=== schroedinger-1.0.10 ===
Schroedinger requires ORC:
cd $PREFIX/src
wget http://code.entropywave.com/download/orc/orc-0.4.14.tar.gz
tar -zxf orc-0.4.14.tar.gz
cd orc-0.4.14/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--enable-static \
--disable-shared
make
sudo make install
When that's complete, make Schro':
cd $PREFIX/src
wget http://diracvideo.org/download/schroedinger/schroedinger-1.0.10.tar.gz
tar -zxf schroedinger-1.0.10.tar.gz
cd schroedinger-1.0.10/
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
CPPFLAGS="-I/usr/i586-mingw32msvc/include -I$PREFIX/include -DPTW32_STATIC_LIB" \
LDFLAGS="-L/usr/i586-mingw32msvc/lib -L$PREFIX/lib" \
LIBS="-lws2_32" \
./configure \
--prefix=$PREFIX \
--host=i586-mingw32msvc \
--enable-static \
--disable-shared \
--with-thread=pthread
make
sudo make install
Edit '''$PREFIX/lib/pkgconfig/schroedinger-1.0.pc''' to add '''-lws2_32''' to '''Libs.private''' line
sudo vim $PREFIX/lib/pkgconfig/schroedinger-1.0.pc
...
Libs.private: -lpthread -lws2_32 -lm
...
=== VPx ===
cd $PREFIX/src
git clone git://review.webmproject.org/libvpx.git
cd libvpx
CROSS=i586-mingw32msvc- \
./configure \
--prefix=$PREFIX \
--target=x86-win32-gcc \
--cpu=i686 \
--disable-shared \
--disable-examples
make verbose=1
sudo make install
== Building FFmbc ==
cd $PREFIX/src
wget http://ffmbc.googlecode.com/files/FFmbc-0.6-rc5.tar.gz
tar -zxf FFmbc-0.6-rc5.tar.gz
cd FFmbc-0.6-rc5
=== Static build ===
==== Configure ====
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
./configure \
--cpu=i686 \
--arch=i686 \
--prefix=$PREFIX \
--target-os=mingw32 \
--enable-memalign-hack \
--cross-prefix=i586-mingw32msvc- \
--extra-cflags='--static -I $PREFIX/include -D_WIN32_WINNT=0x0501' \
--extra-ldflags='-static -L $PREFIX/lib' \
--enable-gpl \
--enable-nonfree \
--enable-pthreads \
--enable-static \
--disable-shared \
--enable-libdirac \
--enable-libfaac \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libxvid \
--enable-libschroedinger \
--enable-libx264 \
--enable-libvpx
Edit '''config.mak''' to remove '''-Werror=missing-prototypes''' from the end of
'''CFLAGS''' line 29
make
sudo make install