Compling for Windows.
-----------------------------------
For Version V0.5.0+ we are switching to GPGme libraries.
This documents a clean compilation of V0.5 for Windows.

Tested on: WinXP July 2009.

You will need:
 * Qt4.5 Development Libraries (from TrollTech)
 * MinGw/MinSys full installation (from sourceforge.net)
 * Cygwin (for OpenSSL compilation / SVN / Unix Tools)
 * OpenSSL standard libraries.
 * GPG Windows Install (includes gpg.exe)
 * MiniUpnp library
 * gpgme Library.
 * libgpg-error Library.


This compilation is a little tricky as different environments 
are needed to compile different libraries.
a) Cygwin: libssl.a libcrypto.a
b) MinGW/MSYS: libgpg-error, libgpgme.a, libretroshare.a, libminiupnp.a
c) Qt/MinGW: Retroshare.exe


/***************** Installation of Development Tools **************/
In this section we install: cygwin, mingw/msys and Qt4.5

1) Install Cygwin 
	a) download the installer and run.
	b) be sure to select from the development packages:
		* mingw
		* svn
		* gcc/gdb
		* make
   links:
	http://www.cygwin.org/

2) install the MinGW/Msys package.
	a) Download MinGW-5.1.4 installer and run.
	b) Download MSYS-1.0.11 installer and run. 

   links:
	http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe
	http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
	http://www.mingw.org/
	http://sourceforge.net/projects/mingw/files/	

3) Install Qt4.5 LGPL Version. (Qt SDK 2009.03)
	a) Download from website and run.
	b) Select all options (including MinGW)

   links:
	http://www.qtsoftware.com/downloads

/***************** Installation of Development Tools **************/
/******************* Compiling Support Libraries ******************/

1) Compile OpenSSL using Cygwin.
	a) launch cygwin xterm
	b) untar openssl source package.
	c) Configure mingw
	d) make.

2) Compile gpg-error
	a) Download from gpg
	b) load up MinGW/MSYS Bash shell.
	c) extract code.
	d) configure
	e) make
	f) make install

	The library will end up in /local/lib
		
3) Compile gpgme
	a) Download from gpg
	b) load up MinGW/MSYS Bash shell.
	c) extract code.
	d) configure
	e) make
	f) make install

	The library will end up in /local/lib

		
4) Compile MiniUPnP.
	up to release v1.3 now.
   links:
	http://miniupnp.free.fr/
	http://miniupnp.free.fr/files/

5) Install pthreads

   links:
	http://sourceware.org/pthreads-win32/
	ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.exe

/******************* Compiling Support Libraries ******************/
/*********************** Compiling Retroshare *********************/

1) Setup Source Code TAR (TODO: Update for windows).
   This is useful as it provides a standard structure to work against, 
   we will update this with the required support libraries soon.

	a) Open MSYS Bash shell, and change to this location.
     c:/msys/1.0/home/XXX/retroshare
	b) create a working directory under this.
     1) c:/msys/1.0/home/XXX/miniupnpc-1.3
     2) c:/msys/1.0/home/XXX/pthreads-w32-2-8-0-release
     3) c:/msys/1.0/home/XXX/zlib-1.2.3
     4) c:/msys/1.0/home/XXX/gpgme-1.1.8
     5) c:/msys/1.0/home/XXX/libgpg-error-1.7
	c) Install OpenSSL to this directory (get from http://www.slproweb.com/download/Win32OpenSSL-0_9_8k.exe)
     1) c:/msys/1.0/home/XXX/OpenSSL
	d) get the latest svn trunk and unzip to (get from http://retroshare.svn.sourceforge.net/viewvc/retroshare/trunk.tar.gz) .
     1) c:/msys/1.0/home/XXX/retroshare

2) Compile libretroshare
	a) change to the libretroshare directory.
     1) cd c:/msys/1.0/home/XXX/retroshare/libretroshare/src
	b) modify support directory paths to point at correct locations.
     1) open scripts/config.mk and enable OS = Win # MinGw.
     2) open scripts/config-mingw.mk
     3) disable lines (line 20-29)
     4) enable lines 34-42 and 118-119
      #### Enable this section for compiling with MSYS/MINGW compile
      SRC_ROOT=/home/linux

      SSL_DIR=$(SRC_ROOT)/OpenSSL
      GPGME_DIR=$(SRC_ROOT)/gpgme-1.1.8
      GPG_ERROR_DIR=$(SRC_ROOT)/libgpg-error-1.7

      ZLIB_DIR=$(SRC_ROOT)/zlib-1.2.3
      UPNPC_DIR=$(SRC_ROOT)/miniupnpc-1.0
      PTHREADS_DIR=$(SRC_ROOT)/pthreads-w32-2-8-0-release
      
      ### Enable this for GPGME and GPG ERROR dirs
      CFLAGS += -I$(GPGME_DIR)/src
      CFLAGS += -I$(GPG_ERROR_DIR)/src
	 5) Edit your SRC_ROOT to your /home/xxxx dir
      

	c) compile libretroshare
      1) make

3) Copy all the required support libraries into the library directory:
		c:/msys/1.0/home/XXX/lib

		This should include:

		gpg-error / gpgme libraries:
				libgpg-error.a
				libgpg-error.dll.a
				libgpg-error.la
				libgpgme.dll.a
				libgpgme.la

		openssl libraries:
				libcrypto.a
				libssl.a

		miniupnpc / pthreads / libz

				libminiupnpc.a
				miniupnpc.dll
				libpthreadGCE2.a
				pthreadGCE2.dll
				libz.a

		extra library from cygwin. (renamed from libcrypt32.a)	
				libcrypt32-cygwin.a

		libretroshare
				libretroshare.a


4) Compile GUI.

/*********************** Compiling Retroshare *********************/
/************************ Running Retroshare **********************/

1) Collect Relevant DLL's with Application.
	a) make retroshare application directory.
	b) copy Retroshare.exe executable into directory.
	c) Copy required DLL's into that directory.
		These include:

		mingw runtime:
			mingwm10.dll

		gpgme/gpg-error:
			libgpg-error-0.dll
			libgpgme-11.dll

		other support libraries:
			miniupnpc.dll
			pthreadGCE2.dll

		Qt DLLs:
			QtCore4.dll, 
			QtGui4.dll,...
			etc.

	d) You should be able to run Retroshare from this directory now!	

2) Install gpg4win package... for gpg.exe

3) Create an OpenGPG identity using gpa or Enigmail or other PGP tool.

4) You should be able to use Retroshare on your PC now.

/************************ Running Retroshare **********************/
/******************************** FAQs ****************************/
Ask and it might be answered!
/******************************** FAQs ****************************/

This is obviously a work in progress - 
drBob.