                      2002/03/05

        VLC for Windows Cross-Compile HOWTO - 0.1

*EASY* VLC cross-compilation using Linux for a Windows client

Bill Eldridge & Gildas Bazin

0) MSYS & mingw
1) Download software packages
2) Unpack sources
3) Configure vlc
4) Make
5) Package for Windows
6) Further resources

0) MSYS & mingw

As of version 1.0.5, the MSYS part of MingW has
released an environment that will let you configure
and compile packages for mingw directly on Windows.

        http://mingw.sourceforge.net

Combined with the SDL & GTK development packages,
this is enough to compile vlc without cross-compiling
on Linux.  However, for those of us who like Linux
and want to cross-compile (say to automate nightly
builds), read on.

1) Download software packages

Download all the software needed to /usr/local/src/VLC -
including pre-compiled mingw32 cross-compiler for linux,
SDL, gtk, directx, and of course vlc.  You will also need
various run-time DLLs on your Windows machine when you go
to run the program.

Go to http://www.videolan.org/vlc/windows.html and download:
- mingw32 cross-compiler for linux: linux-cross-mingw32-10022002.tar.bz2
- SDL-devel-1.2.3-mingw32.tar.gz (you can also go to www.libsdl.org)
- gtk-win32-10022002.tar.bz2 development files.
- the directx 7 headers. (Instead of downloading the whole directx SDK
form Microsoft)

Get vlc from:

        http://www.videolan.org/pub/videolan/vlc/snapshots/

(who needs a release version? you're compiling, after all :)
or grab the cvs at:

        http://developers.videolan.org/cvs.html

using the command:

cvs -d :pserver:anonymous@anoncvs.videolan.org:/var/cvs/videolan -z3 co
vlc

(and no, you don't need to log in, that's why it's "anonymous")

2) Unpack sources

Unpack all your sources to the right place:

[Note that you can put SDL & gtk in a different place,
but then you'll have to edit the sdl-config & gtk-config.
directx can go anywhere - you'll just set that path when
you do vlc's configure]

cd to your Source directory

SRCDIR=`pwd`    # /usr/local/src/VLC seems good, no?

tar -jxvf linux-cross-mingw32-10022002.tar.bz2 -C /usr/local

tar -zxf SDL-devel-1.2.3-mingw32.tar.gz -C /usr/local/cross-tools
cd /usr/local/cross-tools
ln -s i586-mingw32msvc i386-mingw32msvc
tar -xf SDL-1.2.3/i386-mingw32msvc.tgz
rm -rf SDL-1.2.3

cd $SRCDIR
tar xjvf gtk-win32-10022002.tar.bz2 -C /usr/local

mkdir /usr/local/directx
unzip -d /usr/local/directx/include dxheaders.zip

tar -jxf <vlc-snapshot-xxx>.bz2 # Unless you used cvs
cd vlc

3) Configure vlc

rm config.cache config.status
make clean      # or "make distclean" for pretty pretty

PATH=/usr/local/cross-tools/bin:$PATH \
CC=i586-mingw32msvc-gcc \
./configure --host=i586-mingw32msvc \
  --target=i586-mingw32msvc --build=i386-linux \
  --with-directx=/usr/local/directx \
  --with-gtk-config-path=/usr/local/gtk-win32/bin \
  --with-sdl-config-path=/usr/local/cross-tools/i586-mingw32msvc/bin

4) make vlc

PATH=/usr/local/cross-tools/bin:$PATH \
make

5) Package for Windows

mkdir /usr/local/src/winvlc
mkdir /usr/local/src/winvlc/plugins
mkdir /usr/local/src/winvlc/share
cp vlc.exe /usr/local/src/winvlc/
cp plugins/*.so /usr/local/src/winvlc/plugins/
cp share/*.psf /usr/local/src/winvlc/share/
cd /usr/local/src
strip winvlc/vlc.exe winvlc/plugins/*.so
zip -r winvlc.zip winvlc

Now place winvlc in your ftp/html downloads,
or copy to your dos disk or move to a floppy
(only about 270K)

Uncompress to C:\winvlc

Don't forget to place all the GTK and SDL dll's from the development packages
you downloaded on http://www.videolan.org/vlc/windows.html in c:\winvlc

cd c:\winvlc
vlc -v

Note: -v gives you errors in case something's not being found,
otherwise not needed.


6) Further resources (for this or other cross-compilation
projects):

At this time, mingw32_2.95.3.7-3_i386.deb and
mingw32-runtime_1.2-1_i386.deb were at:

http://packages.debian.org/testing/devel/mingw32.html
http://packages.debian.org/testing/devel/mingw32-runtime.html

and possibly on your CD - you might be able to find later
versions, or save bandwidth, if you care.  (Of course we'll
only be testing what we put on the VideoLan website).
While these are "Debian" packages, they work on Redhat
and possibly elsewhere - download dpkg for your system
and do something like:

dpkg -x  mingw32_2.95.3.7-3_i386.deb /tmp/ming
dpkg -x  mingw32-runtime_1.2-1_i386.deb /tmp/ming
mv /tmp/ming/usr /usr/local/cross-tools


Full DX-7 headers, libs & directx.h (the Peter Puck version)
can be found at:

        http://fceultra.sourceforge.net/dev

There are other versions of GTK for Windows available, but
the one provided here has been hacked specifically for VideoLan.