Table of Contents

Psi+ on MS Windows (MinGW)

Required tools for building process

1. Qt SDK for Open Source C++ development on Windows. Includes Qt, MinGW, Qt Creator etc ~1.4 GB

2. Win32 Git - utilities for working with Git ~12 MB

3. OpenSSL - the archive with source code of the software package for encryption and cryptography (required for OpenSSL compiling) ~4 MB

4. Slik SVN - utilities for working with SVN ~5 MB

5. Aspell Libs for mingw - libraries for spell checking function ~65 MB

6. TortoiseSVN - extension for MS Windows Explorer (optional) ~20 MB

7. QConf - project configuration utility, compiled version qconf.exe can be found here) ~0.1 MB

UNSTABLE ccache (mirror)– a tool to speed up builds, more information is here

Preparations before building, setup environment variables and necessary libraries

from

QMAKE_CC		= gcc
QMAKE_CXX		= g++

to

QMAKE_CC		= ccache gcc
QMAKE_CXX		= ccache g++
C:\>path
PATH=C:\Qt\2010.03\qt\bin;C:\Qt\2010.03\mingw\bin;C:\OpenSSL\bin;C:\Program Files\SlikSvn\bin;C:\Program Files\TortoiseSVN\bin;C:\Qt\QConf;C:\strawberry\c\bin;C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\Program Files\Git\bin

as well as create these new environment variables (again, use the appropriate path if you installed the software somewhere else):

QMAKESPEC=win32-g++
QTDIR=C:\Qt\2010.03\qt
OPENSSLDIR=C:\OpenSSL
GITDIR=C:\Program Files\Git

Note: the updated variables will only be set for newly launched processes, ie you want to restart cmd in administrator mode (in extreme cases - reboot the system).

Verifying the installation and performance of Qt by building an example test application

C:\>qmake -v
QMake version 2.01a
Using Qt version 4.6.3 in C:/Qt/2010.03/qt/lib
C:\>echo %QMAKESPEC%
win32-g++
C:\Qt\2010.03\qt\examples\tutorials\addressbook\part1>qmake

C:\Qt\2010.03\qt\examples\tutorials\addressbook\part1>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/2010.03/qt/examples/tutorials/address
book/part1'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\part1.exe tmp/obj/debug_shared/
addressbook.o tmp/obj/debug_shared/main.o tmp/obj/debug_shared/moc_addressbook.o
  -L"c:\Qt\2010.03\qt\lib" -L"c:\Qt\2010.03\qt\lib" -lmingw32 -lqtmaind -lQtGuid
4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Qt/2010.03/qt/examples/tutorials/addressb
ook/part1'
mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory `C:/Qt/2010.03/qt/examples/tutorials/address
book/part1'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\part1.exe tmp/obj/rele
ase_shared/addressbook.o tmp/obj/release_shared/main.o tmp/obj/release_shared/mo
c_addressbook.o  -L"c:\Qt\2010.03\qt\lib" -L"c:\Qt\2010.03\qt\lib" -lmingw32 -lq
tmain -lQtGui4 -lQtCore4
mingw32-make[1]: Leaving directory `C:/Qt/2010.03/qt/examples/tutorials/addressb
ook/part1'

The result of the build of the release version of the test application can be found in the folder C:\Qt\2010.03\qt\examples\tutorials\addressbook\part1\release

A successful build of the test application means that Qt is correctly installed and ready for use.

OpenSSL Toolkit Compiling

from

#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
# define OPENSSL_IMPLEMENT_GLOBAL(type,name)			     \

to

#ifdef NEVER_OPENSSL_EXPORT_VAR_AS_FUNCTION
# define OPENSSL_IMPLEMENT_GLOBAL(type,name)			     \
C:\OpenSSL>ms\mingw32
...........................................
gcc -o tmp\prime.o -DMONOLITH -Ioutinc -Itmp -DL_ENDIAN -DDSO_WIN32 -fomit-frame
-pointer -O3 -march=i486 -Wall -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PA
RT_WORDS -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_SEED -DOPENSSL_NO_RC5 -DOPENSSL_NO_M
DC2 -DOPENSSL_NO_CMS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_KRB5 -
DOPENSSL_NO_DYNAMIC_ENGINE      -c .\apps\prime.c
gcc -o tmp\cms.o -DMONOLITH -Ioutinc -Itmp -DL_ENDIAN -DDSO_WIN32 -fomit-frame-p
ointer -O3 -march=i486 -Wall -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART
_WORDS -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_SEED -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC
2 -DOPENSSL_NO_CMS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_KRB5 -DO
PENSSL_NO_DYNAMIC_ENGINE      -c .\apps\cms.c
gcc -o tmp\openssl.o -DMONOLITH -Ioutinc -Itmp -DL_ENDIAN -DDSO_WIN32 -fomit-fra
me-pointer -O3 -march=i486 -Wall -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_
PART_WORDS -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_SEED -DOPENSSL_NO_RC5 -DOPENSSL_NO
_MDC2 -DOPENSSL_NO_CMS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_KRB5
 -DOPENSSL_NO_DYNAMIC_ENGINE      -c .\apps\openssl.c
gcc -o out\openssl  tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tm
p\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o
 tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\ec.o
 tmp\ecparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.
o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o t
mp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp
\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\cms.o tm
p\openssl.o  out\libssl.a out\libcrypto.a  -lwsock32 -lgdi32
Generating the DLLs and input libraries
Done compiling OpenSSL

The result of the build can be found in the folder C:\OpenSSL. There are compiled libraries libeay32.dll, libssl32.dll and other binary files in the folder C:\OpenSSL\out.

The OpenSSL now is ready for linking with the Psi+.

If the script worked successfully, then in the working directory *C:\psi-plus\build* there will be a compiled and ready to use binary file *psi.exe*

Getting Psi source code

git clone git://git.psi-im.org/psi.git
cd psi
git submodule init
git submodule update

Preparation of the Psi source code for building

from

#CONFIG += qca-static

to

CONFIG += qca-static

from

#DEFINES += HAVE_ASPELL 

to

DEFINES += HAVE_ASPELL 

from

#CONFIG += psi_plugins

to

CONFIG += psi_plugins

from

CONFIG += release

to

CONFIG += debug
CONFIG += console
CONFIG += webkit

Applying patches to the Psi source code

Before using GNU/Patch for Windows consider the following:

On MS-Windows, the patchfile must be a text file, i.e. CR-LF must be used as line endings.
A file with LF may give the error: “Assertion failed, hunk, file patch.c, line 343,” unless the option ‘–binary’ is given.
patch -p1 < 0000-psiplus-aboutdlg.diff
patch -p1 < 0010-less-includes.diff
patch -p1 < 0020-psi-iconsets.diff
patch -p1 < 0030-psi-webkit.diff
patch -p1 < 0040-psi-muc-topic.diff
patch -p1 < 0050-psi-receipts.diff
patch -p1 < 0060-psi-popup-avatar.diff
patch -p1 < 0070-psi-entity-time.diff
patch -p1 < 0080-psi-mood-icons.diff
patch -p1 < 0090-psi-muc-change-affiliation.diff
.....................

Note: Before downloading and applying patches, it is strongly recommended to check the file name with the current list.

Psi+ building process

After some time (10 - 40 minutes), look for result of the compilation with the name psi.exe in the folder psi-git/src/release.

Note: the file size of psi.exe may be different (depend on the debug/release configuration type):

Plugins compiling

For example, consider the compiling of following plugin.

*_Note:_* For a correct plugin compilation one must first download and patch the Psi source code

Conference Logger Plugin

C:\psi-plus\build\psi\src\plugins\generic\conferenceloggerplugin>qmake conferenceloggerplugin.pro

C:\psi-plus\build\psi\src\plugins\generic\conferenceloggerplugin>mingw32-make -f makefile.release
...................
C:/Qt/2010.03/qt/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_D
EBUG -DQT_PLUGIN -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I'
c:/Qt/2010.03/qt/include/QtCore' -I'c:/Qt/2010.03/qt/include/QtGui' -I'c:/Qt/201
0.03/qt/include/QtXml' -I'c:/Qt/2010.03/qt/include' -I'../../include' -I'c:/Qt/2
010.03/qt/include/ActiveQt' -I'release' -I'c:/Qt/2010.03/qt/mkspecs/win32-g++' -
D__GNUC__ -DWIN32 typeaheadfind.h -o release/moc_typeaheadfind.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_
THREAD_SUPPORT -I'c:/Qt/2010.03/qt/include/QtCore' -I'c:/Qt/2010.03/qt/include/Q
tGui' -I'c:/Qt/2010.03/qt/include/QtXml' -I'c:/Qt/2010.03/qt/include' -I'../../i
nclude' -I'c:/Qt/2010.03/qt/include/ActiveQt' -I'release' -I'c:/Qt/2010.03/qt/mk
specs/win32-g++' -o release/moc_typeaheadfind.o release/moc_typeaheadfind.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,release/libconferenceloggerplug
in.a -o release/conferenceloggerplugin.dll release/conferenceloggerplugin.o rele
ase/typeaheadfind.o release/moc_typeaheadfind.o  -L'c:/Qt/2010.03/qt/lib' -lQtXm
l4 -lQtGui4 -lQtCore4
Creating library file: release/libconferenceloggerplugin.a

The compiled plugin conferenceloggerplugin.dll can be found in the folder psi-git/src/plugins/generic/conferenceloggerplugin/release.