|
| 1 | +from spack import * |
| 2 | +import os |
| 3 | +import tarfile |
| 4 | + |
| 5 | + |
| 6 | +class Fluka(Package): |
| 7 | + """FLUKA is a general purpose Monte Carlo code for the interaction |
| 8 | + and transport of hadrons, leptons, and photons from keV (with the |
| 9 | + exception of neutrons, tracked down to thermal energies) to cosmic |
| 10 | + ray energies in any material. |
| 11 | +
|
| 12 | + Note: A manual download is required for FLUKA. |
| 13 | + Spack will search your current directory for the download file. |
| 14 | + Alternatively, add this file to a mirror so that Spack can find it. |
| 15 | + For instructions on how to set up a mirror, see |
| 16 | + http://spack.readthedocs.io/en/latest/mirrors.html""" |
| 17 | + |
| 18 | + homepage = "https://fluka.cern" |
| 19 | + url = "https://flukafiles.web.cern.ch/flukafiles/fluka-4-1.1/fluka-4-1.1.Linux-gfor9.tgz" |
| 20 | + |
| 21 | + maintainers = ['wdconinc'] |
| 22 | + |
| 23 | + version('4.1.1', |
| 24 | + sha256='68cc4b81c04fe2d37f4e7ebeb0f8dfd452e1d8558cae8a611a9e1d7a93613f71', |
| 25 | + url='file://{0}/fluka-4-1.1.Linux-gfor9.tgz'.format(os.getcwd())) |
| 26 | + |
| 27 | + conflicts('%gcc@:7', when='@4.1.1') |
| 28 | + |
| 29 | + gfor_ver = { |
| 30 | + '4.1.1': '9', |
| 31 | + } |
| 32 | + |
| 33 | + manual_download = True |
| 34 | + |
| 35 | + def url_for_version(self, version): |
| 36 | + url = "https://flukafiles.web.cern.ch/flukafiles/fluka-{0}-{1}.fluka-{0}-{1}.Linux-gfor{2}.tgz" |
| 37 | + return url.format(version[0], version[1:], gfor_ver[version]) |
| 38 | + |
| 39 | + def install(self, spec, prefix): |
| 40 | + with working_dir('src'): |
| 41 | + make() |
| 42 | + install_tree('bin', prefix.bin) |
| 43 | + install_tree('lib', prefix.lib) |
| 44 | + install_tree('data', prefix.data) |
| 45 | + install_tree('include', prefix.include) |
| 46 | + install_tree('doc', join_path(prefix.share, 'doc')) |
| 47 | + install_tree('examples', join_path(prefix.share, 'examples')) |
| 48 | + for file in ['AUTHORS', 'INSTALL', 'LICENSE', 'REFERENCES', |
| 49 | + 'RELEASE-NOTES', 'README.md', 'Version.tag']: |
| 50 | + install(file, prefix.share) |
0 commit comments