Spring on MacOSX: Difference between revisions

From Spring
Jump to navigationJump to search
Patmo98 (talk | contribs)
No edit summary
Line 1: Line 1:
= Duplicate and missing information =
Because all needed libraries are available for OsX as well, you can compile a working version of Spring for Mac. But Unitsync will only work between Intel Macs and PCs, but not between those and PPC, and due to Apple's switch from PPC to Intel and due to the astronomical amount of effort it would take to to make them sync, there is no PPC port under development.


This page is a partial duplicate of [[Building_Spring_on_MacOSX]] but both have unique information.  
There's also a working lobby client for Mac OsX, follow the instruction below to compile it.


= Whats up with spring on OS X =
=Install Sping from source on an Intel Mac=
There has been a working, compiled universal binary for Macintosh OSX 10.4. However, this is an outdated version, and development has ceased since the release.
The following guide was created and tested in a 2,53 Ghz 13" MacBook Pro, 4 GB RAM Nvidia GeForce 9400M and a MacPro Xenon Quadcore ATI Radeon HD 4870.


Because a lack of Mac developers (or maybe the lack of Macs for the developers) there is no Mac binary for any recent version of spring. Various people have managed to get it to compile and run on OS X, and we received some patches, but no one ever created a binary package.
==Dependencies:==
U will need the following dependencies to compile:
Programs necessary to build
    * Xcode Tools
    * cmake (included in Xcode tools)
    * zip


== We need YOU ==
Libraries
If you have a  Mac, and want to help spring, make a binary package. Lots of people tried, some of them failed, some succeeded, some of them even send patches, but noone stayed long enough to make one.
    * SDL
    * boost (version 1.35 or later recommended)
    * DeviL (IL, ILU)
    * OpenAL (comes with Xcode tools)
    * OpenGL headers (mesa, glew, etc.) (comes with Xcode tools)
    * zlib
    * freetype
    * ogg,vorbis and vorbisfile
    * Python (2.5)


Thus, it should not be that hard to actually do it. All libraries used by spring are available on OS X, and beside some (or maybe even none) compile errors, spring will most likely compile and work fine.
Download and install Macports (http://www.macports.org)
You will need to be administrator to complete the following.
Open the Terminal and copy and paste the first command and wait until it is completed, do continue one-by-one with the others (you will be asked for the admin passwort each time).


If you need help, post on forum or ask in the lobby (channel #sy).
sudo port install cmake
sudo port install libsdl
sudo port install libsdl-framework
sudo port install boost
sudo port install boost-jam
sudo port install libpng
sudo port install jpeg
sudo port install tiff
sudo port install libogg
sudo port install libvorbis
sudo port install python25
sudo port install libdevil


== Notes  ==
This will take some time and disk space, but should complete without problems. If you experience any errors, download the dependencies' source and compile it.
Network sync will work between 32-bit builds and 64-bit builds. It does not, and probably never will work between PPCs and Intel/AMD processors because of Endien. Basically, getting PCC to sync would take an astronomical amount of work, and wouldn't help move anything forward since PPCs are dieing anyway.


==Fixes==
Download the latest spring source from the download page.
If you try to compile now, you will experience some error, and therefor you will have to apply 2 fixes:


Lobby information for OSX are old & outdated, someone please update this page and the lobby link with fresh information. <Brain Damage>
Firstly, there is an assembler code in Until.cpp you need to change:
Original Source code in Util.cpp:


<code>#else
__asm__ __volatile__(
    "pushl %%ebx\n\t"
    "cpuid\n\t"
    "movl %%ebx, %1\n\t"
    "popl %%ebx"
    : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
    : "0" (*a)
  );
#endif</code


Due to the lack of information about a working lobby, the only sure way play between two computers must be initiated manually via start scripts and/or command line.
Alter it like this:
<code>
#else
  __asm__ __volatile__(
    "pushq %%rbx\n\t"
    "cpuid\n\t"
    "movl %%ebx, %1\n\t"
    "popq %%rbx"
    : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
    : "0" (*a)
  );
#endif </nocode>


See the [[Lobby_on_MacOSX]] page for details and development progress
Secondly, there is no command specified to create an error winnow during the game, so the compiler with complain about an unknown function.
DELETE this part of the code in ErrorHandler.cpp:


== Building the Engine ==
#elsif defined(__APPLE__)
MacMessageBox(msg, caption, flags);


You can find more information at [[Building_Spring_on_MacOSX]]
Now Spring will use the X Window system (x11) for displaying error windows, that might look ugly because its not using Apple's Aqua GUI style but it works and you wont experience much errors during gameplay anyway ;)
 
==Compiling:==
Open the Terminal, change into the Spring source folder (e.g.: "cd Desktop/spring_0_80_5_2/") and follow the interactions below:
(You will be asked for the admin passwort)
 
type "sudo cmake ." (the dot and the gap is important)
type "sudo make" (this will take some time)
type "sumo make install"
 
Result
Now, you will have a a Unix Executalbe File called "spring" in your source directory and a "spring" directory in "usr/local/share/games/" (you need to make hidden folders visible to see it).
Create a folder called "maps" and a folder called "mods" there. (This is where Spring will check for maps/mods).
You can double click on the spring file (mod+map needed) and test if everything is right.
 
Compiling the Lobby
You will need to get a lobby client (e.g.: SpringLobby: http://springlobby.info) and the dependencies to compile it from source following this GUIDE.
This Chapter will be extended soon.
 
--[[User:Grapefruit|Grapefruit]] 11:08, 4 December 2009 (UTC)

Revision as of 12:08, 4 December 2009

Because all needed libraries are available for OsX as well, you can compile a working version of Spring for Mac. But Unitsync will only work between Intel Macs and PCs, but not between those and PPC, and due to Apple's switch from PPC to Intel and due to the astronomical amount of effort it would take to to make them sync, there is no PPC port under development.

There's also a working lobby client for Mac OsX, follow the instruction below to compile it.

Install Sping from source on an Intel Mac

The following guide was created and tested in a 2,53 Ghz 13" MacBook Pro, 4 GB RAM Nvidia GeForce 9400M and a MacPro Xenon Quadcore ATI Radeon HD 4870.

Dependencies:

U will need the following dependencies to compile:

Programs necessary to build
   * Xcode Tools
   * cmake (included in Xcode tools)
   * zip
Libraries
   * SDL
   * boost (version 1.35 or later recommended)
   * DeviL (IL, ILU)
   * OpenAL (comes with Xcode tools)
   * OpenGL headers (mesa, glew, etc.) (comes with Xcode tools)
   * zlib
   * freetype
   * ogg,vorbis and vorbisfile 
   * Python (2.5) 

Download and install Macports (http://www.macports.org) You will need to be administrator to complete the following. Open the Terminal and copy and paste the first command and wait until it is completed, do continue one-by-one with the others (you will be asked for the admin passwort each time).

sudo port install cmake sudo port install libsdl sudo port install libsdl-framework sudo port install boost sudo port install boost-jam sudo port install libpng sudo port install jpeg sudo port install tiff sudo port install libogg sudo port install libvorbis sudo port install python25 sudo port install libdevil

This will take some time and disk space, but should complete without problems. If you experience any errors, download the dependencies' source and compile it.

Fixes

Download the latest spring source from the download page. If you try to compile now, you will experience some error, and therefor you will have to apply 2 fixes:

Firstly, there is an assembler code in Until.cpp you need to change: Original Source code in Util.cpp:

#else

__asm__ __volatile__(
   "pushl %%ebx\n\t"
   "cpuid\n\t"
   "movl %%ebx, %1\n\t"
   "popl %%ebx"
   : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
   : "0" (*a)
 );
  1. endif</code

Alter it like this:

  1. else
 __asm__ __volatile__(
   "pushq %%rbx\n\t"
   "cpuid\n\t"
   "movl %%ebx, %1\n\t"
   "popq %%rbx"
   : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
   : "0" (*a)
 );
  1. endif </nocode>

Secondly, there is no command specified to create an error winnow during the game, so the compiler with complain about an unknown function. DELETE this part of the code in ErrorHandler.cpp:

  1. elsif defined(__APPLE__)

MacMessageBox(msg, caption, flags);

Now Spring will use the X Window system (x11) for displaying error windows, that might look ugly because its not using Apple's Aqua GUI style but it works and you wont experience much errors during gameplay anyway ;)

Compiling:

Open the Terminal, change into the Spring source folder (e.g.: "cd Desktop/spring_0_80_5_2/") and follow the interactions below: (You will be asked for the admin passwort)

type "sudo cmake ." (the dot and the gap is important) type "sudo make" (this will take some time) type "sumo make install"

Result Now, you will have a a Unix Executalbe File called "spring" in your source directory and a "spring" directory in "usr/local/share/games/" (you need to make hidden folders visible to see it). Create a folder called "maps" and a folder called "mods" there. (This is where Spring will check for maps/mods). You can double click on the spring file (mod+map needed) and test if everything is right.

Compiling the Lobby You will need to get a lobby client (e.g.: SpringLobby: http://springlobby.info) and the dependencies to compile it from source following this GUIDE. This Chapter will be extended soon.

--Grapefruit 11:08, 4 December 2009 (UTC)