diff options
author | Nichols A. Romero <naromero77@users.noreply.github.com> | 2020-01-11 16:13:03 -0600 |
---|---|---|
committer | Adam J. Stewart <ajstewart426@gmail.com> | 2020-01-11 16:13:03 -0600 |
commit | d1c708bdf3d95b63a8aaaac66a9434222d77b4ce (patch) | |
tree | 32a41ae82e3164109ddc159baf3bb3a0dfb7edc0 | |
parent | 257e71d87a8f0eacc8d5fbf88c1aabab8f26c52c (diff) | |
download | spack-d1c708bdf3d95b63a8aaaac66a9434222d77b4ce.tar.gz spack-d1c708bdf3d95b63a8aaaac66a9434222d77b4ce.tar.bz2 spack-d1c708bdf3d95b63a8aaaac66a9434222d77b4ce.tar.xz spack-d1c708bdf3d95b63a8aaaac66a9434222d77b4ce.zip |
LLVM-Flang package (#14389)
* Add 20181226 release of pgmath
* 20190329 release of pgmath requires match for CMPLX macro.
* Add llvm-flang package for Flang fork of LLVM
* Add new and old flang releases.
* Add cmake and python dependencies.
* Update dependencies on llvm-flang and pgmath.
* Fix cmake args and change spec to reflect llvm-flang package.
* change copyright date through 2020.
* Reference Flang package more explicitly.
* More robust support for python executable.
* import os no longer needed, picked up by flake8.
* Use built-in target spec. Variant and targets follow style in main LLVM package.
* Get rid of targets list and only support one target for now.
* Sparc does not appear to be supported in Flang.
* Raise InstallError if architecture not supported.
-rw-r--r-- | var/spack/repos/builtin/packages/flang/package.py | 39 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/llvm-flang/package.py | 168 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/pgmath/package.py | 7 |
3 files changed, 202 insertions, 12 deletions
diff --git a/var/spack/repos/builtin/packages/flang/package.py b/var/spack/repos/builtin/packages/flang/package.py index 786c281686..60d705d17e 100644 --- a/var/spack/repos/builtin/packages/flang/package.py +++ b/var/spack/repos/builtin/packages/flang/package.py @@ -13,32 +13,47 @@ class Flang(CMakePackage): homepage = "https://github.com/flang-compiler/flang" - url = "https://github.com/flang-compiler/flang/archive/flang_20180612.tar.gz" + url = "https://github.com/flang-compiler/flang/archive/flang_20190329.tar.gz" git = "https://github.com/flang-compiler/flang.git" - version('develop', branch='master') + maintainers = ['naromero77'] + + version('master', branch='master') + version('20190329', sha256='b8c621da53829f8c53bad73125556fb1839c9056d713433b05741f7e445199f2') + version('20181226', sha256='00e716bea258c3bb60d6a5bb0c82bc79f67000062dc89939693e75f501883c36') version('20180921', sha256='f33bd1f054e474f1e8a204bb6f78d42f8f6ecf7a894fdddc3999f7c272350784') version('20180612', sha256='6af858bea013548e091371a97726ac784edbd4ff876222575eaae48a3c2920ed') - depends_on('llvm@develop+flang~gold~lldb~lld~compiler-rt~libcxx~polly~internal_unwind', when='@develop') - depends_on('llvm@7.0.1+flang~gold~lldb~lld~compiler-rt~libcxx~polly~internal_unwind', when='@20180921') - depends_on('llvm@6.0.0+flang~gold~lldb~lld~compiler-rt~libcxx~polly~internal_unwind', when='@20180612') + # Build dependency + depends_on('cmake@3.8:', type='build') + depends_on('python@2.7:', type='build') + + depends_on('llvm-flang@release_70', when='@master') + depends_on('llvm-flang@20190329', when='@20190329') + depends_on('llvm-flang@20181226_70', when='@20181226') + depends_on('llvm-flang@20180921', when='@20180921') + depends_on('llvm-flang@20180612', when='@20180612') - depends_on('pgmath@develop', when='@develop') + depends_on('pgmath@master', when='@master') + depends_on('pgmath@20190329', when='@20190329') + depends_on('pgmath@20181226', when='@20181226') depends_on('pgmath@20180921', when='@20180921') depends_on('pgmath@20180612', when='@20180612') def cmake_args(self): + spec = self.spec options = [ '-DWITH_WERROR=OFF', '-DCMAKE_C_COMPILER=%s' % os.path.join( - self.spec['llvm'].prefix.bin, 'clang'), + spec['llvm-flang'].prefix.bin, 'clang'), '-DCMAKE_CXX_COMPILER=%s' % os.path.join( - self.spec['llvm'].prefix.bin, 'clang++'), + spec['llvm-flang'].prefix.bin, 'clang++'), '-DCMAKE_Fortran_COMPILER=%s' % os.path.join( - self.spec['llvm'].prefix.bin, 'flang'), + spec['llvm-flang'].prefix.bin, 'flang'), '-DFLANG_LIBOMP=%s' % find_libraries( - 'libomp', root=self.spec['llvm'].prefix.lib) + 'libomp', root=spec['llvm-flang'].prefix.lib), + '-DPYTHON_EXECUTABLE={0}'.format( + spec['python'].command.path) ] return options @@ -55,7 +70,7 @@ class Flang(CMakePackage): out.write('#!/bin/bash\n') out.write( '{0} -I{1} -L{2} -L{3} {4}{5} {6}{7} -B{8} "$@"\n'.format( - self.spec['llvm'].prefix.bin.flang, + self.spec['llvm-flang'].prefix.bin.flang, self.prefix.include, self.prefix.lib, self.spec['pgmath'].prefix.lib, self.compiler.fc_rpath_arg, self.prefix.lib, @@ -67,7 +82,7 @@ class Flang(CMakePackage): def setup_build_environment(self, env): # to find llvm's libc++.so - env.set('LD_LIBRARY_PATH', self.spec['llvm'].prefix.lib) + env.set('LD_LIBRARY_PATH', self.spec['llvm-flang'].prefix.lib) def setup_run_environment(self, env): env.set('FC', self.spec.prefix.bin.flang) diff --git a/var/spack/repos/builtin/packages/llvm-flang/package.py b/var/spack/repos/builtin/packages/llvm-flang/package.py new file mode 100644 index 0000000000..4c19e7b54b --- /dev/null +++ b/var/spack/repos/builtin/packages/llvm-flang/package.py @@ -0,0 +1,168 @@ +# 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 * + + +class LlvmFlang(CMakePackage): + """LLVM-Flang is the Flang fork of LLVM needed by the Flang package.""" + + homepage = "https://github.com/flang-compiler" + + git = "https://github.com/flang-compiler/llvm.git" + + maintainer = ['naromero77'] + + version('master', branch='master') + version('release_70', branch='release_70') + version('release_60', branch='release_60') + version('20190329', tag='flang_20190329') + version('20181226_70', tag='20181226_70') + version('20181226_60', tag='20181226_60') + version('20180921', tag='20180921') + version('20180319', tag='20180319') + version('20180328', tag='20180308') + + # Variants + variant('all_targets', default=False, + description='Build all supported targets') + + # Build dependency + depends_on('cmake@3.8:', type='build') + depends_on('python@2.7:', type='build') + + # LLVM-Flang Componentes: Driver, OpenMP + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + branch='master', + destination='tools', + placement='clang', + when='@master') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + branch='release_70', + destination='tools', + placement='clang', + when='@release_70') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + branch='release_60', + destination='tools', + placement='clang', + when='@release_60') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + tag='flang_20190329', + destination='tools', + placement='clang', + when='@20190329') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + tag='flang_20181226_70', + destination='tools', + placement='clang', + when='@20181226_70') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + tag='flang_20181226_60', + destination='tools', + placement='clang', + when='@20181226_60') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + tag='flang_20180921', + destination='tools', + placement='clang', + when='@20180921') + + resource(name='flang-driver', + git='https://github.com/flang-compiler/flang-driver.git', + tag='flang_20180921', + destination='tools', + placement='clang', + when='@20180308') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + branch='master', + destination='projects', + placement='openmp', + when='@master') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + branch='release_70', + destination='projects', + placement='openmp', + when='@release_70') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + branch='release_60', + destination='projects', + placement='openmp', + when='@release_60') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + tag='flang_20190329', + destination='projects', + placement='openmp', + when='@20190329') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + tag='flang_20181226_70', + destination='projects', + placement='openmp', + when='@20181226_70') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + tag='flang_20181226_60', + destination='projects', + placement='openmp', + when='@20181226_60') + + resource(name='openmp', + git='https://github.com/flang-compiler/openmp.git', + tag='flang_20180921', + destination='projects', + placement='openmp', + when='@20180921') + + def cmake_args(self): + spec = self.spec + args = [] + args.append('-DPYTHON_EXECUTABLE={0}'.format( + spec['python'].command.path)) + + if '+all_targets' not in spec: # all is default in cmake + if spec.target.family == 'x86' or spec.target.family == 'x86_64': + target = 'X86' + elif spec.target.family == 'arm': + target = 'ARM' + elif spec.target.family == 'aarch64': + target = 'AArch64' + elif (spec.target.family == 'ppc64' or + spec.target.family == 'ppc64le' or + spec.target.family == 'ppc' or + spec.target.family == 'ppcle'): + target = 'PowerPC' + else: + raise InstallError( + 'Unsupported architecture: ' + spec.target.family) + + args.append( + '-DLLVM_TARGETS_TO_BUILD:STRING=' + target) + + return args diff --git a/var/spack/repos/builtin/packages/pgmath/package.py b/var/spack/repos/builtin/packages/pgmath/package.py index c1a812f2a8..bd08ba8b40 100644 --- a/var/spack/repos/builtin/packages/pgmath/package.py +++ b/var/spack/repos/builtin/packages/pgmath/package.py @@ -18,9 +18,16 @@ class Pgmath(CMakePackage): version('master', branch='master') version('20190329', sha256='b8c621da53829f8c53bad73125556fb1839c9056d713433b05741f7e445199f2') + version('20181226', sha256='00e716bea258c3bb60d6a5bb0c82bc79f67000062dc89939693e75f501883c36') version('20180921', sha256='f33bd1f054e474f1e8a204bb6f78d42f8f6ecf7a894fdddc3999f7c272350784') version('20180612', sha256='6af858bea013548e091371a97726ac784edbd4ff876222575eaae48a3c2920ed') + # work around for this issue + # https://github.com/flang-compiler/flang/issues/602 + patch('https://github.com/flang-compiler/flang/commit/7fcd6346a9427977afe4534c0f19bbbba04c99a3.diff', + sha256='4014df1e5855dd21242b0fc938a4e7835941c20f9a89c3a7a5314e74b6232bcb', + when='@20190329') + # workaround for this issue # https://github.com/flang-compiler/flang/issues/838 patch('libpgmath_symbols.patch', when='@20190329,master') |