====== Psi+ on MS Windows (MinGW) ====== ===== Required tools for building process ===== 1. [[http://qt.nokia.com/downloads/sdk-windows-cpp-offline|Qt SDK for Open Source C++ development on Windows]]. Includes [[http://en.wikipedia.org/wiki/Qt|Qt]], [[http://en.wikipedia.org/wiki/MinGW|MinGW]], [[http://en.wikipedia.org/wiki/Qt_Creator|Qt Creator]] etc //~1.4 GB// {{:2011-09-23_114310.png|}} 2. [[http://code.google.com/p/msysgit/downloads/list|Win32 Git]] - utilities for working with Git //~12 MB// 3. [[http://www.openssl.org/source/|OpenSSL]] - the archive with source code of the software package for encryption and cryptography (required for OpenSSL compiling) //~4 MB// 4. [[http://www.sliksvn.com/en/download/|Slik SVN]] - utilities for working with SVN //~5 MB// 5. [[http://psi-dev.googlecode.com/files/lyx-windows-deps-mingw-small.zip|Aspell Libs for mingw]] - libraries for spell checking function //~65 MB// 6. [[http://tortoisesvn.net/downloads.html|TortoiseSVN]] - extension for MS Windows Explorer (optional) //~20 MB// 7. [[http://delta.affinix.com/qconf/|QConf]] - project configuration utility, compiled version qconf.exe can be found [[http://code.google.com/p/psi-dev/downloads/list?q=QConf+Windows|here)]] //~0.1 MB// **UNSTABLE** [[ftp://90.184.233.166/ccache.exe|ccache]] ([[http://psi-dev.googlecode.com/files/ccache-2.4-win32.zip|mirror]])-- a [[http://en.wikipedia.org/wiki/Ccache|tool]] to speed up builds, more information is [[http://forums.codeblocks.org/index.php/topic,12285.0.html|here]] ===== Preparations before building, setup environment variables and necessary libraries ===== * Install the necessary tools that are listed above (items 1-5). * Extract the folder **QConf** from the [[http://code.google.com/p/psi-dev/downloads/list?q=QConf+Windows|archive]] to **C:\Qt** * Extract the folders *include* and **lib** from the archive **lyx-windows-deps-mingw-small.zip** to **C:\Qt\2010.03\mingw** * Extract the file **ccache.exe** from the archive **ccache-2.4-win32.zip** to **C:\Qt\2010.03\qt\bin** * Edit the file **qmake.conf** from **C:\Qt\2010.03\qt\mkspecs\win32-g++**: from QMAKE_CC = gcc QMAKE_CXX = g++ to QMAKE_CC = ccache gcc QMAKE_CXX = ccache g++ * Under Computer Properties (Start → Settings → Control Panel → System Properties → Advanced → Environment Variables) add the path to the variable [[http://en.wikipedia.org/wiki/Path_%28variable%29|PATH]] (for all paths, in case you installed the software in a different folder, use the appropriate path to that folder): 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 ===== * Run a command line **cmd.exe** in administrator mode (Start → Run → cmd) * Check for the correct installation paths and variables: 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++ * Change the working folder to **C:\Qt\2010.03\qt\examples\tutorials\addressbook\part1** * At the command prompt **cmd.exe** execute command **qmake**, and then execute command **mingw32-make** 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 ===== * Extract the archive with the OpenSSL source code (from paragraph 8 of the required tools) to **C:\OpenSSL** * In the file **e_os2.h** change the line 263: 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) \ * Rename the file from **C:\Program Files\Git\bin\sh.exe** to **C:\Program Files\Git\bin\sh.ex_** * Run **cmd.exe**, change the working folder to **C:\OpenSSL** and start the process of compiling by the command **ms\mingw32** (package of paragraph 4 must be installed): 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 * Rename the file back from **C:\Program Files\Git\bin\sh.ex_** to **C:\Program Files\Git\bin\sh.exe** 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**. * Copy the library **libeay32.dll**, **libssl32.dll** and the contents of the folder **C:\OpenSSL\out** to the newly created folder **C:\OpenSSL\bin** * Copy from the folder **C:\OpenSSL\out** the files **libcrypto.a**, **libeay32.a**, **libssl32.a**, **libssl.a** to the newly created folder **C:\OpenSSL\lib\MinGW** The OpenSSL now is ready for linking with the Psi+. ===== Psi+ building in automatic mode (recommended) ===== * Download the script [[http://psi-dev.googlecode.com/svn/trunk/scripts/win32/make-psiplus.cmd|make-psiplus.cmd]] to new folder (for example, C:\psi-plus\build) * Run the script **make-psiplus.cmd** from the folder **C:\psi-plus\build** and wait for the end of its execution 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* ===== Psi+ building in manual mode (not recommended) ===== ==== Getting Psi source code ==== * Download the Psi source code from the official Psi git repository. To do this, run **cmd.exe** from folder **psi-git** and execute the following commands in order: 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 ==== * Uncomment the 3rd line in the file **psi-git/conf_windows.pri**: from #CONFIG += qca-static to CONFIG += qca-static * Uncomment the 26-th line: from #DEFINES += HAVE_ASPELL to DEFINES += HAVE_ASPELL * In the file **psi-git/third-party/qca/qca-ossl.pri** rename the key **-llibeay32** to **-leay32** * To enable plugins, uncomment the shown line in the file **psi-git/src/src.pro**: from #CONFIG += psi_plugins to CONFIG += psi_plugins * Optional: to switch from the Release to the Debug configuration it is necessary to change the second line in the file **psi-git/conf_windows.pri** from CONFIG += release to CONFIG += debug * Optional: to enable automatic calling of the debug console at the startup of Psi+ add the following line to the file **psi-git/src/src.pro**: CONFIG += console * Optional: to enable [[webkit|WebKit]] support in Psi+ add the following line in the file **psi-git/conf_windows.pri**: 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. * Run **cmd.exe** in the folder **psi-git** and execute commands the following commands in order: 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 [[http://psi-dev.googlecode.com/svn/trunk/patches/|list]]. ==== Psi+ building process ==== * Open the folder **psi-git** with the downloaded Psi source code files * In this folder execute the commands **qmake psi.pro** and **mingw32-make** (or **make clean** and **make**) 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): * For the release configuration the file size can range from 5 MB to 12 MB * For the debug configuration the file size can range from 30 MB to 60 MB ===== 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 ==== * Download the plugin source code from [[http://psi-dev.googlecode.com/svn/trunk/plugins/generic/conferenceloggerplugin|here]] * Copy the source code files in the folder **psi-git/src/plugins/generic/conferenceloggerplugin** * Execute the command **qmake conferenceloggerplugin.pro** * Execute the command **mingw32-make -f makefile.release** 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**. ===== Links ===== * http://psi-im.org/ * http://qt.nokia.com/ * [[http://technet.microsoft.com/ru-ru/sysinternals/bb896647%28en-us%29.aspx|DebugView for Windows]] * [[http://www.dependencywalker.com/|Dependency Walker for Windows]]