Sunday 23 February 2014

Build PyQt4 for IDA 6.1 & Python 27

My Prebuild : https://mega.co.nz/#F!IN0TCAKD!dGZdKOL1OiNVjeDqz4GzvA
You will need these packages and programs:

1. MS Visual Studio 2010
2. Python27
3. Qt 4.8.5 SDK for Windows build with QT namespace
4. Sip 4.15.3 Source
5. PyQt4 4.10.3 (newest)


1. Compile sip

- Download SIP newest version from https://pypi.python.org/pypi/SIP
- unzip sip into C:\sip-4.xx.x (example : C:\sip-4.15.3)
- Open up the Visual Studio 2010 Command Prompt
+ Start > All Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt 2010
- Run the command to move to sip directory
+ cd C:\sip-4.xx.x (example cd C:\sip-4.15.3)
+ C:\Python27\python configure.py DEFINES+=QT_NAMESPACE=QT
Open C:\sip-4.xx.x\sipconfig.py and make sure DEFINES has been included QT_NAMESPACE
_default_macros = {
…........
'CXXFLAGS_WARN_OFF': '-W0',
'CXXFLAGS_WARN_ON': '-W3 -w34100 -w34189',
'DEFINES': 'UNICODE WIN32 QT_LARGEFILE_SUPPORT QT_NAMESPACE=QT',
'DEL_FILE': 'del',
…...........
}


Add there line before defiles.append(“QT_THREAD_SUPPORT”)

defines.append("QT_THREAD_SUPPORT")

defines.append("QT_NAMESPACE=QT")
# Handle library directories.
libdir_qt = self.optional_list("LIBDIR_QT")
libdir.extend(libdir_qt)
rpaths.extend(libdir_qt)

if qt_version >= 0x040000:

+ nmake
+ nmake install
Check if sip has been installed into Python27 directory:
C:\Python27\sip.exe
C:\Python27\Lib\site-packages\sipconfig.py
C:\Python27\Lib\site-packages\sip.pyd
C:\Python27\Lib\site-packages\sipdistutils.py
C:\Python27\Lib\site-packages\siputils.py

- Open python interpreter and check the modules by using:

from sip import *
print SIP_VERSION_STR

If it doesn't give any error messages about a DLL or something, it is installed correctly.

2. Compile PyQt4:
- Download PyQt4 4.10.3 Source
- Unzip the PyQt4 source to C:\PyQt-win-gpl-4.10.3
- Open Visual Studio 2010 Command Prompt
- Run the command below

set QTDIR=C:\Qt\4.8.5\
set PATH=%PATH%;C:\Qt\4.8.5\bin\
cd C:\PyQt-win-gpl-4.10.3
C:\Python27\python configure.py -w
Enter “yes” to the question
nmake
nmake install


If everything ok, you can check:

Open Python Interpreter

C:\>python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>> from PyQt4 import QtCore
>>>


If not, check if your PyQt has beeen install correctly or you must manual copy from compile project to Python27 directory.
You need to add the folder that contains Qt DLLs to the environment path variables, by using the Control Panel -> System -> Advanced -> Environment Variables



3. Nullsoft installer to make installable binary package:
    - Download and install Nullsoft installers latest version
    - Right click C:\PyQt-win-gpl-4.10.3\PyQt.nsi and select "Compile NSIS Script"
    ( unfortunatelly the script gives a lot of errors, you need to copy/paste some files and create folders by your self according to the complains of the compiler )

Credit: computerline1z@gmail.com

No comments: