forked from iLCSoft/iLCInstall
-
Notifications
You must be signed in to change notification settings - Fork 1
/
clhep.py
97 lines (69 loc) · 3.56 KB
/
clhep.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
##################################################
#
# CLHEP module
#
# Author: Jan Engels, DESY
# Date: Jan, 2007
#
##################################################
# custom imports
from .baseilc import BaseILC
from .util import *
class CLHEP(BaseILC):
""" Responsible for the CLHEP installation process. """
def __init__(self, userInput, version=''):
BaseILC.__init__(self, userInput, "CLHEP", "CLHEP")
self.download.supportHEAD = False
self.download.supportedTypes = ["wget"]
self.reqfiles = [ ["lib/libCLHEP.a", "lib/libCLHEP.so", "lib64/libCLHEP.so", "lib/libCLHEP.dylib"] ]
if(len(version)>0):
self.version = version
def setMode(self, mode):
BaseILC.setMode(self, mode)
if( self.mode == "install" ):
if( Version( self.version ) < "1.9.1.1" ):
self.abort( "ilcinstall only supports installation of CLHEP 1.9.1.1 or greater!" )
if( Version( self.version ) == "2.0.3.0" and not isinPath( "xiar" )):
self.abort( "CLHEP 2.0.3.0 requires xiar, that wasn't found in your system!" )
# download url
if( Version( self.version ) == "1.9.1.1" or Version( self.version ) == "2.0.1.1" ):
self.download.url = "http://proj-clhep.web.cern.ch/proj-clhep/export/share/CLHEP/%s/clhep-%s.tgz" \
% (self.version, self.version)
else:
self.download.url = "http://proj-clhep.web.cern.ch/proj-clhep/dist1/clhep-%s.tgz" \
% (self.version,)
if( Version( self.version ) >= "2.1.3.0" ):
self.hasCMakeBuildSupport = True
self.cmakeconfig = self.installPath + "/lib/CLHEP-" + self.version
def downloadSources(self):
BaseILC.downloadSources(self)
def compile(self):
""" compile CLHEP """
trymakedir( self.buildPath )
os.chdir( self.buildPath )
if( Version( self.version ) < "2.1.3.0" ):
if( os_system( "../CLHEP/configure --prefix=" + self.installPath + " 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to configure!!" )
else:
if( self.rebuild ):
tryunlink( "CMakeCache.txt" )
# build software
#fg: new clhep source is in extra subdirectory CLHEP ; default INSTALL_PREFIX is /usr/
if( os_system( self.genCMakeCmd() + "/CLHEP -DCMAKE_INSTALL_PREFIX=" + self.installPath + " 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to configure!!" )
if( os_system( "make ${MAKEOPTS} 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to compile!!" )
if( os_system( "make install 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to install!!" )
def cleanupInstall(self):
BaseILC.cleanupInstall(self)
os.chdir( self.buildPath )
os_system( "make clean" )
def postCheckDeps(self):
BaseILC.postCheckDeps(self)
self.envorder = [ "CLHEP" ]
self.env["CLHEP"] = self.installPath
self.env["CLHEP_BASE_DIR"] = "$CLHEP"
self.env["CLHEP_INCLUDE_DIR"] = "$CLHEP/include"
self.envpath["PATH"].append( "$CLHEP_BASE_DIR/bin" )
self.envpath["LD_LIBRARY_PATH"].append( "$CLHEP_BASE_DIR/lib" )