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
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.util.environment import EnvironmentModifications
import os
class Fsl(Package):
"""FSL is a comprehensive library of analysis tools for FMRI, MRI and DTI
brain imaging data.
Note: A manual download is required for FSL.
Spack will search your current directory for the download file.
Alternatively, add this file to a mirror so that Spack can find it.
For instructions on how to set up a mirror, see
http://spack.readthedocs.io/en/latest/mirrors.html"""
homepage = "https://fsl.fmrib.ox.ac.uk"
url = "file://{0}/fsl-5.0.10-sources.tar.gz".format(os.getcwd())
manual_download = True
version('5.0.10', '64823172a08aad679833240ba64c8e30')
depends_on('python', type=('build', 'run'))
depends_on('expat')
depends_on('libx11')
depends_on('glu')
depends_on('zlib')
depends_on('libpng')
depends_on('boost')
depends_on('sqlite')
conflicts('%gcc@6:', when='@5.0.10')
def patch(self):
# Uncomment lines in source file to allow building from source
with working_dir(join_path(self.stage.source_path, 'etc', 'fslconf')):
sourced = FileFilter('fsl.sh')
sourced.filter('#FSLCONFDIR', 'FSLCONFDIR')
sourced.filter('#FSLMACHTYPE', 'FSLMACHTYPE')
# Fix error in build script
buildscript = FileFilter('build')
buildscript.filter('mist-clean', 'mist')
def install(self, spec, prefix):
build = Executable('./build')
build()
install_tree('.', prefix)
def setup_build_environment(self, env):
if not self.stage.source_path:
self.stage.fetch()
self.stage.expand_archive()
env.set('FSLDIR', self.stage.source_path)
# Below is for sourcing purposes during building
fslsetup = join_path(self.stage.source_path, 'etc', 'fslconf',
'fsl.sh')
if os.path.isfile(fslsetup):
env.extend(EnvironmentModifications.from_sourcing_file(fslsetup))
def setup_run_environment(self, env):
# Here, run-time environment variables are being set manually.
# Normally these would be added to the modulefile at build-time
# by sourcing fsl.sh, but incorrect paths were being set, pointing to
# the staging directory rather than the install directory.
env.set('FSLDIR', self.prefix)
env.set('FSLOUTPUTTYPE', 'NIFTI_GZ')
env.set('FSLMULTIFILEQUIT', 'TRUE')
env.set('FSLTCLSH', self.prefix.bin.fsltclsh)
env.set('FSLWISH', self.prefix.bin.fslwish)
env.set('FSLLOCKDIR', '')
env.set('FSLMACHINELIST', '')
env.set('FSLREMOTECALL', '')
env.set('FSLGECUDAQ', 'cuda.q')
env.prepend_path('PATH', self.prefix)
|