Attachment 'qt.py'
Download 1 ##################################################
2 #
3 # QT module
4 #
5 # Author: Jan Engels, DESY
6 # Date: Jan, 2007
7 #
8 ##################################################
9
10 # custom imports
11 from baseilc import BaseILC
12 from util import *
13
14
15 class QT(BaseILC):
16 """ Responsible for the QT installation process. """
17
18 def __init__(self, userInput="auto"):
19 BaseILC.__init__(self, userInput, "QT", "QT")
20
21 self.hasCMakeBuildSupport = False
22 self.hasCMakeFindSupport = True
23 self.download.supportHEAD = False
24 self.download.supportedTypes = ["wget"]
25
26 self.reqfiles = [
27 ["lib/libQtCore.so", "lib64/libQtCore.so", "lib/libQtCore.dylib", "lib/QtCore.la", \
28 "lib/qt-3.1/lib/libqt.so", "lib/qt-3.3/lib/libqt-mt.so"],
29 ["lib/libQtGui.so", "lib64/libQtGui.so", "lib/libQtGui.dylib", "lib/QtGui.la", \
30 "lib/qt-3.1/lib/libqui.so", "lib/qt-3.3/lib/libqui.so"],
31 ["bin/qmake"] ]
32
33 if( userInput=="auto" ):
34 self.autoDetect()
35
36 def autoDetectPath(self):
37 """ tries to auto detect qt dir from system settings.
38 - returns empty string in case of failure
39 - otherwise returns qt dir """
40
41 # if $QTDIR is set use it
42 if os.getenv("QTDIR",""):
43 return os.getenv("QTDIR")
44
45 # else try to get from qmake
46 if( isinPath("qmake")):
47 out = getoutput("which qmake").strip()
48 ind = out.find("/bin/qmake")
49 return out[:ind]
50
51 # nothing was found
52 return ''
53
54 def autoDetectVersion(self):
55 """ tries to auto detect version by parsing the output of qmake -v.
56 - returns empty string in case of failure
57 - otherwise returns qt version """
58
59 # qmake -v returns the qmake version and the qt version, it's the qt version we want
60 try:
61 v = Version( getoutput( self.realPath() + '/bin/qmake -v' ) ).versions[-1]
62 except:
63 return ''
64 else:
65 return str(v)
66
67
68 def setMode(self, mode):
69 BaseILC.setMode(self, mode)
70
71 if( Version( self.version ) < '4.6' ):
72 self.download.url = "http://download.qt-project.org/archive/qt/%s/qt-x11-opensource-src-%s.tar.gz" % (self.version[:3], self.version,)
73
74 if self.os_ver.type == "Darwin":
75 self.download.url = "http://download.qt-project.org/archive/qt/%s/qt-mac-opensource-src-%s.tar.gz" % (self.version[:3], self.version,)
76 else:
77 self.download.url = "http://download.qt.io/archive/qt/%s/qt-everywhere-opensource-src-%s.tar.gz" % (self.version[:3], self.version,)
78 #http://download.qt.io/official_releases/qt/%s/%s/qt-everywhere-opensource-src-%s.tar.gz" % (self.version[:3], self.version, self.version,)
79
80 def compile(self):
81 """ compile QT """
82
83 os.chdir( self.installPath )
84
85 if( self.rebuild ):
86 os.system( "make distclean" )
87
88 # qt_cfg_options = " -prefix-install -fast -make libs -no-separate-debug-info -no-xkb -no-xinerama -no-qt3support"
89 #fg: enable qt3-support (on request from Klaus)
90 qt_cfg_options = " -prefix-install -fast -make libs -no-separate-debug-info -no-xkb -no-xinerama"
91
92 if( Version( self.version ) < '4.5' ):
93 qt_cfg_options += " -no-tablet"
94
95 if( Version( self.version ) >= '4.4' ):
96 qt_cfg_options += " -no-webkit"
97
98 if( Version( self.version ) > '4.5' ):
99 qt_cfg_options += " -opensource"
100
101 if( os.system( "echo \"yes\" | ./configure -prefix " + self.installPath + qt_cfg_options
102 + " 2>&1 | tee -a " + self.logfile ) != 0 ):
103 self.abort( "failed to configure!!" )
104
105 if( os.system( "make ${MAKEOPTS} 2>&1 | tee -a " + self.logfile ) != 0 ):
106 self.abort( "failed to compile!!" )
107
108 def cleanupInstall(self):
109 BaseILC.cleanupInstall(self)
110 os.chdir( self.installPath )
111 os.system( "make clean" )
112
113 def postCheckDeps(self):
114 BaseILC.postCheckDeps(self)
115
116 self.envorder=[ "QTDIR" ]
117 self.env["QTDIR"] = self.installPath
118
119 self.env["QMAKESPEC"] = "$QTDIR/mkspecs/linux-g++"
120 self.envpath["PATH"].append( "$QTDIR/bin" )
121 self.envpath["LD_LIBRARY_PATH"].append( "$QTDIR/lib" )
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.