Windows Compile Guide (MinGW)
From WarzoneWiki
Contents |
Required software
First, we'll need to start by installing all of the required software. The first of these is the compiler, which in this case is GCC for Windows, also known as MinGW. You can download it and install it manually by collecting the right packages from the MinGW download page. It will probably be easier to use the automated installer though.
Then we'll need to install Bison and Flex. Just choose “Complete package, except sources” downloads for both of those, unless you have a particular reason to choose others.
Now that we've downloaded all of our packages, lets install them.
First start with the MinGW setup. Just select all the defaults until you encounter "Choose components". In that screen select at least (you can select more if you wish) "MinGW base tools", "g++ compiler" and "MinGW Make". Then continue and let the setup download all the required packages and install them.
Now we can install Flex and Bison, just install both of them wherever you want. The default directories will do just fine.
Now if you need to add the directories where you installed MinGW, Flex and Bison to, to your %PATH% environment variable. In Windows 2000 and later you do this by right clicking "My Computer" then select "Properties" -> "Advanced" -> "Environment variables". Now in the subbox called "System variables" you should select "PATH" (or "Path"), click "Edit" (or "Modify" ?) and at the end of that line add ";C:\MinGW\bin;C:\Program Files\GnuWin32\bin" (assuming you installed MinGW into "C:\MinGW" and Flex as well as Bison in "C:\Program Files\GnuWin32").
Getting the source code
You will now need to get the Warzone source code. For this install TortoiseSVN or the Subversion command line client (I'll explain TortoiseSVN here, using the command line client is explained here).
Now, after installing TortoiseSVN, create an empty directory where you want the source code to be downloaded into. Right click that directory and select "SVN Checkout...". In the window that appears enter this for "URL of repository": "http://svn.gna.org/svn/warzone/trunk" (you can replace "http" with "svn" if you wish). Now click "OK" and the source code starts downloading, I suggest you grab a cup of coffee around now (as this might take about 5-10 minutes depending on the quality of your and gna.org's connection).
Setting things up to get ready for compiling
Now download the developer's package, make sure to choose the most recent one that has "mingw32" and "2.1" in its name.
If you want to build the translations (not required) you want the "extras" variant. Otherwise just take the smaller normal file.
You will need 7-Zip (a legally free archiving utility) to extract this file. We will assume you extracted the devpkg to "C:\devpkg" in the following.
In the directory where you extracted the Warzone 2100 sources to, copy makerules\config.mk.tmpl to makerules\config.mk and open the new file for editing (notepad will do just fine). Now uncomment this line:
MODE=debug
(Removing the hash '#' sign will uncomment it).
Now set the DEVDIR line to the path where you extracted the developer's package (replace all backslashes by forward slashes, e.g. '\' should be '/'), and if you encounter any spaces in the path prefix those spaces with a backslash like this '\ '. So with the above path you'd have to use this line:
DEVDIR=C:/devpkg
If you would have extracted the developer's package to "C:\Program Files\Warzone developer package" then your line would have to look like this instead:
DEVDIR=C:/Program\ Files/Warzone\ developer\ package
Lets compile
Now open a command console ("Start" -> "Run" -> "cmd.exe" -> "OK"). Go to the directory where you downloaded the source code
cd /d "X:\directory\where\the warzone source\is found"
In that directory type the following to start compiling:
mingw32-make -f makefile.win32
When this command finishes without error you should have a warzone2100.exe in the "src" directory which you can execute.
Updating to the latest version
You could now try to update to the latest version of warzone by right clicking on the warzone source directory and selecting "SVN Update". When that's finished you can recompile warzone according to the above section.
Sometimes you need to execute this command to make sure that the source tree is cleaned up properly before rebuilding/recompiling:
mingw32-make -f makefile.win32 clean


