This README describe a way to build from a linux PC executable for M$

My favourite distribution is gentoo, so I'm going to go step by step on this.

We need to emerge the 4 packet that build the cross platform factory:
 - xmingw-binutils
 - xmingw-gcc
 - xmingw-w32api
 - xmingw-runtime

xmingw-binutils should be at least the version 2.15.90.0.2

This operation should be made by superuser.

# emerge xmingw-runtime

It seems the g++ is enabled only if you re-emerge xmingw-gcc. So, as bzflag is
written in c++:

# emerge xmingw-gcc

Next operation are available to a non super-user too, so a normal user is the
preferred way.

Add to your path the cross compilation factory directory:

$ export PATH=/opt/xmingw/bin:$PATH

------ c-ares
Get c-ares source, untar them and create a directory where to build the c-ares.
Go to this brand new directory and type:

../c-ares-1.2.1/configure \
--host=i386-mingw32msvc --build=i686-pc-linux-gnu \
--prefix=/opt/xmingw/i386-mingw32msvc
make
make install

Last operation require /opt/xmingw being writeable

------ curl
Get curl source, untar them and create a directory where to build the curl.

There is a bug on curl when trying to detect the c-ares library.
So go to the curl directory and apply the patch to configure.ac

-       LIBS="$LIBS -lcares"
+       AC_CHECK_LIB(cares, ares_cancel)

then run autoconf from the same directory


Go to the directory where to build and type:

../curl-7.14.0/configure --host=i386-mingw32msvc --build=i686-pc-linux-gnu \
--prefix=/opt/xmingw --enable-ares --disable-shared
make
make install

apply the patch to /opt/xmingw/bin/curl-config:

--- curl-config.orig    2005-05-22 22:52:16.000000000 +0200
+++ curl-config 2005-05-22 22:54:56.000000000 +0200
@@ -120,9 +120,9 @@

     --cflags)
                if test "X${prefix}/include" = "X/usr/include"; then
-          echo ""
+          echo "-DBUILDING_LIBCURL"
         else
-          echo "-I${prefix}/include"
+          echo "-I${prefix}/include -DBUILDING_LIBCURL"
         fi
                ;;

Last operations require /opt/xmingw being writeable

------ libSDL
Get libSDL source, untar them and create a directory where to build it.

Get some extra windows file that libSDL needs:
http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
Create a new directory and unpack the directx-devel file here. You'll have an
include directory and a lib directory. Copy all the file from the include
directory into /opt/xmingw/i386-mingw32msvc/include/ . You need su privileges
to do that.


Type
../SDL-1.2.8/configure --host=i386-mingw32msvc --build=i686-pc-linux-gnu \
--prefix=/opt/xmingw

make
make install

------ bzflag
Now, time to get a copy of bzflag, from SVN or from source tarball.

When you have your source tree exploded, go to the root of this tree and:

$ sh autogen.sh

Now create a build directory where you'll generate:

$ mkdir ../distmw
$ cd ../distmw


and configure the build directory to use the cross-factory:

$ ../bzflag/configure --host=i386-mingw32msvc --build=i686-pc-linux-gnu \
     --without-x --enable-debug --disable-plugins --prefix=`pwd`/bindist
$ make
$ make install
