Spring on MacOSX: Difference between revisions

From Spring
Jump to navigationJump to search
Abma (talk | contribs)
 
(32 intermediate revisions by 10 users not shown)
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.
{{deprecated|This howto is deprecated, please use the [[Download|official package]], else you can [[Building_Spring_on_MacOSX|compile]] it yourself.}}


There's also a working lobby client for Mac OSX, follow the instruction below to compile it.
'''Important notice: as of the next engine release, this tutorial will be discontinued, as Spring will be available as a standalone Mac OS X .app bundle (so will SpringLobby).'''


=Install Sping from source on an Intel Mac=
Last page update: 2011/08/01 by daftalx (updated SpringLobby to 0.135)
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:==
Current milestones available:
U will need the following dependencies to compile:
* Spring: 0.82.7.1
Programs necessary to build
* SpringLobby: 0.135
    * Xcode Tools
    * cmake (included in Xcode tools)
    * zip


Libraries
=Preamble=
    * 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)


==Installing the 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).


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


Then download and install Macports (http://www.macports.org)
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.
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 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.
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.


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


Firstly, there is an assembler code in Until.cpp you need to change.
Good luck, and have fun !
Original Source code in Util.cpp:


#else
=Basics=
  __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


Alter it like this:
==Install the XCode tools==
#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


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


Secondly, there is just a placeholder command specified to create an error window during the game, so the compiler with complain about an unknown function.
==Install the Java developer packages==
DELETE this part of the code in ErrorHandler.cpp:


#elsif defined(__APPLE__)
As of Apple's "Java for Mac OS X 10.6 Update 3", headers for JNI (among other stuff) are no longer provided by default. In order to build spring AIs but also various dependencies, you should download and install the Java Developer package available on Apple's support site [http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719 here] (NOTE: you must have an Apple ID to access this page. Feel free to post any public hard link in the forum to be added here instead).
    MacMessageBox(msg, caption, flags);


==Install MacPorts==


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 ;)
*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 passwort)


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


==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 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 allright.


=Compiling the Lobby=
    rsync://daftserve.dyndns.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)
==Keep MacPorts up-to-date==
 
To sync your MacPorts install with the latest repositories hit
 
    sudo port sync
 
and upgrade any outdated ports with
 
    sudo port upgrade outdated
 
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 binutils
 
WARNING: this will take a *long* while, especially on a fresh system (ballpark figure: over an hour with an Intel C2D 2.2GHz cpu).
 
the binutils are required for finding the source of a crash of spring, the utility addr2line is used.
 
==Setup game data==
 
create a ".spring" folder in your home directory, and create the usual "games", "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 games (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===
 
As for the engine, installing SpringLobby comes down to a simple command:
 
    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.so".
 
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...
 
===Known bugs===
 
*Add bot in a game opens a tiny (one-pixel wide) window. Clicking it restores its size, but be precise !
 
=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 !

Latest revision as of 11:20, 12 April 2014

This howto is deprecated, please use the official package, else you can compile it yourself.


Important notice: as of the next engine release, this tutorial will be discontinued, as Spring will be available as a standalone Mac OS X .app bundle (so will SpringLobby).

Last page update: 2011/08/01 by daftalx (updated SpringLobby to 0.135)

Current milestones available:

  • Spring: 0.82.7.1
  • SpringLobby: 0.135

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 the Java developer packages

As of Apple's "Java for Mac OS X 10.6 Update 3", headers for JNI (among other stuff) are no longer provided by default. In order to build spring AIs but also various dependencies, you should download and install the Java Developer package available on Apple's support site here (NOTE: you must have an Apple ID to access this page. Feel free to post any public hard link in the forum to be added here instead).

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

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://daftserve.dyndns.org/macports/

Keep MacPorts up-to-date

To sync your MacPorts install with the latest repositories hit

    sudo port sync

and upgrade any outdated ports with

    sudo port upgrade outdated

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 binutils

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

the binutils are required for finding the source of a crash of spring, the utility addr2line is used.

Setup game data

create a ".spring" folder in your home directory, and create the usual "games", "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 games (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

As for the engine, installing SpringLobby comes down to a simple command:

    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.so".

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...

Known bugs

  • Add bot in a game opens a tiny (one-pixel wide) window. Clicking it restores its size, but be precise !

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 !