Difference between revisions of "Compiling using MSYS"

From OdaWiki
m (Compiling using MinGW moved to Compiling using MSYS)
(Step 1: Getting MSYS)
 
(9 intermediate revisions by the same user not shown)
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.
 
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==
+
==Before you compile...==
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.
+
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 2: Setting up the Compiler==
+
===Step 1: Getting MSYS===
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 can download MSYS from [http://www.mingw.org/download.shtml this website].  Download the .exe version, and install it to its default directory.
 +
 
 +
===Step 2: Setting up the Compiler===
 +
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
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===
 +
[[Required Libraries]]
  
==Step 3: 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'''.
For ODAMEX to successfully compile, you must obtain some libraries for it, which are:
+
  
*[http://www.libsdl.org/download-1.2.php SDL Development Libraries]
+
===Step 4: Set up PATH variable===
*[http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer Development Libraries]
+
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.
 +
<pre>;C:\MinGW\bin\;C:\MSYS\1.0\bin</pre>
 +
* OK your way out of all dialog boxes.
  
Copy the include and lib folders from the archives and paste them into your C:\MinGW directory.
+
====Windows 9x/Me====
  
==Step 4: Unpack Files==
+
==Compiling in a nutshell==
- Untar <b>ALL MinGW</b> files from the archives you just downloaded into a single directory, then right click on <i>My Computer->Properties->Go to Advanced Tab->Environment Variables->System Variables</i> and scroll down till you find the Path variable, click edit and add the following line:<BR>
+
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:
<BR>
+
<B>;drive:\mingwdir\bin</B><BR>
+
<BR>
+
drive:\ being the drive you installed mingw to (eg c:\)<BR>
+
mingwdir is self-explanatory (eg mingw\)<BR>
+
<BR>
+
<b><u>NOTE:</u></b> Include the semi-colon at the start, or else it won't work.
+
<b><u>NOTE:</u></b> In your mingw/bin dir, you should see a file named <b>i386-mingw32-msvc-sdl-config</b>, rename this to <b>sdl-config</b>.
+
  
===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.
+

Latest revision as of 19:16, 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 this website. Download the .exe version, and 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.