#summary How to run FoFiX under GNU/Linux
#labels Phase-Deployment
<wiki:toc max_depth="2" />
= Introduction =
The following provides instructions to get FoFiX running on (hopefully) any (modern?) GNU/Linux distribution.

Comments and suggestions are always welcome.

*Note:* In all places where the python interpreter is called, `python` can be replaced by a specific version _e.g._ `python2.5`. Remember that if you do it once, you'll have to do it everywhere.

=Getting FoFiX=
You can either get the latest stable release in the form of an archive or get the source from our Subversion server. If you choose the first possibility, head to our [http://code.google.com/p/fofix/downloads/list?q=opsys=Linux download] page and get and extract the source archive.

If you choose the second option, you are required to have the {{{svn}}} client to do the following:
  # Open a terminal
  # Change to the directory in which you want to have FoFiX
  # Execute one of the following depending on the version you want:
    # Stable: {{{svn checkout http://fofix.googlecode.com/svn/MFH-Mod/tags/Release_3.120_final fofix-3.120}}}
    # Testing: _none at the moment_
    # Unstable: {{{svn checkout http://fofix.googlecode.com/svn/MFH-Mod/trunk/ fofix-svn}}}

_It is highly recommended that when you use the unstable version (when you become an Alpha tester), you keep a separate FoFiX folder containing a full install of the latest stable release - as the Alpha versions' new features and bugfixes might cause other issues affecting playability._

_Alternatively, be familiar with your svn clients method of rolling back to previous revisions so you can downgrade to a working revision if the latest one breaks on you e.g. at the commandline, you may use {{{svn up -r<revision_number>}}} to rollback to the specified version._

= Generic instructions =
The following gives instructions that should work on most GNU/Linux distributions. If there are specific instructions for your distribution, you may want to have a look at that section instead of this one.
 
== Install dependencies ==
You need to install these packages:
  * Python (tested with 2.4, 2.5, and 2.6 on Karmic)
  * pygame (>= 1.9 required for 64bit CPUs)
  * PyOpenGL (2.x is recommanded as it's much faster than 3.x for most users)
  * NumPy
  * Python Imaging Library (PIL)
  * PyOgg
  * PyVorbis
  * PySqlite2
  * PyXML
  * Python GStreamer and gstreamer-plugin-ffmpeg (*Only required if you want video playback support*)
  * (Python) Numeric (*Only required if you have pygame < 1.9*)

Optionally, if you are in 32bit you can also install Psyco.

=== Getting and installing pygame 1.9.x ===
The following downloads and builds the latest pygame release. Note that the last step needs to be done as root (_e.g._ using `sudo`) if you choose to install pygame (system-wide).
{{{
wget http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz
tar xvf pygame-1.9.1release.tar.gz
cd pygame-1.9.1release/
python setup.py
}}}

=== Optional Voice Support ===
  # Build pyaudio.
  # Build pypitch.

_Detailed instructions still to come._

=== Optional PitchBending ===
==== Requirements ====
In order to build John Stumpo's pitchbend module you first need to install...
  * libsdl-mixer1.2-dev
  * libsndobj-dev

==== Compiling ====
  # Get the source code: {{{svn co http://svn.jstump.com/r/pitchbend/trunk/ pitchbend}}}
  # Move to the source folder: {{{cd pitchbend}}}
  # Create an empty VERSION file: {{{touch VERSION}}}
  # Build the library: {{{python setup.py build}}}
  # Optionally you can install it: {{{sudo python setup.py install}}}

== Links to your songs and themes ==
You may very well use symbolic links to point to your songs and themes.
That prevents you from having to copy your files over and over.
Here are two examples:
{{{
ln -s ~/games/FoFiX/data/songs/ ~/games/fofix-3.120~rc1/data/songs
ln -s ~/games/FoFiX/data/themes/RB2\ Spanish ~/games/fofix-3.120~rc1/data/themes/RB2\ Spanish
}}}

== Running the game ==
  # Change directory to the `src` folder of your FoFiX directory _e.g._ `~/fofix-svn/src`.
  # Execute {{{python FoFiX.py}}}

*Note:* If you are using custom built but not installed libraries, use the PYTHONPATH environment variable _e.g._
{{{
PYTHONPATH=~/pygame-1.9.1release/build/lib.linux-x86_64-2.5:~/pyaudio/build/lib.linux-x86_64-2.5 python FoFiX.py
}}}

= Distribution-specific instructions =
If your distribution is not listed here and you got FoFiX to work, please create a wishlist item on our issues tracker to share the required procedure.

== Debian or Ubuntu ==
Execute the following as root to install the dependencies:
{{{
apt-get install python-pygame python-opengl python-numpy python-imaging \
python-ogg python-pyvorbis python-pysqlite2 python-xml python2.5-dev \
gstreamer-plugin-ffmpeg python-gst0.10
}}}

*Notes:*
  * *If you are running in a 64bit environment, pygame >= 1.9 is required*. You'll need to build it yourself (See [#Getting_and_installing_pygame_1.9.x]). Note that you don't have to install it, you can use the PYTHONPATH environment variable to point python to your pygame library (see below for an example).
  * *If you are using pygame < 1.9, you NEED python-numeric*.
  * Under Debian unstable, make sure you have python-pyvorbis 1.3 or >= 1.4-2 but not 1.4-1. The latter crashes with a double free error.
  * Under Ubuntu versions earlier than Karmic, make sure you use `python2.5` all over the place.

See the [#Generic_instructions generic instructions] above for getting and executing FoFiX.

==Archlinux ==
Get and install the latest PKGBUILD from [http://aur.archlinux.org/packages.php?ID=20454 this page].

==OpenSUSE==
Get and install the latest RPM from [http://packman.links2linux.org/package/fofix this page].