Skip to content

Commit

Permalink
Improve EVIO handling in SCons
Browse files Browse the repository at this point in the history
- Find preinstalled EVIO under $CODA, not $EVIO_LIBDIR/INCDIR.
  The behavior is now identical to that of the Make system.
- Patch EVIO download for SCons 3.0, enclosing print args in parentheses
- Only build C API library (much faster than building all of EVIO)
- Better structuring of local installation sequence
  • Loading branch information
hansenjo committed Sep 28, 2017
1 parent 204251a commit 1bc2030
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 29 deletions.
56 changes: 27 additions & 29 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -83,55 +83,53 @@ baseenv.Append(BUILDERS = {'RootCint': bld})
#
# evio environment
#
evio_libdir = os.getenv('EVIO_LIBDIR')
evio_incdir = os.getenv('EVIO_INCDIR')
if evio_libdir is None or evio_incdir is None:
uname = os.uname();
platform = uname[0];
machine = uname[4];
evio_arch = platform + '-' + machine
coda_dir = os.getenv('CODA')
if coda_dir is None:
print ("No external EVIO environment configured !!!")
print ("EVIO_LIBDIR = %s" % evio_libdir)
print ("EVIO_INCDIR = %s" % evio_incdir)
print ("Using local installation ... ")
evio_version = '4.4.6'
evio_local = baseenv.subst('$HA_DIR')+'/evio'
evio_local_lib = "%s/evio-%s/src/libsrc/.%s" % (evio_local,evio_version,evio_arch)
evio_local_inc = "%s/evio-%s/src/libsrc" % (evio_local,evio_version)
evio_tarfile = "%s/evio-%s.tar.gz" % (evio_local,evio_version)
evio_command_dircreate = "mkdir -p %s" % (evio_local)
os.system(evio_command_dircreate)
evio_version = '4.4.6'
uname = os.uname();
platform = uname[0];
machine = uname[4];
evio_name = platform + '-' + machine
print ("evio_name = %s" % evio_name)
evio_local_lib = "%s/evio-%s/%s/lib" % (evio_local,evio_version,evio_name)
evio_local_inc = "%s/evio-%s/%s/include" % (evio_local,evio_version,evio_name)
evio_tarfile = "%s/evio-%s.tar.gz" % (evio_local,evio_version)

####### Check to see if scons -c has been called #########

if baseenv.GetOption('clean'):
subprocess.call(['echo', '!!!!!!!!!!!!!! EVIO Cleaning Process !!!!!!!!!!!! '])
evio_command_scons = "rm -f libevio*.*; cd %s; rm -rf evio-%s" % (evio_local,evio_version)
print ("evio_command_scons = %s" % evio_command_scons)
os.system(evio_command_scons)
evio_command_cleanup = "rm -f libevio*.*; cd %s; rm -rf evio-%s" % (evio_local,evio_version)
print ("evio_command_cleanup = %s" % evio_command_cleanup)
os.system(evio_command_cleanup)
else:
if not os.path.isdir(evio_local_lib):
if not os.path.exists(evio_tarfile):
evio_command_scons = "cd %s; curl -LO https://github.com/JeffersonLab/hallac_evio/archive/evio-%s.tar.gz; tar xvfz evio-%s.tar.gz; mv hallac_evio-evio-%s evio-%s; cd evio-%s/ ; scons install --prefix=." % (evio_local,evio_version,evio_version,evio_version,evio_version,evio_version)
else:
evio_command_scons = "cd %s; tar xvfz evio-%s.tar.gz; mv hallac_evio-evio-%s evio-%s; cd evio-%s/ ; scons install --prefix=." % (evio_local,evio_version,evio_version,evio_version,evio_version)
else:
evio_command_scons = "cd %s; cd evio-%s/ ; scons install --prefix=." % (evio_local,evio_version)
evio_command_download = "cd %s; curl -LO https://github.com/JeffersonLab/hallac_evio/archive/evio-%s.tar.gz" % (evio_local,evio_version)
print ("evio_command_download = %s" % evio_command_download)
os.system(evio_command_download)

evio_command_unpack = "cd %s; tar xvfz evio-%s.tar.gz; mv hallac_evio-evio-%s evio-%s; patch -p0 < evio-4.4.6-scons-3.0.patch" % (evio_local,evio_version,evio_version,evio_version)
print ("evio_command_unpack = %s" % evio_command_unpack)
os.system(evio_command_unpack)

evio_command_scons = "cd %s/evio-%s; scons src/libsrc/.%s/" % (evio_local,evio_version,evio_arch)
print ("evio_command_scons = %s" % evio_command_scons)
os.system(evio_command_scons)
evio_local_lib_files = "%s/*.*" % (evio_local_lib)
evio_command_libcopy = "cp %s ." % (evio_local_lib_files)
evio_local_lib_files = "%s/libevio.*" % (evio_local_lib)
evio_command_libcopy = "cp -vf %s ." % (evio_local_lib_files)
print ("evio_command_libcopy = %s" % evio_command_libcopy)
os.system(evio_command_libcopy)

baseenv.Append(EVIO_LIB = evio_local_lib)
baseenv.Append(EVIO_INC = evio_local_inc)
else:
# evio_command_scons = "cd %s; scons install --prefix=." % evio_instdir
# os.system(evio_command_scons)
baseenv.Append(EVIO_LIB = os.getenv('EVIO_LIBDIR'))
baseenv.Append(EVIO_INC = os.getenv('EVIO_INCDIR'))
baseenv.Append(EVIO_LIB = coda_dir + '/' + evio_arch + '/lib')
baseenv.Append(EVIO_INC = coda_dir + '/' + evio_arch + '/include')

print ("EVIO lib Directory = %s" % baseenv.subst('$EVIO_LIB'))
print ("EVIO include Directory = %s" % baseenv.subst('$EVIO_INC'))
baseenv.Append(CPPPATH = ['$EVIO_INC'])
Expand Down
90 changes: 90 additions & 0 deletions evio/evio-4.4.6-scons-3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
--- evio-4.4.6/SConstruct 2017-09-18 16:38:42.000000000 -0400
+++ evio-4.4.6/SConstruct.scons3 2017-09-28 19:07:12.000000000 -0400
@@ -50,9 +50,9 @@
# a configure-type test.
is64bits = coda.is64BitMachine(env, platform, machine)
if is64bits:
- print "We're on a 64-bit machine"
+ print ("We're on a 64-bit machine")
else:
- print "We're on a 32-bit machine"
+ print ("We're on a 32-bit machine")


#############################################
@@ -65,25 +65,25 @@
# debug option
AddOption('--dbg', dest='ddebug', default=False, action='store_true')
debug = GetOption('ddebug')
-if debug: print "Enable debugging"
+if debug: print ("Enable debugging")
Help('--dbg compile with debug flag\n')

# vxworks 5.5 option
AddOption('--vx5.5', dest='doVX55', default=False, action='store_true')
useVxworks55 = GetOption('doVX55')
-if useVxworks55: print "Use vxWorks version 5.5"
+if useVxworks55: print ("Use vxWorks version 5.5")
Help('--vx5.5 cross compile for vxworks 5.5\n')

# vxworks 6.0 option
AddOption('--vx6.0', dest='doVX60', default=False, action='store_true')
useVxworks60 = GetOption('doVX60')
-if useVxworks60: print "Use vxWorks version 6.0"
+if useVxworks60: print ("Use vxWorks version 6.0")
Help('--vx6.0 cross compile for vxworks 6.0\n')

# 32 bit option
AddOption('--32bits', dest='use32bits', default=False, action='store_true')
use32bits = GetOption('use32bits')
-if use32bits: print "use 32-bit libs & executables even on 64 bit system"
+if use32bits: print ("use 32-bit libs & executables even on 64 bit system")
Help('--32bits compile 32bit libs & executables on 64bit system\n')

# install directory option
@@ -153,7 +153,7 @@
osname = 'vxworks'+ str(vxVersion) + '-ppc'

if not coda.configureVxworks(env, vxVersion, platform):
- print '\nCannot set enviroment for vxWorks ' + str(vxVersion) + ', exiting\n'
+ print ('\nCannot set enviroment for vxWorks ' + str(vxVersion) + ', exiting\n')
Exit(0)

else:
@@ -175,7 +175,7 @@
if is64bits and use32bits and not useVxworks:
osname = osname + '-32'

-print "OSNAME =", osname
+print ("OSNAME =", osname)

# hidden sub directory into which variant builds go
archDir = '.' + osname + debugSuffix
@@ -212,13 +212,13 @@
# Create the include directories (make symbolic link if possible)
coda.makeIncludeDirs(incInstallDir, archIncInstallDir, osDir, archIncLocalLink)

- print 'Main install dir = ', mainInstallDir
- print 'bin install dir = ', binInstallDir
- print 'lib install dir = ', libInstallDir
- print 'inc install dirs = ', incInstallDir, ", ", archIncInstallDir
+ print ('Main install dir = ', mainInstallDir)
+ print ('bin install dir = ', binInstallDir)
+ print ('lib install dir = ', libInstallDir)
+ print ('inc install dirs = ', incInstallDir, ", ", archIncInstallDir)

else:
- print 'No installation being done'
+ print ('No installation being done')

print

@@ -253,7 +253,7 @@

if 'tar' in COMMAND_LINE_TARGETS:
if platform == 'SunOS':
- print '\nMake tar file from Linux or MacOS please\n'
+ print ('\nMake tar file from Linux or MacOS please\n')
Exit(0)
coda.generateTarFile(env, 'evio', versionMajor, versionMinor)

0 comments on commit 1bc2030

Please sign in to comment.