FreedroidRPG Installation 
=========================

To build FreedroidRPG from source on a Unix-like system, you will use the "standard" GNU autotools way.

Dependencies
============

FreedroidRPG requires the following libraries, along with, on the Linux distributions that split them, their associated -dev package.
Make sure you install them before attempting to build.

SDL
SDL_image
SDL_gfx
SDL_ttf (optional)
SDL_mixer (optional)
libogg (optional)
libvorbis (optional)
OpenGL (optional)
GLEW (required for OpenGL, if OpenGL is used)
lua (optional, packaged in the source tree if not available system-wide)

The packages to install are listed below, depending on your distribution.

1) Debian/Ubuntu

sudo apt-get install pkg-config libsdl1.2-dev libsdl-mixer1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libogg-dev liblua5.2-dev libjpeg-dev gettext autopoint libglew-dev

2) Fedora

dnf install pkgconfig SDL_image-devel SDL_net-devel SDL_mixer-devel SDL_gfx-devel SDL_ttf-devel libjpeg-devel libpng-devel libvorbis-devel libGLU-devel lua-devel gettext gettext-devel

3) Archlinux

pacman -S base-devel libgl libvorbis lua sdl sdl_gfx sdl_image sdl_mixer gettext glew

There is also a freedroidrpg-git pkgbuild at the arch user repository: https://aur.archlinux.org/packages.php?ID=57483

4) Gentoo

emerge -av libsdl sdl-image sdl-gfx sdl-mixer libogg libvorbis eselect-opengl lua virtual/jpeg media-libs/libpng media-libs/glew

5) Please contribute lists for your distribution!

Building with autotools
=========================

1) Open a terminal. 
   a) Via right click in some file browsers.
   
   b) Via main menu (usually "System" entry).
      Move to the FreedroidRPG source directory using "cd ./XYZ/" command. XYZ = path to the FreedroidRPG source.
   
2) If you are running a git version of the game, you will first need to generate the
   configure script by running:
   ./autogen.sh
   If you don't know what the git version is, you are not running it and can skip this step.

3) Run the configure script: 
   ./configure
   You can check the options it accepts with --help.
   If you are running MAC OSX you will probably want to use ./configure --with-apple-opengl-framework
   During the configure process, the terminal may notify you that some software is required.
   Install the required packages and restart ./configure.

4) If ./configure finishes without errors or warnings, then proceed with building the game with:
   make

5) Installation
   a) "make install" will install the game system-wide. You need to be root for this. The binary name is freedroidRPG.

      Hint: you can speed up "make" process using "make -j n". Replace "n" with number of jobs.
      For more information execute "make --help".

   b) If you are working with the source tree and want to git pull regularly we 
      recommend the following instead: 
      Do not issue "make install", instead, simply go to the src/ subdirectory, and run
      ./freedroidRPG.



Cross compile for Windows with autotools
========================================

Provided you have a cross compiler installed and set up (see
below for more details), use the following configure line:

$ ./configure  --prefix=/path/to/the/cross/compiler --host=i686-pc-mingw32 --without-x --enable-nls LIBS="-lintl"

One critical point is to make sure you have all required libraries installed. 
You will need to have libogg and libvorbis for sound and music, and will need libintl and its dependencies
to provide translation support.

The binary we ship supports all those features and is built with autotools.
In special cases we may agree to sending you the complete cross-compiler archive so you can build win32 binaries
easily.

Building In Windows
===================

Thanks to the mingw64/msys2 projects, it is now quite as easy to build FreedroidRPG
on Windows than on a Linux based OS.

1) Install msys2 (Use the 32b or 64b version, depending on your OS):
   - Follow the installation guide from http://msys2.github.io/

2) Install some additional user and build tools:
   - Start a "Msys2 Shell" from the Windows Start Menu and type:
       pacman -S make autoconf automake tar python2 git wget unzip

From now on, when you start a shell, if you want to build a 32b version of
the game, launch "MinGW-w64 Win32 Shell". If you want to build a 64b version,
rather launch "MinGW-w64 Win64 Shell"

3) Install the mingw64 toolchain (replace 'i686' by 'x86_64' if you want to
   build a 64b version of the game):
     pacman -S mingw-w64-i686-gcc mingw-w64-i686-pkg-config

4) Install FDRPG dependencies (replace 'i686' by 'x86_64' for 64b version):
     pacman -S mingw-w64-i686-SDL mingw-w64-i686-SDL_gfx mingw-w64-i686-SDL_image mingw-w64-i686-SDL_ttf mingw-w64-i686-lua mingw-w64-i686-glew

5) On Mar,19 2016, SDL_image (1.2.12-4) uses an old version of libwebp.
   Until it is rebuilt, just do:
     cp /mingw32/bin/libwebp-6.dll /mingw32/bin/libwebp-5.dll)

6) The SDL_mixer package is not available. You can build the game without
   it (but sound will be disabled), or you can build it from source
   (with ogg/vorbis support only, we do not need the other input decoders):
     pacman -S mingw-w64-i686-libvorbis
     wget https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.zip
     unzip SDL_mixer-1.2.12.zip
     cd SDL_mixer-1.2.12
     ./autogen.sh && ./configure --prefix=/mingw32 && make && make install

From now on, you have everything installed and you are ready to build the
game using the same commands than on Linux:

7) Clone freedroid-src repository:
     git clone https://gitlab.com/freedroid/freedroid-src.git

8) Build it:
     ./autogen.sh
     ./configure
     make

9) Run the game from the cmdline:
     ./src/freedroidRPG

	or you can just double-click on the executable's icon from the File Explorer.
	You will find it somewhere inside C:\mingw32\msys\home\<your_username>

Enjoy the game!

==============================================================
If you have problems with the compilation/installation, please
contact us : #freedroid on irc.freenode.net,
or send a mail to freedroid-discussion@lists.sourceforge.net.
==============================================================
