Difference between revisions of "Compiling using MSYS"

From OdaWiki
(Windows 2000/XP)
(Step 2: Setting up the Compiler)
Line 8: Line 8:
  
 
===Step 2: Setting up the Compiler===
 
===Step 2: Setting up the Compiler===
You need the latest version of MinGW from [http://www.mingw.org/download.shtml this website].  You need the latest stable versions of the following packages...
+
You need the latest version of MinGW from [http://www.mingw.org/download.shtml the same website].  You need the latest stable versions of the following packages...
 
* mingw-runtime
 
* mingw-runtime
 
* mingw32-make
 
* mingw32-make

Revision as of 19:15, 20 January 2007

This document assumes that you want to use MSYS in order to parse the Windows-based makefile and compile with MinGW. If you don't want to bother downloading an IDE, you've come to the right place.

Before you compile...

Unless you have an IDE, trying to compile a program for Windows is a rather complicated to set up. However, with some initial preperation work, you can have a build environment similar to ones you can get in Linux out of the box.

Step 1: Getting MSYS

You can download MSYS from its website here: MinGW - Minimal SYStem. Install it to its default directory.

Step 2: Setting up the Compiler

You need the latest version of MinGW from the same website. You need the latest stable versions of the following packages...

  • mingw-runtime
  • mingw32-make
  • w32api
  • binutils
  • gcc
  • g++

Download all of them and extract them to C:\MinGW. If you're using Windows and don't have an archiver capable of handling tar.gz files, stop living in the stone age and download 7-Zip. If you are compiling ODAMEX for the purpose of debugging, grab gdb as well.

Step 3: Required Libraries

Required Libraries

In addition to correctly downloading and copying the development libraries, you must do one other task. You will find a file named i386-mingw32-msvc-sdl-config in your C:\MinGW\bin directory. Copy or rename this file to just sdl-config.

Step 4: Set up PATH variable

Now, we need to set up our PATH environment variable to contain the path to the compiler. Without this, the makefile will not be able to find the compiler. How to set up your PATH variable depends on what operating system you're using.

Windows 2000/XP

  • Right click on My Computer and click Properties...
  • Click on the Advanced tab, and then the button that says Environment Variables
  • Under the System Variables section, scroll through the variables and double-click the variable named Path
  • Copy paste the following onto the end of the Variable Value.
;C:\MinGW\bin\;C:\MSYS\1.0\bin
  • OK your way out of all dialog boxes.

Windows 9x/Me

Compiling in a nutshell

Once the environment is set up, compiling using MSYS is relatively painless. Open a command prompt, go to the root directory of the branch that you want to compile and type:

make -f Makefile.win all

This will compile the client, the server and the master, one after another. If you want to compile them one at a time, simply use one of the following commands:

make -f Makefile.win client
make -f Makefile.win server
make -f Makefile.win master

That's it! The binaries should appear in a new subdirectory called bin.