Grafx2 compilation and installation
===================================

=== Requirements ===

* gcc C compiler (other compilers may work, but are not officially supported)
* GNU make (other similar "make" tools may work, but are not supported)
* SDL library v1.2
* SDL_image library
* libpng (not on MacOSX)
* FreeType library (optional)
* SDL_ttf library (optional)

Extra requirements for Windows:
* a POSIX environment: MSYS is fine, maybe Cygwin would work as well.
* use Mingw C compiler instead of gcc

Extra requirements for UNIX/X11 (Linux, FreeBSD, ...):
* X11 headers (optional, for truetype fonts)

=== Instructions ===

Open a shell/Terminal, cd to the directory where you have the source code, and
type:
  make
If all goes well, it should build grafx2 (the main program) in the current
directory. Voilą.

If you don't have FreeType and SDL_ttf, compile with NOTTF=1, it will
build a version without TrueType support : the Text tool will be limited to
bitmap fonts, proportional fonts with .ttf extension won't be available.

=== Build variants ===

The default compilation is optimized ( -O ), with debugging symbols for GDB.
Compile with OPTIM=0 to disable optimizations, if you have some real debugging
to do.
Compile with OPTIM=3 to use maximum optimizations.
Type "make release" if you don't want the debugging symbols.

Compile with NOJOY=1 to disable joystick support.

=== Other compilation targets ===
  make clean
Erases the generated files

  make depend
Re-compute the dependencies (makefile.dep). 

Other compilation targets (make version, make ziprelease) require Subversion
and are only useful to contributors to the svn repository of Grafx2.

=== System specifics ===

== Unix/Linux ==
  sudo make install
This copies the executable and data files in your system, in the /usr/local/
and /usr/share directories. You then no longer need the compilation directory.

  sudo make uninstall
Removes the copied files from your system, keeps your configuration.

== gp2x ==
The gp2x build is very similar to the Linux one. TTF is always disabled because 
there is no X11 support on the gp2x.
To compile a gp2x executable, type
	make GP2XCROSS=1
This will only work on an UNIXsystem (Linux or FreeBSD).

== Windows ==

It is also possible to compile from linux, with this command :
	make WIN32CROSS=1
You will need the mingw cross-compiler, and all the librairies listed above.

Here are the resources used to build the Windows version:

4DOS
  with an alias make=mingw32-make

MSYS
  installed in C:\MSYS

Mingw
  installed in C:\MSYS\mingw

SDL:
  SDL-devel-1.2.13-mingw32.tar.gz
  Uncompress in temporary directory
  make
  make install (no effect?)
  Headers are in /usr/mingw/include/SDL, copy them to /usr/include/SDL

Zlib:
  http://gnuwin32.sourceforge.net/downlinks/zlib.php
  zlib-1.2.3.exe
  Install in c:\msys\mingw
Libpng
  Requires: Zlib
  http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/l/li/libpng/
  libpng-1.0.23.tar.gz
  Uncompress in temporary directory
  ./configure
  make
  make install (long)
  Files created in /usr/local/include and /usr/local/lib ....
  
libjpeg (optional - improves SDL_image with JPEG reading)
  http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/l/project/li/libjpeg/libjpeg/
  jpegsr6.zip
  Uncompress in temporary directory
  ./configure --enable-shared
  make
  (make install doesn't work. Copy jpeglib.h, jmorecfg.h, jconfig.h in include, and libjpeg.a in lib)
  
libtiff (optional - improves SDL_image with TIFF reading)
  ftp://ftp.sgi.com/graphics/tiff/
  tiff-v3.4-tar.gz
  Uncompress in temporary directory
  ./configure i686-pc-mingw32
  make
  Don't use 'make install', copy tiff.h libtiff.a manually instead.
  
SDL_image:
  Requires: Libpng
  Requires optionally: libtiff
  Requires optionally: libjpeg
  http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/l/li/libsdl/
  SDL_image-1.2.8.zip
  Uncompress in temporary directory
  ./configure
  Check in the messages that png worked
  Optionally check if jpeg worked too
  Optionally check if tiff worked too
  make
  make install prefix=/usr/mingw
  
FreeType:
  http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/m/mi/mingw-cross/
  mingw-freetype-2.3.7-2
  Uncompress in c:/mwsys/mingw
  
SDL_ttf:
  No mingw package
  http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/l/li/libsdl/
  SDL_ttf-2.0.9-win32.zip for DLLs: libfreetype-6.dll, SDL_ttf.dll, zlib1.dll
  SDL_ttf-2.0.9.tar.gz

Lua:
  (optional)
  http://www.lua.org/ftp/lua-5.1.4.tar.gz
  Uncompress in temporary directory
  Use sh shell
  make mingw
  (make install doesn't work, even with prefix)
  Copy luaconf.h, lualib.h, lua.h, lauxlib.h to c:\msys\mingw\include
  Copy liblua.a to c:\msys\mingw\lib
  Copy lua51.dll to c:\msys\mingw\bin

