Difference between revisions of "Compiling using MSYS"

From OdaWiki
 
(Step 1: Getting MSYS)
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<b>Overview:</b>
+
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 guide contains information on how to compile
+
Odamex using [http://www.codeblocks.org/ Code::Blocks]
+
  
=Download SVN Utility=
+
==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.
  
- Download [http://tortoisesvn.tigris.org/ tortoisesvn] and <b>install</b>, then <b>restart</b>.
+
===Step 1: Getting MSYS===
 +
You can download MSYS from [http://www.mingw.org/download.shtml this website].  Download the .exe version, and install it to its default directory.
  
=Download MingW Files=
+
===Step 2: Setting up the Compiler===
- Get the following <b>MinGW</b> files:
+
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
 +
* mingw32-make
 +
* w32api
 +
* binutils
 +
* gcc
 +
* g++
  
* [http://prdownloads.sf.net/mingw/gcc-core-3.4.2-20040916-1.tar.gz?download gcc-core-3.4.2-20040916-1.tar.gz]
+
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.
  
* [http://prdownloads.sf.net/mingw/gcc-g++-3.4.2-20040916-1.tar.gz?download gcc-g++-3.4.2-20040916-1.tar.gz]
+
===Step 3: Required Libraries===
 +
[[Required Libraries]]
  
* [http://prdownloads.sf.net/mingw/mingw-runtime-3.9.tar.gz?download mingw-runtime-3.9.tar.gz]
+
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'''.
  
* [http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz?download w32api-3.6.tar.gz]
+
===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.
 +
<pre>;C:\MinGW\bin\;C:\MSYS\1.0\bin</pre>
 +
* OK your way out of all dialog boxes.
  
* [http://prdownloads.sf.net/mingw/binutils-2.15.91-20040904-1.tar.gz?download binutils-2.15.91-20040904-1.tar.gz]
+
====Windows 9x/Me====
  
* [http://prdownloads.sf.net/mingw/mingw32-make-3.80.0-3.exe?download mingw32-make-3.80.0-3.exe]
+
==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:
  
* [http://prdownloads.sf.net/mingw/gdb-5.2.1-1.exe?download gdb-5.2.1-1.exe]
+
<pre>make -f Makefile.win all</pre>
<BR>
+
<b><u>NOTE:</u></b> Use a program like 7-zip to extract tar.gz files.
+
  
=Unpack Files=
+
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:
- 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>
+
<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>.
+
  
=Download SDL Packages=
+
<pre>make -f Makefile.win client
 +
make -f Makefile.win server
 +
make -f Makefile.win master</pre>
  
- Download the following SDL packages and untar/zip them to your MinGW dir.
+
That's it!  The binaries should appear in a new subdirectory called bin.
 
+
* [http://www.libsdl.org/release/SDL-devel-1.2.9-mingw32.tar.gz SDL-devel-1.2.9-mingw32.tar.gz]
+
 
+
* [http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.6-VC6.zip SDL_mixer-devel-1.2.6-VC6.zip]
+
 
+
=Download MSYS=
+
 
+
- You will need [http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download MSYS.] You will need to add an environment variable to point to its bin dir aswell.
+
 
+
<b><u>NOTE:</u></b> You need MSYS, because gnu make and windows mkdir don't get on well together, not because you need sdl-config.
+
 
+
=Create a Directory for Code=
+
 
+
- 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=
+
 
+
- 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>
+
 
+
=Result=
+
 
+
- 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.