Package/flang: Updated to use own version of llvm (#8766)
Flang now uses its own version of llvm and clang (called flang-driver). This is handled by adding flang-specific versions of the LLVM package and updates flang to depend on those versions.
This commit is contained in:
parent
b5071312c4
commit
eb39d0c729
@ -31,30 +31,21 @@ class Flang(CMakePackage):
|
||||
"""Flang is a Fortran compiler targeting LLVM."""
|
||||
|
||||
homepage = "https://github.com/flang-compiler/flang"
|
||||
url = "https://github.com/flang-compiler/flang/archive/flang_20180319.tar.gz"
|
||||
|
||||
url = "https://github.com/flang-compiler/flang/archive/flang_20180612.tar.gz"
|
||||
git = "https://github.com/flang-compiler/flang.git"
|
||||
|
||||
version('develop', branch='master')
|
||||
version('20180319', 'e659bad83b791f90af2c5cd672864669')
|
||||
version('20180612', '62284e26214eaaff261a922c67f6878c')
|
||||
|
||||
depends_on(
|
||||
"llvm+clang@4.0.1,5.0.0,6.0.0",
|
||||
patches=[
|
||||
patch('https://github.com/llvm-mirror/clang/pull/33.diff',
|
||||
sha256='e46d7ab305e5e95c51f4656d9b52058143cd85d859b312b3c80e93a02d54b4a5',
|
||||
when='@4.0.1', level=1, working_dir='tools/clang'),
|
||||
patch('https://github.com/llvm-mirror/clang/pull/35.diff',
|
||||
sha256='7f39555783993f78b75c380ca5ef167c1d8b88cc75c6542f6c94e0b6acfb7c5d',
|
||||
when='@5.0.0', level=1, working_dir='tools/clang'),
|
||||
patch('https://github.com/llvm-mirror/llvm/pull/56.diff',
|
||||
sha256='2ee155aa1017766cdae3a860050d82ed48961a2f88bcef760d4922ff25ce381e',
|
||||
when='@6.0.0', level=1),
|
||||
patch('https://github.com/llvm-mirror/clang/pull/40.diff',
|
||||
sha256='5021f2ea54e957eb1c712f9e9a87b3dc33616ebd2e84735b6735f788fd2c45e9',
|
||||
when='@6.0.0', level=1, working_dir='tools/clang')
|
||||
]
|
||||
)
|
||||
depends_on("pgmath@develop", when="@develop")
|
||||
depends_on('llvm@flang-develop', when='@develop')
|
||||
depends_on('llvm@flang-20180612', when='@20180612 target=x86_64')
|
||||
|
||||
# LLVM version specific to OpenPOWER.
|
||||
depends_on('llvm@flang-ppc64le-20180612', when='@20180612 target=ppc64le')
|
||||
|
||||
depends_on('pgmath@develop', when='@develop')
|
||||
depends_on('pgmath@20180612', when='@20180612')
|
||||
|
||||
def cmake_args(self):
|
||||
options = [
|
||||
@ -81,23 +72,14 @@ def post_install(self):
|
||||
flang = os.path.join(self.spec.prefix.bin, 'flang')
|
||||
with open(flang, 'w') as out:
|
||||
out.write('#!/bin/bash\n')
|
||||
if '@develop' in self.spec:
|
||||
out.write(
|
||||
'{0} -I{1} -L{2} -L{3} {4}{5} {6}{7} -B{8} "$@"\n'.format(
|
||||
self.spec['llvm'].prefix.bin.flang,
|
||||
self.prefix.include, self.prefix.lib,
|
||||
self.spec['pgmath'].prefix.lib,
|
||||
self.compiler.fc_rpath_arg, self.prefix.lib,
|
||||
self.compiler.fc_rpath_arg,
|
||||
self.spec['pgmath'].prefix.lib,
|
||||
self.spec.prefix.bin))
|
||||
else:
|
||||
out.write(
|
||||
'{0} -I{1} -L{2} {3}{4} -B{5} "$@"\n'.format(
|
||||
self.spec['llvm'].prefix.bin.flang,
|
||||
self.prefix.include, self.prefix.lib,
|
||||
self.compiler.fc_rpath_arg, self.prefix.lib,
|
||||
self.spec.prefix.bin))
|
||||
out.write(
|
||||
'{0} -I{1} -L{2} -L{3} {4}{5} {6}{7} -B{8} "$@"\n'.format(
|
||||
self.spec['llvm'].prefix.bin.flang,
|
||||
self.prefix.include, self.prefix.lib,
|
||||
self.spec['pgmath'].prefix.lib,
|
||||
self.compiler.fc_rpath_arg, self.prefix.lib,
|
||||
self.compiler.fc_rpath_arg,
|
||||
self.spec['pgmath'].prefix.lib, self.spec.prefix.bin))
|
||||
out.close()
|
||||
chmod = which('chmod')
|
||||
chmod('+x', flang)
|
||||
|
@ -100,6 +100,8 @@ class Llvm(CMakePackage):
|
||||
|
||||
base_url = 'http://llvm.org/releases/%%(version)s/%(pkg)s-%%(version)s.src.tar.xz'
|
||||
llvm_url = base_url % {'pkg': 'llvm'}
|
||||
# Flang uses its own fork of llvm.
|
||||
flang_llvm_url = 'https://github.com/flang-compiler/llvm.git'
|
||||
|
||||
resources = {
|
||||
'compiler-rt': {
|
||||
@ -402,6 +404,47 @@ class Llvm(CMakePackage):
|
||||
},
|
||||
]
|
||||
|
||||
# Flang uses its own fork of clang (renamed flang-driver).
|
||||
flang_resources = {
|
||||
'flang-driver': {
|
||||
'git': 'https://github.com/flang-compiler/flang-driver.git',
|
||||
'destination': 'tools',
|
||||
'placement': 'clang'
|
||||
},
|
||||
'openmp': {
|
||||
'git': 'https://github.com/llvm-mirror/openmp.git',
|
||||
'destination': 'projects',
|
||||
'placement': 'openmp'
|
||||
}
|
||||
}
|
||||
|
||||
flang_releases = [
|
||||
{
|
||||
'version': 'develop',
|
||||
'branch': 'release_60',
|
||||
'resources': {
|
||||
'flang-driver': 'release_60',
|
||||
'openmp': 'release_60',
|
||||
}
|
||||
},
|
||||
{
|
||||
'version': '20180612',
|
||||
'commit': 'f26a3ece4ccd68a52f5aa970ec42837ee0743296',
|
||||
'resources': {
|
||||
'flang-driver': 'e079fa68cb35a53c88c41a1939f90b94d539e984',
|
||||
'openmp': 'd5aa29cb3bcf51289d326b4e565613db8aff65ef'
|
||||
}
|
||||
},
|
||||
{
|
||||
'version': 'ppc64le-20180612',
|
||||
'commit': '4158932a46eb2f06a166f22a4a52ae48c7d2949e',
|
||||
'resources': {
|
||||
'flang-driver': '50c1828a134d5a0f1553b355bf0946db48b0aa6d',
|
||||
'openmp': '29b515e1e6d26b5b0d32d47d28dcdb4b8a11470d'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
for release in releases:
|
||||
if release['version'] == 'trunk':
|
||||
version(release['version'], svn=release['repo'])
|
||||
@ -425,6 +468,31 @@ class Llvm(CMakePackage):
|
||||
resources[name].get('variant', "")),
|
||||
placement=resources[name].get('placement', None))
|
||||
|
||||
for release in flang_releases:
|
||||
if release['version'] == 'develop':
|
||||
version('flang-' + release['version'], git=flang_llvm_url, branch=release['branch'])
|
||||
|
||||
for name, branch in release['resources'].items():
|
||||
flang_resource = flang_resources[name]
|
||||
resource(name=name,
|
||||
git=flang_resource['git'],
|
||||
branch=branch,
|
||||
destination=flang_resource['destination'],
|
||||
placement=flang_resource['placement'],
|
||||
when='@flang-' + release['version'])
|
||||
|
||||
else:
|
||||
version('flang-' + release['version'], git=flang_llvm_url, commit=release['commit'])
|
||||
|
||||
for name, commit in release['resources'].items():
|
||||
flang_resource = flang_resources[name]
|
||||
resource(name=name,
|
||||
git=flang_resource['git'],
|
||||
commit=commit,
|
||||
destination=flang_resource['destination'],
|
||||
placement=flang_resource['placement'],
|
||||
when='@flang-' + release['version'])
|
||||
|
||||
conflicts('+clang_extra', when='~clang')
|
||||
conflicts('+lldb', when='~clang')
|
||||
|
||||
|
@ -30,9 +30,11 @@ class Pgmath(CMakePackage):
|
||||
"""Flang's math library"""
|
||||
|
||||
homepage = "https://github.com/flang-compiler/flang"
|
||||
url = "https://github.com/flang-compiler/flang/archive/flang_20180612.tar.gz"
|
||||
git = "https://github.com/flang-compiler/flang.git"
|
||||
|
||||
version('develop', branch='master')
|
||||
version('20180612', '62284e26214eaaff261a922c67f6878c')
|
||||
|
||||
conflicts("%gcc@:7.1.9999")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user