Compiling Sphere

From Spheriki

Jump to: navigation, search

Contents

Compiling Sphere under Windows


Getting the Sphere source code


Requirements: CVS


  • Download the latest CVS client and open the prompt (Start -> Run -> type in "cmd" -> OK).
  • Browse to your CVS directory with cd .. and cd directory and type in:
cvs -z3 -d :pserver:anonymous@sphere.cvs.sourceforge.net:/cvsroot/sphere co -P sphere

This will create a subdirectory called sphere, containing the Sphere source, including the latest engine, editor and utility source files and resources.


Compiling Sphere under Visual C++ 2008

Installing and setting up


Requirements: Visual C++ 2008 | Windows Server 2003 R2 Platform SDK


  • Download Visual C++ 2008 and the Platform SDK (both are free) and install them.


  • Open up VC++ and go to Tools -> Options.


  • Now go to Projects and Solutions -> VC++ Directories and make sure that at least the following Platform SDK include directories have been added (replacing Path_to_the_Platform_SDK with the real path):


Compiling the Sphere source code


Requirements: Third-party Headers, Libraries, and DLLs | wxWidgets


  • Download, install and build wxWidgets in Unicode Release mode and add the environment variable WXWIDGETS with a value pointing to the installed wxWidgets version (e.g. C:\wxWidgets-2.8.8).


  • Download the Third-Party archive and extract it's content into the sphere directory, where the CVS put all the source code, so it looks like this:



  • Now open VC++ and go to File -> Open -> Project/Solution...:



  • Browse e.g. to *\sphere\source\engine\ and open engine.vcproj:



  • Make sure the compile mode is set to Release:



  • And finally compile the project by selecting Build -> Build engine/solution (or just by pressing F7).

Compiling Sphere under Ubuntu Linux


This guide is based on Ubuntu Gutsy Gibbon 7.10.


Getting the Sphere source


  • Install the 'cvs' package from Synaptic (see appendix.)
  • Open a terminal. (Applications -> Accessories -> Terminal)
  • Browse to where you want your Sphere source directory to be using cd dir_name and cd ...
  • Enter the following:
cvs -z3 -d :pserver:anonymous@sphere.cvs.sourceforge.net:/cvsroot/sphere co -P sphere

This will make a subdirectory named sphere/, containing the Sphere RPG engine source code.


Installing required packages


Install the following packages from Synaptic (if they aren't already):

  • build-essential
  • scons
  • libaudiere-dev
  • libmng-dev
  • libpng12-dev
  • libsdl1.2-dev
  • zlib1g-dev
  • libjpeg62-dev
  • libvorbis-dev
  • libwxgtk2.4-dev

For the last package, you may need to enable the 'universe' repository, which contains software that is maintained by the Ubuntu community, but not by Canonical (the organisation behind Ubuntu.)

To do this:

  • Open up Software Sources (System -> Administration -> Software Sources.)
  • Check 'Community-maintained Open Source software (universe)' so that it is enabled.
  • Click 'Close'.
  • Allow the package manager to refresh.

Now you can re-enter Synaptic and install the last library.


Installing Corona


Requirements: Corona (pick '1.0.2 UNIX source release')


Corona is the graphics library that Sphere uses to support many different graphics formats. It doesn't come in any of Ubuntu's software repositories, so you'll need to download, compile and install it yourself.

  • Create a directory named Install under your home directory (so it's at ~/Install/.)
  • Extract the Corona sources to ~/Install/.
  • Open a terminal and enter:
cd Install/corona-1.0.2/
  • Enter the following to compile Corona:
./configure
make
sudo make install

Enter your password for the last command when prompted.

  • Copy the Corona library where it can be found by entering:
cd src/.libs/
sudo cp libcorona-1.0.2.so /usr/lib
  • Refresh your compiler library cache:
sudo ldconfig


Getting and installing SpiderMonkey


SpiderMonkey provides the JavaScript scripting capability of Sphere. The latest version of SpiderMonkey available via Synaptic (libmozjs-dev) is not compatible with Sphere (yet!), so you'll need to get the sources and compile and install it manually.

  • Navigate to ~/Install/ in the terminal.
  • Enter the following to get the SpiderMonkey sources:
mkdir smjs
cd smjs/
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -l mozilla/js/src mozilla/js/src/config mozilla/js/src/editline mozilla/js/src/fdlibm
  • Enter the following to compile SpiderMonkey:
cd mozilla/js/src/
make -f Makefile.ref
  • Generate the CPU configuration header file:
cd Linux_All_DBG.OBJ/
./jscpucfg > ../jsautocfg.h
  • Copy the library to where it can be found:
sudo cp libjs.so /usr/lib/libsmjs.so
  • Copy the header files to where they can be found:
sudo mkdir /usr/include/smjs
cd ..
sudo cp *.h *.tbl js.msg /usr/include/smjs/
  • Refresh the compiler library cache again:
sudo ldconfig


Compiling Sphere under GCC


  • Open up a terminal (if it's not already open) and navigate to the directory where you put the Sphere source.
  • Type:
scons

Sphere should take some time to compile, so go take a break and have some tea.


Running Sphere


  • Navigate to where the Sphere binary is:
cd build/linux/
  • Test that Sphere launches:
./engine

You should see the Sphere window launch with the startup game. Congratulations!


Appendix: Installing packages


Follow these instructions if asked to install a package in Synaptic.

  • Open up the Synaptic Package Manager (System -> Administration -> Synaptic Package Manager)
  • Enter your password.
  • Click "Search" on the toolbar and enter the package name. Press enter.
  • Scroll down
  • Click the box next to the entry with the desired package name.
  • Choose "Mark for Installation" from the menu that appears.
  • Click "Apply" on the toolbar.

Sometimes when marking packages for installation, you will be prompted to install other packages that they rely on. This is normal.

Personal tools