Difference between revisions of "Build for Windows"

From X-Moto
Jump to: navigation, search
m
(The new way to compile xmoto from windows)
Line 1: Line 1:
 +
=Build X-Moto from sources=
 +
 
Since xmoto 0.2.5, Visual Studio c++ is no longer required. You can build X-Moto from free software. You can build xmoto.exe from windows or even from GNU/Linux with cross-compilation.
 
Since xmoto 0.2.5, Visual Studio c++ is no longer required. You can build X-Moto from free software. You can build xmoto.exe from windows or even from GNU/Linux with cross-compilation.
  
This howto has been made under Ubuntu, but it's easy to adapt it to your distribution.
+
==Prerequites==
 +
 
 +
Before we can start to compile xmoto under windows, then we need to get 2 programs called Msys and MinGW.
 +
Fortunatly these are packed into one program, so they should be really easy to get.
 +
 
 +
Therefore go to [http://download.tuxfamily.org/xmoto/xmoto/msys/ this site] and download the most recent package. Unpack them to a place on your computer, but be aware; DO NOT place them in a path that contains spaces (Like C:\documents and settings). That will cause an error because of a bug.
  
=Prerequites=
+
==Setting Msys up==
  
==Install mingw==
+
[[Image:Msys_start_screen.png|right|thumb|500px|]]
===Under linux===
+
Okay, when Msys and MinGW are placed in a valid folder then open the Msys terminal (~msysForXMoto\msys.bat). It should look like this:
sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
 
===Under windows===
 
* go to http://www.mingw.org/download.shtml
 
* get MSYS-1.0.10.exe and MinGW-5.0.0.exe or newer
 
* install MSYS (for this tutorial, i let the default path, c:\msys\1.0) - answer to the questions
 
Do you wish to continue with the post install ? y
 
Do you have MinGW installed ? n
 
* install MinGW
 
Let the default mirror and the default options (mingw package = current)
 
Check g++ compiler and MingGW Make
 
Destination folder : c:\msys\1.0\mingw (the folder alreay exists)
 
  
==Install libs headers and objects==
 
The required files to compile are available on internet on the website of each library. However, to make it easier, a package is available on the xmoto cvs.
 
  
  svn export svn://svn.tuxfamily.org/svnroot/xmoto/xmoto/trunk/mingw_dev.zip
+
It's from this terminal we'll compile later on. But first we need the most recent source code for X-Moto. To get this, we use the command
mv xmoto/mingw_dev.zip ~
+
  svn co svn://svn.tuxfamily.org/svnroot/xmoto/xmoto/trunk
  
Under linux:
+
This action will probably take some minutes.
cd /usr/i586-mingw32msvc
+
It will download the source code, and place it at ~\msysForXMoto\home\xmoto\trunk.
 +
*''Note that in Msys you do not paste with ctrl-v but with the middle mousebottom.''
  
Under windows:
 
cd /usr/mingw
 
  
unzip ~/mingw_dev.zip
+
After the download is done, then we need to change directory so we are at the source code.
mkdir -p include libs bin
+
To this we use the command
mv mingw_dev/include/* include
 
mv mingw_dev/libs/* libs
 
mv mingw_dev/bin/* bin
 
rm ~/mingw_dev.zip
 
rmdir mingw_dev
 
  
Under windows:
+
  cd trunk
  cp /usr/mingw/include/SDL/* /usr/mingw/include
 
  
=Build from GNU/Linux=
+
[[Image:Msys_cd.png]]
tar jxf xmoto-x.y.z.tar.bz2
+
 
cd xmoto-x.y.z
+
 
  ./configure_mingw_from_linux.sh
+
 
make
+
When you got that:
i586-mingw32msvc-strip src/xmoto.exe
+
  sh ./bootstrap
 +
 
 +
That won't take a lot of time.
 +
 
 +
[[Image:Msys_bootstrap.png]]
 +
 
 +
And when the bootstrap is done:
  
=Build from Windows=
 
tar jxf xmoto-x.y.z.tar.bz2
 
cd xmoto-x.y.z
 
 
  ./configure
 
  ./configure
 +
 +
This will take some minutes. Be aware of that you maybe some errors, about missing .dll files. Just ignore them and press ok. It won't stop msys from configuring.
 +
 +
[[Image:After_configure.png|''It should look like this after the configure'']]
 +
<center>''It should look like this after the configure''</center>
 +
 +
 +
==Compile==
 +
 +
After the configure comes the real compile. To do this we use the command:
 +
 
  make
 
  make
 +
 +
This will take a lot of time if it's the first time that you compile X-Moto. “Make” will produce the xmoto.exe and place it at \msysForXMoto\home\xmoto\trunk\src\xmoto.exe.
 +
 +
[[Image:Msys_after_make.png]]
 +
<center> ''if it looks like this then you succeed compiling X-Moto!''</center>
 +
 +
There is only one command left now when the make is done:
 +
 
  strip src/xmoto.exe
 
  strip src/xmoto.exe
  
You can find xmoto.exe into the src directory.
+
This command will remove a lot of unnecessary debugging stuff and make the .exe files size smaller.
To get the dll required to play xmoto :
+
 
  svn export svn://svn.tuxfamily.org/svnroot/xmoto/xmoto/trunk/mingw_lib.zip
+
Now we only need to make the .exe run. But we need a lot of additional files which are found in the xmoto directory, therefor the smartest thing to do is to make a copy of the whole x-moto folder (call it my_xmoto).  
 +
 
 +
Then the absolute final thing; copy the xmoto.exe from trunk\src to the my_xmoto folder.
 +
 
 +
Then Doubleclick and enjoy your own compiled xmoto!
 +
 
 +
==Additional things to know==
 +
 
 +
Insted of downloading all sources codes each time you want to update your svn version, then use the command:

Revision as of 20:07, 21 November 2007

Build X-Moto from sources

Since xmoto 0.2.5, Visual Studio c++ is no longer required. You can build X-Moto from free software. You can build xmoto.exe from windows or even from GNU/Linux with cross-compilation.

Prerequites

Before we can start to compile xmoto under windows, then we need to get 2 programs called Msys and MinGW. Fortunatly these are packed into one program, so they should be really easy to get.

Therefore go to this site and download the most recent package. Unpack them to a place on your computer, but be aware; DO NOT place them in a path that contains spaces (Like C:\documents and settings). That will cause an error because of a bug.

Setting Msys up

Msys start screen.png

Okay, when Msys and MinGW are placed in a valid folder then open the Msys terminal (~msysForXMoto\msys.bat). It should look like this:


It's from this terminal we'll compile later on. But first we need the most recent source code for X-Moto. To get this, we use the command

svn co svn://svn.tuxfamily.org/svnroot/xmoto/xmoto/trunk

This action will probably take some minutes. It will download the source code, and place it at ~\msysForXMoto\home\xmoto\trunk.

  • Note that in Msys you do not paste with ctrl-v but with the middle mousebottom.


After the download is done, then we need to change directory so we are at the source code. To this we use the command

cd trunk

Msys cd.png


When you got that:

sh ./bootstrap

That won't take a lot of time.

Msys bootstrap.png

And when the bootstrap is done:

./configure

This will take some minutes. Be aware of that you maybe some errors, about missing .dll files. Just ignore them and press ok. It won't stop msys from configuring.

It should look like this after the configure

It should look like this after the configure


Compile

After the configure comes the real compile. To do this we use the command:

make

This will take a lot of time if it's the first time that you compile X-Moto. “Make” will produce the xmoto.exe and place it at \msysForXMoto\home\xmoto\trunk\src\xmoto.exe.

Msys after make.png

if it looks like this then you succeed compiling X-Moto!

There is only one command left now when the make is done:

strip src/xmoto.exe

This command will remove a lot of unnecessary debugging stuff and make the .exe files size smaller.

Now we only need to make the .exe run. But we need a lot of additional files which are found in the xmoto directory, therefor the smartest thing to do is to make a copy of the whole x-moto folder (call it my_xmoto).

Then the absolute final thing; copy the xmoto.exe from trunk\src to the my_xmoto folder.

Then Doubleclick and enjoy your own compiled xmoto!

Additional things to know

Insted of downloading all sources codes each time you want to update your svn version, then use the command: