diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-09 14:41:53 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-08-30 01:46:07 +0200 |
commit | 30478c3449ace639ec126608c2880681037dbd3b (patch) | |
tree | e105b4600a8184613466f040853dff3c757a8953 /kde.py | |
parent | 48b524d2bcb27fa0cba43eed45650894759efea3 (diff) | |
download | kstreamripper-30478c3449ace639ec126608c2880681037dbd3b.tar.gz kstreamripper-30478c3449ace639ec126608c2880681037dbd3b.zip |
Update scons to handle TDE
This closes Bug 946
(cherry picked from commit 8f11ba72a15eea0833f18636ef3cc7dd9ab679a4)
Diffstat (limited to 'kde.py')
-rw-r--r-- | kde.py | 117 |
1 files changed, 65 insertions, 52 deletions
@@ -38,42 +38,50 @@ def detect_kde(env): kdelibs = env['ARGS'].get('kdelibs', None) qtincludes = env['ARGS'].get('qtincludes', None) qtlibs = env['ARGS'].get('qtlibs', None) + kdedir = env['ARGS'].get('kdedir', None) if libdir: libdir = libdir+libsuffix ## Detect the kde libraries print "Checking for kde-config : ", - kde_config = os.popen("which kde-config 2>/dev/null").read().strip() + str="which kde-config 2>/dev/null" + if kdedir: str="which %s 2>/dev/null" % (kdedir+'/bin/kde-config') + kde_config = os.popen(str).read().strip() if len(kde_config): - print GREEN+"kde-config was found"+NORMAL + print GREEN + 'kde-config was found as ' + kde_config else: - print RED+"kde-config was NOT found in your PATH"+NORMAL + if kdedir: print RED + 'kde-config was NOT found in the folder given ' + kdedir + else: print RED + 'kde-config was NOT found in your PATH' print "Make sure kde is installed properly" print "(missing package kdebase-devel?)" env.Exit(1) - env['KDEDIR'] = os.popen('kde-config -prefix').read().strip() + if kdedir: env['KDEDIR']=kdedir + else: env['KDEDIR'] = os.popen(kde_config+' -prefix').read().strip() print "Checking for kde version : ", - kde_version = os.popen("kde-config --version|grep KDE").read().strip().split()[1] + kde_version = os.popen(kde_config + " --version|grep KDE").read().strip().split()[1] + kde_major = kde_version.split('.')[0].lstrip('R') + kde_minor = kde_version.split('.')[1] + kde_patch = kde_version.split('.')[2] try: - env['KDEm1']=int(kde_version[0]) + env['KDEm1']=int(kde_major) except: pass try: - env['KDEm2']=int(kde_version[2]) + env['KDEm2']=int(kde_minor) except: pass try: - env['KDEm3']=int(kde_version[4]) + env['KDEm3']=int(kde_patch) except: pass - if int(kde_version[0]) != 3 or int(kde_version[2]) < 2: - print RED+kde_version - print RED+"Your kde version can be too old"+NORMAL - print RED+"Please make sure kde is at least 3.2"+NORMAL + if int(kde_major) != 3 or int(kde_minor) < 2: + print RED + kde_version + print RED + "Your kde version might be too old" + NORMAL + print RED + "Please make sure TDE is at least 3.2" + NORMAL else: - print GREEN+kde_version+NORMAL + print GREEN + kde_version + NORMAL ## Detect the qt library print "Checking for the qt library : ", @@ -81,9 +89,13 @@ def detect_kde(env): if qtdir: print GREEN+"qt is in "+qtdir+NORMAL else: - libdir = os.popen('kde-config --expandvars --install lib').read().strip() + libdir = os.popen(kde_config + ' --expandvars --install lib').read().strip() libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la') - m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2]) + try: + m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2]) + except: + m = re.search('(.*)/lib/libtqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libtqt').read().strip().split()[2]) + pass if m: qtdir = m.group(1) print YELLOW+"qt was found as "+m.group(1)+NORMAL @@ -94,7 +106,7 @@ def detect_kde(env): env['QTDIR'] = qtdir.strip() ## Find the necessary programs uic-tqt and moc - print "Checking for uic-tqt : ", + print "Checking for uic-tqt : ", uic = qtdir + "/bin/uic-tqt" if os.path.isfile(uic): print GREEN+"uic-tqt was found as "+uic+NORMAL @@ -129,7 +141,7 @@ def detect_kde(env): ## check for the qt and kde includes print "Checking for the qt includes : ", - if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"): + if qtincludes and os.path.isfile(qtincludes + "/tqlayout.h"): # The user told where to look for and it looks valid print GREEN + "ok " + qtincludes + NORMAL else: @@ -137,10 +149,10 @@ def detect_kde(env): # Automatic detection print GREEN + "ok " + qtdir + "/include/ " + NORMAL qtincludes = qtdir + "/include/" - elif os.path.isfile("/usr/include/qt3/qlayout.h"): + elif os.path.isfile("/usr/include/tqt/tqlayout.h"): # Debian probably - print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL - qtincludes = "/usr/include/qt3" + print YELLOW + "the qt headers were found in /usr/include/tqt/ " + NORMAL + qtincludes = "/usr/include/tqt" elif os.path.isfile("/usr/include/qt4/Qt/qglobal.h"): # Debian probably print YELLOW + "the qt headers were found in /usr/include/qt4/ " + NORMAL @@ -150,7 +162,7 @@ def detect_kde(env): env.Exit(1) print "Checking for the kde includes : ", - kdeprefix = os.popen("kde-config --prefix").read().strip() + kdeprefix = os.popen(kde_config + " --prefix").read().strip() if not kdeincludes: kdeincludes = kdeprefix+"/include/" if os.path.isfile(kdeincludes + "/klineedit.h"): @@ -175,42 +187,42 @@ def detect_kde(env): subst_vars = lambda x: x.replace('${exec_prefix}', execprefix).replace('${datadir}',datadir).replace('${libdir}', libdir) debian_fix = lambda x: x.replace('/usr/share', '${datadir}') - env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip()) - env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip()) - env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip()) - env['KDEMODULE']= subst_vars(os.popen('kde-config --install module').read().strip()) - env['KDELOCALE']= subst_vars(os.popen('kde-config --install locale').read().strip()) - env['KDEDOC'] = subst_vars( debian_fix(os.popen('kde-config --install html').read().strip()) ) - env['KDEKCFG'] = subst_vars(os.popen('kde-config --install kcfg').read().strip()) - env['KDEXDG'] = subst_vars(os.popen('kde-config --install xdgdata-apps').read().strip()) - env['KDEXDGDIR']= subst_vars(os.popen('kde-config --install xdgdata-dirs').read().strip()) - env['KDEMENU'] = subst_vars(os.popen('kde-config --install apps').read().strip()) - env['KDEMIME'] = subst_vars(os.popen('kde-config --install mime').read().strip()) - env['KDEICONS'] = subst_vars(os.popen('kde-config --install icon').read().strip()) - env['KDESERV'] = subst_vars(os.popen('kde-config --install services').read().strip()) + env['KDEBIN'] = subst_vars(os.popen(kde_config + ' --install exe').read().strip()) + env['KDEAPPS'] = subst_vars(os.popen(kde_config + ' --install apps').read().strip()) + env['KDEDATA'] = subst_vars(os.popen(kde_config + ' --install data').read().strip()) + env['KDEMODULE']= subst_vars(os.popen(kde_config + ' --install module').read().strip()) + env['KDELOCALE']= subst_vars(os.popen(kde_config + ' --install locale').read().strip()) + env['KDEDOC'] = subst_vars( debian_fix(os.popen(kde_config + ' --install html').read().strip()) ) + env['KDEKCFG'] = subst_vars(os.popen(kde_config + ' --install kcfg').read().strip()) + env['KDEXDG'] = subst_vars(os.popen(kde_config + ' --install xdgdata-apps').read().strip()) + env['KDEXDGDIR']= subst_vars(os.popen(kde_config + ' --install xdgdata-dirs').read().strip()) + env['KDEMENU'] = subst_vars(os.popen(kde_config + ' --install apps').read().strip()) + env['KDEMIME'] = subst_vars(os.popen(kde_config + ' --install mime').read().strip()) + env['KDEICONS'] = subst_vars(os.popen(kde_config + ' --install icon').read().strip()) + env['KDESERV'] = subst_vars(os.popen(kde_config + ' --install services').read().strip()) else: # the user has given no prefix, install as a normal kde app - env['PREFIX'] = os.popen('kde-config --prefix').read().strip() - env['KDEBIN'] = os.popen('kde-config --expandvars --install exe').read().strip() - env['KDEAPPS'] = os.popen('kde-config --expandvars --install apps').read().strip() - env['KDEDATA'] = os.popen('kde-config --expandvars --install data').read().strip() - env['KDEMODULE']= os.popen('kde-config --expandvars --install module').read().strip() - env['KDELOCALE']= os.popen('kde-config --expandvars --install locale').read().strip() - env['KDEDOC'] = os.popen('kde-config --expandvars --install html').read().strip() - env['KDEKCFG'] = os.popen('kde-config --expandvars --install kcfg').read().strip() - env['KDEXDG'] = os.popen('kde-config --expandvars --install xdgdata-apps').read().strip() - env['KDEXDGDIR']= os.popen('kde-config --expandvars --install xdgdata-dirs').read().strip() - env['KDEMENU'] = os.popen('kde-config --expandvars --install apps').read().strip() - env['KDEMIME'] = os.popen('kde-config --expandvars --install mime').read().strip() - env['KDEICONS'] = os.popen('kde-config --expandvars --install icon').read().strip() - env['KDESERV'] = os.popen('kde-config --expandvars --install services').read().strip() - - env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip() + env['PREFIX'] = os.popen(kde_config + ' --prefix').read().strip() + env['KDEBIN'] = os.popen(kde_config + ' --expandvars --install exe').read().strip() + env['KDEAPPS'] = os.popen(kde_config + ' --expandvars --install apps').read().strip() + env['KDEDATA'] = os.popen(kde_config + ' --expandvars --install data').read().strip() + env['KDEMODULE']= os.popen(kde_config + ' --expandvars --install module').read().strip() + env['KDELOCALE']= os.popen(kde_config + ' --expandvars --install locale').read().strip() + env['KDEDOC'] = os.popen(kde_config + ' --expandvars --install html').read().strip() + env['KDEKCFG'] = os.popen(kde_config + ' --expandvars --install kcfg').read().strip() + env['KDEXDG'] = os.popen(kde_config + ' --expandvars --install xdgdata-apps').read().strip() + env['KDEXDGDIR']= os.popen(kde_config + ' --expandvars --install xdgdata-dirs').read().strip() + env['KDEMENU'] = os.popen(kde_config + ' --expandvars --install apps').read().strip() + env['KDEMIME'] = os.popen(kde_config + ' --expandvars --install mime').read().strip() + env['KDEICONS'] = os.popen(kde_config + ' --expandvars --install icon').read().strip() + env['KDESERV'] = os.popen(kde_config + ' --expandvars --install services').read().strip() + + env['QTPLUGINS']=os.popen(kde_config + ' --expandvars --install qtplugins').read().strip() ## kde libs and includes env['KDEINCLUDEPATH']=kdeincludes if not kdelibs: - kdelibs=os.popen('kde-config --expandvars --install lib').read().strip() + kdelibs=os.popen(kde_config + ' --expandvars --install lib').read().strip() env['KDELIBPATH']=kdelibs ## qt libs and includes @@ -230,6 +242,7 @@ def generate(env): """+BOLD+"""* execprefix """+NORMAL+""": install path for binaries, ie: /usr/bin """+BOLD+"""* datadir """+NORMAL+""": install path for the data, ie: /usr/local/share """+BOLD+"""* libdir """+NORMAL+""": install path for the libs, ie: /usr/lib +"""+BOLD+"""* kdedir """+NORMAL+""": path to TDE directory, ie: /opt/trinity """+BOLD+"""* libsuffix """+NORMAL+""": suffix of libraries on amd64, ie: 64, 32 """+BOLD+"""* kdeincludes"""+NORMAL+""": path to the kde includes (/usr/include/kde on debian, ...) """+BOLD+"""* qtincludes """+NORMAL+""": same punishment, for qt includes (/usr/include/qt on debian, ...) @@ -452,7 +465,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt act.append('cat '+target[1].path+'.tmp >> '+target[1].path) act.append('rm -f '+target[1].path+'.tmp') act.append('echo \'#include "' + target[2].name + '"\' >> '+target[1].path) - act.append('$QT_MOC -o '+target[2].path+' '+target[0].path) + act.append('moc-tqt $QT_MOC -o '+target[2].path+' '+target[0].path) return act def uicEmitter(target, source, env): |