Compiling from SVN for DOS on Win32
 
If you want the very latest version of FreeBASIC on DOS, it can be compiled using DJGPP on a Win32 system. Most users should stay with the stable DOS build! But the latest additions and corrections are available in this way. These instructions describe how to cross-compile the DOS compiler using a Win32 build of fbc.

Setting up the DJGPP environment
Making the FreeBASIC executable and libraries
Updating the installed FreeBASIC software
Setting up the DJGPP environment

Install the packages for DJGPP

The packages you will need can be found on the Getting djgpp page at http://www.delorie.com/djgpp/getting.html from the /current/ directory. These should be installed or extracted to C:\DJGPP
      • autoconf (acnf*.zip)
      • automake (amak*.zip)
      • binutils (bnu*.zip)
      • bash (bsh*.zip)
      • djdev (djdev*.zip)
      • fileutils (fil*.zip)
      • gcc (gcc*.zip)
      • gpp (gpp*.zip)
      • grep (grep*.zip)
      • awk (gwk*.zip)
      • m4 (m4*.zip)
      • make (mak*.zip)
      • perl (perl*.zip)
      • sed (sed*.zip)
      • shellutils (shl*.zip)
      • textutils (txt*.zip)
Follow the DJGPP instructions to set up a standard DJGPP installation. Be careful to set your PATH environment variable in such a way that the DJGPP bin directory is earlier in the path than other compilers (like MinGW). You will also need a Win32 make program and the latest Win32 build of fbc; when using these while building the compiler, they should come before the DJGPP bin directory in the PATH. It is recommended that you create a batch file to set the DJGPP and PATH environment variables so that they are only set when using DJGPP.

Add other necessary files and packages

You will need SVN for Win32 to download the latest FreeBASIC code. At the time of writing, the latest version of SVN can be retrieved from: http://subversion.tigris.org/files/documents/15/36797/svn-1.4.3-setup.exe . Run the setup program and ensure the installation directory is in your PATH

Add the FreeBASIC program

(For the following steps, you will need to type these commands into a Win32 command prompt.)
You will need the latest version of FreeBASIC for Win32 in order to compile fbc.exe. This next step will assume that you have it installed in C:\Program Files\FreeBASIC

Open up a DJGPP command prompt and in it, type the following commands to copy FreeBASIC into the /FBbin directory:
bash
mkdir /FBbin
cp -prv "/dev/c/Program Files/FreeBASIC"/* /FBbin

In order for the shell to be able to find FreeBASIC, you will need to add it to the PATH environment variable. Type the following command:
export PATH="/FBbin:$PATH
This adds the /FBbin directory to the PATH environment variable for this session only.

Making the FreeBASIC executable and libraries

(For the following steps, you will need to type these commands at a DJGPP bash prompt unless noted otherwise.)

Download the FreeBASIC sources

For the latest source code, you will need to download it from SourceForge using SVN.

mkdir /fbcSVN
cd ~/fbcSVN
svn co https://fbc.svn.sourceforge.net/svnroot/fbc/trunk/FreeBASIC

Make rtlib
Make sure you are using the DJGPP tools (execute gcc -v and look for "Target: djgpp").

cd ~/fbcSVN/FreeBASIC/src/rtlib/obj/dos
../../configure
make

Make gfxlib
Make sure you are using the DJGPP tools (execute gcc -v and look for "Target: djgpp").

cd ~/fbcSVN/FreeBASIC/src/gfxlib2/obj/dos
../../configure
make

Make fbc
Make sure you are using the DJGPP tools (execute gcc -v and look for "Target: djgpp").

cd ~/fbcSVN/FreeBASIC/src/compiler/obj/dos
../../configure --enable-standalone

Now switch to a Win32 command prompt and make sure you are using the Win32 versions of fbc and make (execute fbc -version and make -v to check).

cd \fbSVN\FreeBASIC\src\compiler\obj\dos
make FB_BFD=1 BFD_VER=217

Updating the installed FreeBASIC software

The following steps will update the copy of FreeBASIC you installed in /FBbin. (Again, the commands should be typed at a DJGPP bash prompt.)

Replace the old .bi files with the new ones from the source folder

rm -rfv /FBbin/inc/*
cp -prfv ~/fbcSVN/FreeBASIC/inc/* /FBbin/inc

Replace the old compiler and library files with the new ones you've just made

cp -pfv ~/fbcSVN/FreeBASIC/src/compiler/obj/dos/fbc_new.exe /FBbin/fbc.exe
cp -pfv ~/fbcSVN/FreeBASIC/src/rtlib/obj/dos/*.a /FBbin/lib/dos
cp -pfv ~/fbcSVN/FreeBASIC/src/rtlib/obj/dos/fbrt0.o /FBbin/lib/dos
cp -pfv ~/fbcSVN/FreeBASIC/src/gfxlib2/obj/dos/*.a /FBbin/lib/dos

And you're ready to roll! The newest FB is now in \FBbin.

Note: recently it has come to light that although the above often works, there can be chicken-and-egg-related problems. Please see this forum thread for info: http://www.freebasic.net/forum/viewtopic.php?p=32260