Spring on MacOSX: Difference between revisions

From Spring
Jump to navigationJump to search
mNo edit summary
Daftalx (talk | contribs)
Migrated the forum tutorial to this page (old page kept as archive)
Line 1: Line 1:
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.
Last page update: 2010/10/21 by daftalx (migrated the tutorial from the forum)


There's also a working lobby client for Mac OSX, follow the instruction below to compile it.
Current milestones available:
* Spring: 0.81.2.1
* SpringLobby: 0.95
* QtLobby: 1.0 alpha rev. 597


=Install Spring from source on an Intel Mac=
=Preamble=
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, both with Snow Leopard (10.6).


==Dependencies:==
This tutorial is intended for Mac OS X Snow Leopard (10.6.*) users running in 32bit kernel mode. Although Spring compiles and runs in 64 bits, '''it does not work in 64bit kernel mode''' (thanks to ''frequencyandsulphur'' for digging this one out).
You will need the following dependencies to compile:
Programs necessary to build
    * Xcode Tools
    * cmake (included in Xcode tools)
    * zip
    * p7zip


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)
    * glew


==Installing the Dependencies==
This tutorial has not been tested on older releases of Mac OS X (10.5-). Yet, there are big chances that you can get through and still be able to run Spring. Keep in mind though that due to architecture incompatibilities, Intel-powered macs will be able to discuss online together, as well as with PCs, but not with PPC-powered Macs.


Firstly, download the Xcode Development Tools from Apple or install them from your OSX DVD: http://developer.apple.com/technology/xcode.html (you will need to register, but its free of charge)


Then download and install Macports (http://www.macports.org)
Finally, please bear in mind that this tutorial is mostly for testing purposes and proof of concept. Although no manual compilation is required, using the Terminal application is necessary (for now). Due to the little amount of time people are dedicating to the Mac version of Spring, things will move only slowly and often behind the other platforms. Once things get stabilized, an all-in-one installer will (hopefully one day) replace this tutorial.
You need to be administrator to complete the following.
Open the Terminal and copy and paste the first command and wait until it is completed, continue one-by-one with the others (you may be asked for the admin password each time).


sudo port install cmake
sudo port install libsdl
sudo port install libsdl-framework
sudo port install boost
sudo port install glew
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
sudo port install p7zip


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.
Good luck, and have fun !


==Fixes==
=Basics=
Download the latest spring source from the download page.
If you try to compile now, you will experience some errors, and therefore you will have to apply these patch files:


https://trac.macports.org/attachment/ticket/23556/patch-file-extension.diff
==Install the XCode tools==
https://trac.macports.org/attachment/ticket/23556/platform-misc-cpp.diff


cd into the source directory and execute
These are available on your Mac OS X install DVD, the installer is called "XCode Tools" in the "Optional installs" folder.


<code>patch -p 0 < patch-file-extension.diff
==Install MacPorts==


patch -p 0 < platform-misc-cpp.diff</code>
*If you never had MacPorts installed, the latest version is available as a ".dmg" installer on [http://www.macports.org/install.php this page]
*If you already have MacPorts, make sure you run the latest version with


==Compiling:==
    sudo port selfupdate
Open the Terminal, change into the Spring source folder (e.g.: "cd Desktop/spring_0_80_5_2/") and follow the instructions below:
(You will be asked for the admin password)


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


After the above commands have finished, check "/usr/local/share/games/spring/AI/Interfaces/C/0.1/" to see if the files there end with '.so' or '.dylib'. If they are named .so you will get an error message when using AI bots. Run this command to rename all .so files to .dylib:
    sudo port upgrade outdated


for X in `find /usr/local/share/games/spring/ -name "*.so"`; do sudo mv $X ${X/.so/.dylib}; done;
==Configure MacPorts==


==Result==
Spring and it's lobbies are published in a different repository than MacPorts's official one. So you must edit (as root) the MacPorts sources file (located by default in /opt/local/etc/macports/sources.conf), and add the following line before the last one:
Now, you have a a Unix Executable 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 alright.


=Compiling the Lobby=
    rsync://daftserver.game-host.org/macports/
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: http://springlobby.info/projects/springlobby/wiki/InstallFromSource
This Chapter will be extended soon.


--[[User:Grapefruit|Grapefruit]] 11:08, 4 December 2009 (UTC)
==Sync MacPorts regularly==


=Scripting the MacPorts dependencies=
To sync your MacPorts install with the latest repositories hit
<br>
 
Notwithstanding what appears above, not each command need be executed separately. <br><br>
    sudo port sync
Make a file (perhaps do_install.sh). Put it on your desktop. Cut and paste all the commands into it. Go into the terminal, and change to the Desktop directory. Execute:<br><br>
 
<code>chmod +x do_install.sh<br>
Note that you should hit this command again everytime a Portfile is added and/or updated. To give you a hint on whether you should sync or not, here is a quick changelog of the repository:
sudo ./do_install.sh</code><br><br>
*2010/10/21 14:31 PM: libtorrent-rasterbar: Port update (ver. 0.15.4)
It takes quite a long time to do it any other way.  
*2010/08/16 12:07 PM: springlobby: Port release (ver. 0.95)
<br><br>
*2010/08/06 01:37 PM: qtlobby: Port release (ver. 1.0alpha)
[[Category: Mac]]
*2010/08/03 02:35 PM: wxWidgets: Fixed shared library linking
*2010/07/30 11:26 PM: springlobby-devel: Port release (fetches latest git)
*2010/07/25 01:22 AM: wxWidgets: Port release (ver. 2.9.1)
*2010/07/09 01:02 AM: spring: Removed unnecessary Python 2.5 dependency
*2010/07/07 01:05 AM: spring: Port release (ver. 0.8.2.1)
 
From now on I assume your Portfiles will always be up-to-date, therefore I will get straight to the point during the remainder of this tutorial.
 
=Spring=
 
==Install spring==
 
Crazy as it may seem, installing spring now comes down to this command:
 
    sudo port install springrts
 
WARNING: this will take a *long* while, especially on a fresh system (ballpark figure: over an hour with an Intel C2D 2.2GHz cpu).
 
==Setup game data==
 
create a ".spring" folder in your home directory, and create the usual "mods", "maps" and "demos" folder. There you can store your favorite game data (most of the content is cross-platform compatible).
 
==Check if Spring works==
 
    spring
 
should launch the standalone GUI in window mode, which allows offline gaming, e.g. if you have demo scripts or single player mods (my favorite these days is Chicken BA).
 
=Lobbies=
 
==SpringLobby==
 
Although the Mac OS port of SpringLobby should be considered "barely alpha"-stage, quite a lot of features are already functional, so you should be able to play online with patience and little effort.
 
===Install SpringLobby===
 
SpringLobby currently relies on the boost library in debug mode. To install or upgrade boost with debug option on hit
 
    sudo port install boost +debug
 
then proceed to SpringLobby with
 
    sudo port install springlobby
 
In the end you should get two "double-clickable" .app bundles (springlobby and springsettings) in MacPorts's binary folder (/opt/local/bin by default).
 
===Setup SpringLobby===
 
Upon first run, you'll have to tell SpringLobby where to find the spring executable and unitsync library manually. The spring executable is in "/opt/local/bin/spring" and the unitsync library in "/opt/local/lib/libunitsync.dylib".
 
As mentioned earlier the lobby is in a very early port stage. One major feature that does *NOT* work yet is to join (or autojoin) an IRC channel (but you may chat inside a battleroom). So before connecting to the main server, open the "Autojoin channels" options window and remove all default channels.
 
That's it, connect and enjoy 
NOTE: SpringLobby will mostly crash upon startup (much less afterwards). Don't worry, just keep trying until you get through... or try QtLobby (see below)...
 
===Known bugs===
 
*Join a chat channel (the /join command stalls the app)
*Add bot in a game (hitting the "Add bot" button stalls the app)
*Loading replays (they appear in the list but wouldn't run)
 
==QtLobby==
 
Although QtLobby is now an unmaintained project, it had acquired the reputation of being a both fast and stable alternative to TASclient and SpringLobby. Here is how it compares to the Mac port of SpringLobby:
*Interface is faster and more responsive
*Great IRC chat management
*Bots & Replays not supported (at all)
 
Again, installing is as simple as
 
    sudo port install qtlobby
 
and launching is as simple as hitting
 
    qtlobby
 
As for SpringLobby, upon first run you will have to point to spring executable, unitsync library and data folder manually.
 
=Troubleshooting=
 
In case you encounter compile or install errors on the way, MacPorts will let you know that a log file has been stored somewhere like /opt/local/var/macports/logs/??/main.log, where the "??" describes the port you are installing. Paste the contents of this file into a paste bin (http://www.pastebin.ca) and post the shortlink to the pastebin in [http://springrts.com/phpbb/viewtopic.php?f=65&t=23455 this topic], together will your full system info (OS, CPU, ARCH, MacPorts version).
 
That's it ! Enjoy !

Revision as of 14:07, 21 October 2010

Last page update: 2010/10/21 by daftalx (migrated the tutorial from the forum)

Current milestones available:

  • Spring: 0.81.2.1
  • SpringLobby: 0.95
  • QtLobby: 1.0 alpha rev. 597

Preamble

This tutorial is intended for Mac OS X Snow Leopard (10.6.*) users running in 32bit kernel mode. Although Spring compiles and runs in 64 bits, it does not work in 64bit kernel mode (thanks to frequencyandsulphur for digging this one out).


This tutorial has not been tested on older releases of Mac OS X (10.5-). Yet, there are big chances that you can get through and still be able to run Spring. Keep in mind though that due to architecture incompatibilities, Intel-powered macs will be able to discuss online together, as well as with PCs, but not with PPC-powered Macs.


Finally, please bear in mind that this tutorial is mostly for testing purposes and proof of concept. Although no manual compilation is required, using the Terminal application is necessary (for now). Due to the little amount of time people are dedicating to the Mac version of Spring, things will move only slowly and often behind the other platforms. Once things get stabilized, an all-in-one installer will (hopefully one day) replace this tutorial.


Good luck, and have fun !

Basics

Install the XCode tools

These are available on your Mac OS X install DVD, the installer is called "XCode Tools" in the "Optional installs" folder.

Install MacPorts

  • If you never had MacPorts installed, the latest version is available as a ".dmg" installer on this page
  • If you already have MacPorts, make sure you run the latest version with
    sudo port selfupdate

and upgrade your ports with

    sudo port upgrade outdated

Configure MacPorts

Spring and it's lobbies are published in a different repository than MacPorts's official one. So you must edit (as root) the MacPorts sources file (located by default in /opt/local/etc/macports/sources.conf), and add the following line before the last one:

    rsync://daftserver.game-host.org/macports/

Sync MacPorts regularly

To sync your MacPorts install with the latest repositories hit

    sudo port sync

Note that you should hit this command again everytime a Portfile is added and/or updated. To give you a hint on whether you should sync or not, here is a quick changelog of the repository:

  • 2010/10/21 14:31 PM: libtorrent-rasterbar: Port update (ver. 0.15.4)
  • 2010/08/16 12:07 PM: springlobby: Port release (ver. 0.95)
  • 2010/08/06 01:37 PM: qtlobby: Port release (ver. 1.0alpha)
  • 2010/08/03 02:35 PM: wxWidgets: Fixed shared library linking
  • 2010/07/30 11:26 PM: springlobby-devel: Port release (fetches latest git)
  • 2010/07/25 01:22 AM: wxWidgets: Port release (ver. 2.9.1)
  • 2010/07/09 01:02 AM: spring: Removed unnecessary Python 2.5 dependency
  • 2010/07/07 01:05 AM: spring: Port release (ver. 0.8.2.1)

From now on I assume your Portfiles will always be up-to-date, therefore I will get straight to the point during the remainder of this tutorial.

Spring

Install spring

Crazy as it may seem, installing spring now comes down to this command:

    sudo port install springrts

WARNING: this will take a *long* while, especially on a fresh system (ballpark figure: over an hour with an Intel C2D 2.2GHz cpu).

Setup game data

create a ".spring" folder in your home directory, and create the usual "mods", "maps" and "demos" folder. There you can store your favorite game data (most of the content is cross-platform compatible).

Check if Spring works

    spring

should launch the standalone GUI in window mode, which allows offline gaming, e.g. if you have demo scripts or single player mods (my favorite these days is Chicken BA).

Lobbies

SpringLobby

Although the Mac OS port of SpringLobby should be considered "barely alpha"-stage, quite a lot of features are already functional, so you should be able to play online with patience and little effort.

Install SpringLobby

SpringLobby currently relies on the boost library in debug mode. To install or upgrade boost with debug option on hit

    sudo port install boost +debug

then proceed to SpringLobby with

    sudo port install springlobby

In the end you should get two "double-clickable" .app bundles (springlobby and springsettings) in MacPorts's binary folder (/opt/local/bin by default).

Setup SpringLobby

Upon first run, you'll have to tell SpringLobby where to find the spring executable and unitsync library manually. The spring executable is in "/opt/local/bin/spring" and the unitsync library in "/opt/local/lib/libunitsync.dylib".

As mentioned earlier the lobby is in a very early port stage. One major feature that does *NOT* work yet is to join (or autojoin) an IRC channel (but you may chat inside a battleroom). So before connecting to the main server, open the "Autojoin channels" options window and remove all default channels.

That's it, connect and enjoy NOTE: SpringLobby will mostly crash upon startup (much less afterwards). Don't worry, just keep trying until you get through... or try QtLobby (see below)...

Known bugs

  • Join a chat channel (the /join command stalls the app)
  • Add bot in a game (hitting the "Add bot" button stalls the app)
  • Loading replays (they appear in the list but wouldn't run)

QtLobby

Although QtLobby is now an unmaintained project, it had acquired the reputation of being a both fast and stable alternative to TASclient and SpringLobby. Here is how it compares to the Mac port of SpringLobby:

  • Interface is faster and more responsive
  • Great IRC chat management
  • Bots & Replays not supported (at all)

Again, installing is as simple as

    sudo port install qtlobby

and launching is as simple as hitting

    qtlobby

As for SpringLobby, upon first run you will have to point to spring executable, unitsync library and data folder manually.

Troubleshooting

In case you encounter compile or install errors on the way, MacPorts will let you know that a log file has been stored somewhere like /opt/local/var/macports/logs/??/main.log, where the "??" describes the port you are installing. Paste the contents of this file into a paste bin (http://www.pastebin.ca) and post the shortlink to the pastebin in this topic, together will your full system info (OS, CPU, ARCH, MacPorts version).

That's it ! Enjoy !