An updated version of this guide can be found at:

http://www.blender3d.org/cms/Building_with_Cygwin.524.0.html

Introduction
------------

Here are some basic instructions for building
blender for windows using gcc under cygwin.
Please note that the resulting executable does not
depend on cygwin and can be distrubuted to machines
that don't have cygwin installed.

The instructions are:

1. Download cygwin (www.cygwin.com) and use the setup program
   to install packages for gcc, gcc-mingw, gcc-g++, w32api, make, cvs,
   python, perl, gettext, and gettext-devel (and maybe others... the 
   dependency list is bound to change over time and hopefully these 
   instructions will keep up with the changes). All of the following
   commands will be entered at the cygwin prompt so launch
   cygwin now.

2. Create a directory to put your sources and then enter that
   directory, e.g.:
     mkdir bf-blender
     cd bf-blender

   *********WARNING: if the directory path you are in contains a space in
   it you will get errors in trying to compile the code.  Change directorys
   to a one that does not contain a space in the path before creating the
   above directory *********


Please note that a backslash at the end of a line in the following 
means that the command spans two lines. If you wish to type the command as 
one line, exclude the '\'.

3. Checkout the blender module from the bf-blender tree using cvs 
   (use password anonymous):
     cvs -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender login
     cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \
          co blender

4. Checkout the lib/windows module from bf-blender using cvs:
     cvs -z3 -d:pserver:anonymous@cvs.blender.org:/cvsroot/bf-blender \
          co lib/windows

5. Enter the newly created blender directory:
     cd blender

6. To prepare the build system to use only the free tools we must
   set some environment variables. This is done by creating a
   file called "user-def.mk" in the blender directory and
   inserting the following line with notepad or your favorite
   text editor:
       export FREE_WINDOWS=true

   The quickest way to do this though is to issue the following
   command:
      echo 'export FREE_WINDOWS=true' > user-def.mk

7. Time to build... issue the command:
     make

8. Wait for it to finish (there is this mysterious place called 
   'outside' that I am told is nice to go to while waiting for a 
   compile to finish).

9. After it finishes compiling, if you would like to run your freshly compiled
   blender, type make release.  Then change directorys to obj/233.a/ and move
   the zip file to where you want to use it, unzip the file, enter the directory
   and run your brand new blender.


Getting Help
------------
If you have problems, come by #blendercompilers on irc.freenode.net
or post questions to the "Compiling, Libraries, Modules" forum
at www.blender.org. There is also the very useful bf-committers 
mailing list, what you can subscribe to here:

http://www.blender.org/mailman/listinfo/bf-committers
(as a bonus you can get info about the most recent features that
are coming down the pipe ...)

This said, the most common fix to a problem will
probably involve installing an additional cygwin package,
so keep that cygwin setup program close by ...

Some final notes
----------------

- The build will take a long time, even on a fast machine
  (a clean build takes almost an hour on my Athlon 1800+
  based laptop).
- If the build is successful you will find it has created
  the program obj/windows/bin/blender.exe
- The executable generated by gcc will generally be slower
  that an msvc++ generated executable at rendering, but the 
  OpenGL speed should be about the same.
- Sound is disabled
- If you want to clean your sources issue a 'make clean'
  in the top blender directory.
- If you want to update your sources when somebody has
  added a new awesome feature, you will want to go to the
  topmost blender directory and issue the following command:
      cvs -z3 update -P -d
  It would probably be best to clean your sources before
  re-building (see previous note).
- This is a work in progress, so some things may not be working
  right or it may not support all of the cutting edge features.
- Want to make a fancy zipped up blender package to give
  to your buddies? Try "make release" ... read the output
  to find out where the zip file was placed (note: you will
  probably need the zip/unzip packages from cygwin to do
  this).
- You can make a debug executable using 'make debug'. The
  debug executable will be larger and slower that the
  regular executable, but when used with the gnu debugger
  (gdb) it can help debug a blender problem (for example,
  it can locate the line of code that caused blender to
  crash).
