Difference between revisions of "Compiling using MSYS"

From OdaWiki
(Step 3: Required Libraries)
Line 1: Line 1:
{{Cleanup}}
+
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.
  
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.
+
===Step 1: Getting MSYS===
 
+
You can download MSYS from its website here: [http://www.codeblocks.org/ MinGW - Minimal SYStem].  Install it to its default directory.
==Step 1: Getting MSYS==
+
You can download Code::Blocks from its website here: [http://www.codeblocks.org/ MinGW - Minimal SYStem].  It doesn't matter where you install MSYS, but be sure and add MSYS's /bin/ directory to your $PATH$ environment variables, which you can find in System Properties -> Advanced.
+
  
==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 this website].  You need the latest stable versions of the following packages...
 
* mingw-runtime
 
* mingw-runtime
Line 16: Line 16:
 
* g++
 
* 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 [http://www.7-zip.org/ 7-Zip].  If you are compiling ODAMEX for the purpose of debugging, grab gdb as well.
+
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 [http://www.7-zip.org/ 7-Zip].  If you are compiling ODAMEX for the purpose of debugging, grab gdb as well.
  
==Step 3: Required Libraries==
+
===Step 3: Required Libraries===
 
[[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'''.
 
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==
+
===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.
 
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===
+
====Windows 2000/XP====
 
* Right click on My Computer and click Properties...
 
* Right click on My Computer and click Properties...
 
* Click on the Advanced tab, and then the button that says Environment Variables
 
* 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
 
* 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.
 
* Copy paste the following onto the end of the Variable Value.
<pre>;C:\MinGW\bin\</pre>
+
<pre>;C:\MinGW\bin\;C:\MSYS\</pre>
 
* OK your way out of all dialog boxes.
 
* OK your way out of all dialog boxes.
===Windows 9x/Me===
+
====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:
  
===Create a Directory for Code===
+
<pre>make -f Makefile.win all</pre>
- Create a new dir somewhere, right click inside it and click <b>SVN Checkout</b>, type in <b>svn://odamex.net:2000/</b> in the url field and click OK, wait until it says <b>Completed</b> in the Action column of the window.
+
  
===Compile with Makefile===
+
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:
- Open a command prompt and go to your odamex trunk dir and type: <b>make -f Makefile.win all</b>
+
  
<b><u>HINT:</u></b> To get help on the makefile, type <b>make -f Makefile.win help</b>
+
<pre>make -f Makefile.win client
 +
make -f Makefile.win server
 +
make -f Makefile.win master</pre>
  
===Result===
+
That's it!  The binaries should appear in a new subdirectory called bin.
- If all steps were followed correctly, Code::Blocks should output a binary into the /Bin dir of your odamex svn folder.
+

Revision as of 08:45, 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 this 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\
  • 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.