Artha - An open cross-platform thesaurus based on WordNet
===============================================================================
Copyright (c) 2009-12  Sundaram Ramaswamy, <legends2k@yahoo.com>


Installation Instructions
-------------------------
Artha can be installed from source on most GNU/Linux systems easily, by
running the following commands in the source base directory:

$ ./configure
$ make

And then switching to 'root' (through 'su' or 'sudo') and running:
# make install

Artha could then be started by running 'artha'. 

It is recommended to add Artha to your list of start-up programs. For example, 
in GNOME, this is done through 'Sessions' in the System -> Preferences menu.

By default, Artha gets installed in /usr/local. Should you wish to change 
the default installation path, you can do so by setting the 'prefix' parameter 
of configure. Usually this prefix param is passed with /usr argument, since 
most applications have /usr as their base directory.

e.g.
$ ./configure --prefix=/usr CFLAGS="-O0 -g"

which will configure Artha to get installed in /usr. When debugging is required
pass "-O0 -g" as CFLAGS when invoking configure.


System Requirements
-------------------
Artha has been tested and is known to run well on several GNU/Linux 
distributions (i386, x86-64 & PPC) platforms and Windows (XP and above), but 
will probably run well on other UNIX-like systems (BSD, Solaris, etc.) and 
architectures too.

In order to build artha, as described above, you will need the following 
"development" libraries installed (typical binary package names are given 
within braces):

	- wordnet  	>= 3.0		(wordnet-dev)
	- glib     	>= 2.28		(libglib2.0-dev)
	- gtk+     	>= 2.24		(libgtk2.0-dev)
	- dbus-glib	>= 0.74		(libdbus-glib-1-dev)

WordNet can be obtained from http://wordnet.princeton.edu/download. Debian & 
Fedora based operating systems may have WordNet's development package in their 
repositories. WordNet 3.0 for Windows is not officially released by Princeton 
University, but can be downloaded from 
http://en.sourceforge.jp/projects/sfnet_wordnet30forwin/

Optionally, Artha will use the following "runtime" libraries, if they are 
available:
	- notify	(libnotify.so.4 / libnotify-1.dll)
	- enchant	(libenchant.so.4 / libenchant.dll)


These 2 libraries are not mandatory for building Artha; however if they are 
not present, additional features - passive desktop notifications and spelling 
suggestions - will not be exposed by Artha. libnotify is not offically 
released for Windows, so a minimal Win32 libnotify implementation was written 
and is now part of Artha (src/libnotify.c and src/libnotify.h).

You will need GNU's gcc and autotools (autoconf and automake) to build. On 
Windows one needs to setup MinGW, MSYS and GTK+ development headers.


Setting up the build system on Windows
--------------------------------------
Setting up MSYS on Windows is a pain, the author of this file didn't get it 
right easily, he went through many iterations to finally succeed. It is 
written here so that it is documented somewhere and anyone trying to do it 
will find it useful. Before beginning, remove all previous versions of MinGW, 
MSYS and GTK+ dev and meticulously follow the below steps.

Steps
~~~~~

1. Install the latest MinGW and MSYS from http://sourceforge.net/projects/
mingwbuilds/files/<host-windows/releases/> and <external-binary-packages/> 
respectively. Both are archived files that can be extracted to the root of 
C drive; it's better to stick to this directory.

2. Add C:\MinGW\bin to PATH. In a new command prompt, "gcc" should give you 
"gcc: fatal error: no input files".

3. Run C:\msys\msys.bat and try gcc, automake, autoconf commands to verify
if they work correctly.

4. Download the latest GTK+ Win32 development bundle from ftp.gnome.org or just 
google for gtk+-bundle_2.24.10-20120208_win32.zip. Extract it to C:/GTK+. Add 
the bin directory (C:/GTK+/bin) to PATH. Now start cmd (not MSYS) and give 

	pkg-config --cflags --libs gtk+-2.0

You should get a long list of directories and libraries names in the format 
understandable by GCC. "Yay! GTK+ is also done, I am all set now!" ~ No, still 
pkg-config won't work in MSYS. Need to fix that.

5. Create a new environment variable PKG_CONFIG_PATH and set its value to 
/c/gtk+/lib/pkgconfig (this is path is in MSYS directory format).

6. Now shoot up MSYS terminal and try the above pkg-config command, it should 
output the same output it gave in the cmd earlier window. There! Now you're 
golden!

Unlike Linux, where WordNet 3.0 development headers are available on many 
distros as a package in their repos, on Windows the official release by 
Princeton University is only 2.1; so download WordNet 3.0 for Linux and compile 
it on MSYS. Earlier the author of this file thought it isn't feasible, but thanks 
to a project he found @ http://en.sourceforge.jp/projects/sfnet_wordnet30forwin/ 
which proved otherwise.

The following source files of WordNet 3.0 needs to be compiled with adjustments
to DEFAULTDIR (../dict) macro in wn.h for the dict files to be found in Win32:
binsrch.c
morph.c
search.c
wnglobal.c
wnrtl.c
wnutil.c

Data files required are:
adj.exc
adv.exc
cntlist.rev
data.adj
data.adv
data.noun
data.verb
index.adj
index.adv
index.noun
index.sense
index.verb
noun.exc
sentidx.vrb
sents.vrb
verb.exc

When running the configure script, make sure you feed it with WordNet's 
path which contains the header (wn.h) and the static library (libwn.a).
E.g.

./configure CFLAGS="-I/D/artha/wn_3.0/inc/" LDFLAGS="-L/D/artha/wn_3.0/lib/"

It is to be noted that the paths are in MSYS's format and not the OS's native
format. This should satisfy configure when it looks for WordNet; pkg-config 
will do the same for GTK+, but for WordNet one has to give it manually.
