INSTEAD 3.5.2
=============

WARNING! For successfull building you must install these development packages
(names may vary in your distribution):

	sdl2, sdl2-mixer, sdl2-image, sdl2-ttf, lua5.1/luajit, iconv
	and gtk+2(3) (to build with open file dialog)

Optionally you may use:
	lua5.2/lua5.3/lua5.4
	HarfBuzz and SDL2_ttf compiled with HarfBuzz support

0) Prepare for building
=======================

Unpack source package with this command:
	$ tar xzvf instead_<version>.tar.gz

Change current dir to project's build dir:
	$ cd instead-<version>

There are several ways to build package.

1) On Ubuntu
============

Install stable (old) version from repo:
	$ apt-get install instead

Or use ppa with latest version:
	https://launchpad.net/~gl00my/+archive/ubuntu/instead

2) On Debian based systems you can build deb package
====================================================

	$ sudo apt-get install liblua5.1-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
	$ sudo apt-get install build-essential debhelper
	$ debuild
	$ cd ..
	$ sudo dpkg -i instead_<version>.deb

3) On arch linux
================

Install stable version from AUR:
	$ yay -S instead

Or build from svn:
	$ make PKGBUILD
	$ makepkg -s

And, I think, you have enough skills to build package yourself. ;)

4) On FreeBSD
=============

Install instead from ports with pkgng:
	# pkg install instead
Or:
	# cd /usr/ports/games/instead
	# make install

Or build from tarball:
	$ ./configure.sh
	$ gmake

5) On RPM based system
======================

There is .spec file in tarball.

6) For other distributions
==========================

You have three choices:
	a) try to use cmake rules
	b) try run ./configure.sh and follow instructions
	c) do all things manually

7) Build using cmake
====================
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

Warning, in some systems (like Arch linux) you need to define LUA dir, to help cmake.
For example (Arch linux):
$ LUA_DIR=/usr/include/lua5.1/ cmake ..

To build standalone version, use this (in ./build/ directory):
$ cmake .. -DSTANDALONE=1
$ make && make install
$ cd standalone
$ ./sdl-instead

Some options:
WITH_GTK2 Use GTK2 file open dialog
WITH_GTK3 Use GTK3 file open dialog (default on)
WITH_LUAJIT Use LuaJIT instead of Lua (default on))
WITH_HARFBUZZ RTL support. SDL2_ttf should be compiled with HarfBuzz too (default off)

For example, to build standalone version without LuaJIT, use:

$ cmake .. -DWITH_LUAJIT=0 -DSTANDALONE=1

8) Manual build
===============
To build game, that runs just from build dir use Rules.make.standalone
----------------------------------------------------------------------
	$ rm -f Rules.make
	$ ln -s Rules.make.standalone Rules.make
	$ make clean
	$ make

If build process has failed check Rules.make.standalone and make changes if needed.

	$ ./sdl-instead

To build game for system install
--------------------------------
	$ rm -f Rules.make
	$ ln -s Rules.make.system Rules.make
	$ make clean
	$ make

If build process has failed check Rules.make.system and make changes if needed.

	$ sudo make install

	$ sdl-instead

8) Right-to-left support
========================
In order to build INSTEAD with right-to-left support, the SDL2_ttf underlying library and
INSTEAD should be compiled with HarfBuzz support (see section 7 for cmake). SDL2_ttf has
a flag for it (TTF_USE_HARFBUZZ) which should be set in SDL_ttf.c at the time of writing.

Enjoy.
