llvm and llvm-lld package updates (#7313)

* Combined llvm and llvm-lld: removed the separate llvm-lld package
  and added llvm-lld as an optional add on to the llvm package (the
  way several other llvm tools are maintained e.g. lldb)
* Added more lld hashes to llvm package
* The 'CppBackend' target doesn't exist for version 3.9.0 or later
  so exclude it for later versions
* Was incorrectly specifying 'sparc' as a target for the 'sparc'
  architecture - needed to specify 'Sparc'
* Fix issue #7248 building llvm: don't make the LLVMDemangle target
  for llvm < 4.0.0
This commit is contained in:
Mike Pozulp 2018-02-23 19:50:23 -08:00 committed by scheibelp
parent 990f178341
commit 8157f978b0
2 changed files with 35 additions and 51 deletions

View file

@ -1,48 +0,0 @@
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class LlvmLld(CMakePackage):
"""lld - The LLVM Linker
lld is a new set of modular code for creating linker tools."""
homepage = "http://lld.llvm.org"
url = "http://llvm.org/releases/3.4/lld-3.4.src.tar.gz"
version('3.4', '3b6a17e58c8416c869c14dd37682f78e')
depends_on('llvm')
depends_on('cmake@2.8:', type='build')
def cmake_args(self):
if 'CXXFLAGS' in env and env['CXXFLAGS']:
env['CXXFLAGS'] += ' ' + self.compiler.cxx11_flag
else:
env['CXXFLAGS'] = self.compiler.cxx11_flag
return [
'-DLLD_PATH_TO_LLVM_BUILD=%s' % self.spec['llvm'].prefix,
'-DLLVM_MAIN_SRC_DIR=%s' % self.spec['llvm'].prefix,
]

View file

@ -50,6 +50,7 @@ class Llvm(CMakePackage):
variant('clang', default=True, variant('clang', default=True,
description="Build the LLVM C/C++/Objective-C compiler frontend") description="Build the LLVM C/C++/Objective-C compiler frontend")
variant('lldb', default=True, description="Build the LLVM debugger") variant('lldb', default=True, description="Build the LLVM debugger")
variant('lld', default=True, description="Build the LLVM linker")
variant('internal_unwind', default=True, variant('internal_unwind', default=True,
description="Build the libcxxabi libunwind") description="Build the libcxxabi libunwind")
variant('polly', default=True, variant('polly', default=True,
@ -141,6 +142,12 @@ class Llvm(CMakePackage):
'placement': 'lldb', 'placement': 'lldb',
'variant': '+lldb', 'variant': '+lldb',
}, },
'lld': {
'url': base_url % {'pkg': 'lld'},
'destination': 'tools',
'placement': 'lld',
'variant': '+lld',
},
'polly': { 'polly': {
'url': base_url % {'pkg': 'polly'}, 'url': base_url % {'pkg': 'polly'},
'destination': 'tools', 'destination': 'tools',
@ -167,6 +174,7 @@ class Llvm(CMakePackage):
'cfe': 'http://llvm.org/svn/llvm-project/cfe/trunk', 'cfe': 'http://llvm.org/svn/llvm-project/cfe/trunk',
'clang-tools-extra': 'http://llvm.org/svn/llvm-project/clang-tools-extra/trunk', 'clang-tools-extra': 'http://llvm.org/svn/llvm-project/clang-tools-extra/trunk',
'lldb': 'http://llvm.org/svn/llvm-project/lldb/trunk', 'lldb': 'http://llvm.org/svn/llvm-project/lldb/trunk',
'lld': 'http://llvm.org/svn/llvm-project/lld/trunk',
'libunwind': 'http://llvm.org/svn/llvm-project/libunwind/trunk', 'libunwind': 'http://llvm.org/svn/llvm-project/libunwind/trunk',
} }
}, },
@ -182,6 +190,7 @@ class Llvm(CMakePackage):
'cfe': 'e4daa278d8f252585ab73d196484bf11', 'cfe': 'e4daa278d8f252585ab73d196484bf11',
'clang-tools-extra': 'c2bd3733c183b033b49f7a416c6dca36', 'clang-tools-extra': 'c2bd3733c183b033b49f7a416c6dca36',
'lldb': 'd64078681215b5935614b6b83b2d1463', 'lldb': 'd64078681215b5935614b6b83b2d1463',
'lld': 'a873c7fdaac647613d8eed2cb03d82de',
'libunwind': 'ccf48200065481244d3d09828d54e87f', 'libunwind': 'ccf48200065481244d3d09828d54e87f',
} }
}, },
@ -197,6 +206,7 @@ class Llvm(CMakePackage):
'cfe': '699c448c6d6d0edb693c87beb1cc8c6e', 'cfe': '699c448c6d6d0edb693c87beb1cc8c6e',
'clang-tools-extra': '0cda05d1a61becb393eb63746963d7f5', 'clang-tools-extra': '0cda05d1a61becb393eb63746963d7f5',
'lldb': '8de19973d044ca2cfe325d4625a5cfef', 'lldb': '8de19973d044ca2cfe325d4625a5cfef',
'lld': 'a39cbecced3263feab9139b47118e062',
'libunwind': '98fb2c677068c6f36727fb1d5397bca3', 'libunwind': '98fb2c677068c6f36727fb1d5397bca3',
} }
}, },
@ -212,6 +222,7 @@ class Llvm(CMakePackage):
'cfe': 'a6c7b3e953f8b93e252af5917df7db97', 'cfe': 'a6c7b3e953f8b93e252af5917df7db97',
'clang-tools-extra': 'cfd46027a0ab7eed483dfcc803e86bd9', 'clang-tools-extra': 'cfd46027a0ab7eed483dfcc803e86bd9',
'lldb': '908bdd777d3b527a914ba360477b8ab3', 'lldb': '908bdd777d3b527a914ba360477b8ab3',
'lld': '39cd3512cddcfd7d37ef12066c961660',
'libunwind': 'b72ec95fb784e61f15d6196414b92f5e', 'libunwind': 'b72ec95fb784e61f15d6196414b92f5e',
} }
}, },
@ -227,6 +238,7 @@ class Llvm(CMakePackage):
'cfe': '756e17349fdc708c62974b883bf72d37', 'cfe': '756e17349fdc708c62974b883bf72d37',
'clang-tools-extra': '99e711337ec3e9a8bb36e8dd62b2cd6e', 'clang-tools-extra': '99e711337ec3e9a8bb36e8dd62b2cd6e',
'lldb': 'bd41ba7fcca55d2a554409bbccd34d2d', 'lldb': 'bd41ba7fcca55d2a554409bbccd34d2d',
'lld': 'e5784656e0f38e3578f10ff7551d3896',
'libunwind': '0c3534eaa11c0cae33a1dcf5f36ce287', 'libunwind': '0c3534eaa11c0cae33a1dcf5f36ce287',
} }
}, },
@ -242,6 +254,7 @@ class Llvm(CMakePackage):
'cfe': '45713ec5c417ed9cad614cd283d786a1', 'cfe': '45713ec5c417ed9cad614cd283d786a1',
'clang-tools-extra': '1a01d545a064fcbc46a2f05f6880d3d7', 'clang-tools-extra': '1a01d545a064fcbc46a2f05f6880d3d7',
'lldb': '91399402f287d3f637db1207113deecb', 'lldb': '91399402f287d3f637db1207113deecb',
'lld': '6254dd138e23b098df4ef7840c11e2c8',
'libunwind': 'f273dd0ed638ad0601b23176a36f187b', 'libunwind': 'f273dd0ed638ad0601b23176a36f187b',
} }
}, },
@ -257,6 +270,7 @@ class Llvm(CMakePackage):
'cfe': '29e1d86bee422ab5345f5e9fb808d2dc', 'cfe': '29e1d86bee422ab5345f5e9fb808d2dc',
'clang-tools-extra': 'f4f663068c77fc742113211841e94d5e', 'clang-tools-extra': 'f4f663068c77fc742113211841e94d5e',
'lldb': '968d053c3c3d7297983589164c6999e9', 'lldb': '968d053c3c3d7297983589164c6999e9',
'lld': 'c23c895c0d855a0dc426af686538a95e',
'libunwind': '3e5c87c723a456be599727a444b1c166', 'libunwind': '3e5c87c723a456be599727a444b1c166',
} }
}, },
@ -272,6 +286,7 @@ class Llvm(CMakePackage):
'cfe': '4ff2f8844a786edb0220f490f7896080', 'cfe': '4ff2f8844a786edb0220f490f7896080',
'clang-tools-extra': '6e49f285d0b366cc3cab782d8c92d382', 'clang-tools-extra': '6e49f285d0b366cc3cab782d8c92d382',
'lldb': '9e4787b71be8e432fffd31e13ac87623', 'lldb': '9e4787b71be8e432fffd31e13ac87623',
'lld': '68cd069bf99c71ebcfbe01d557c0e14d',
'libunwind': 'd66e2387e1d37a8a0c8fe6a0063a3bab', 'libunwind': 'd66e2387e1d37a8a0c8fe6a0063a3bab',
} }
}, },
@ -287,6 +302,7 @@ class Llvm(CMakePackage):
'cfe': 'cc99e7019bb74e6459e80863606250c5', 'cfe': 'cc99e7019bb74e6459e80863606250c5',
'clang-tools-extra': 'c2344f50e0eea0b402f0092a80ddc036', 'clang-tools-extra': 'c2344f50e0eea0b402f0092a80ddc036',
'lldb': 'a5da35ed9cc8c8817ee854e3dbfba00e', 'lldb': 'a5da35ed9cc8c8817ee854e3dbfba00e',
'lld': 'de33b5c6c77698ee2f8d024fbffb8df1',
'libunwind': '162ade468607f153cca12be90b5194fa', 'libunwind': '162ade468607f153cca12be90b5194fa',
} }
}, },
@ -302,6 +318,7 @@ class Llvm(CMakePackage):
'cfe': '0acd026b5529164197563d135a8fd83e', 'cfe': '0acd026b5529164197563d135a8fd83e',
'clang-tools-extra': '5d49ff745037f061a7c86aeb6a24c3d2', 'clang-tools-extra': '5d49ff745037f061a7c86aeb6a24c3d2',
'lldb': 'a106d8a0d21fc84d76953822fbaf3398', 'lldb': 'a106d8a0d21fc84d76953822fbaf3398',
'lld': '6c3794e30fbe118a601fb694627f34f8',
'libunwind': '814bd52c9247c5d04629658fbcb3ab8c', 'libunwind': '814bd52c9247c5d04629658fbcb3ab8c',
} }
}, },
@ -317,6 +334,7 @@ class Llvm(CMakePackage):
'cfe': '8f9d27335e7331cf0a4711e952f21f01', 'cfe': '8f9d27335e7331cf0a4711e952f21f01',
'clang-tools-extra': 'd5a87dacb65d981a427a536f6964642e', 'clang-tools-extra': 'd5a87dacb65d981a427a536f6964642e',
'lldb': 'e5931740400d1dc3e7db4c7ba2ceff68', 'lldb': 'e5931740400d1dc3e7db4c7ba2ceff68',
'lld': '91bd593a67293d84dad0bf11845546c2',
'libunwind': '9a75392eb7eb8ed5c0840007e212baf5', 'libunwind': '9a75392eb7eb8ed5c0840007e212baf5',
} }
}, },
@ -331,6 +349,7 @@ class Llvm(CMakePackage):
'cfe': 'ff862793682f714bb7862325b9c06e20', 'cfe': 'ff862793682f714bb7862325b9c06e20',
'clang-tools-extra': '3ebc1dc41659fcec3db1b47d81575e06', 'clang-tools-extra': '3ebc1dc41659fcec3db1b47d81575e06',
'lldb': '51e5eb552f777b950bb0ff326e60d5f0', 'lldb': '51e5eb552f777b950bb0ff326e60d5f0',
'lld': '7143cc4fa88851a9f9b9a03621fbb387',
} }
}, },
{ {
@ -344,6 +363,7 @@ class Llvm(CMakePackage):
'cfe': '93f9532f8f7e6f1d8e5c1116907051cb', 'cfe': '93f9532f8f7e6f1d8e5c1116907051cb',
'clang-tools-extra': 'f13f31ed3038acadc6fa63fef812a246', 'clang-tools-extra': 'f13f31ed3038acadc6fa63fef812a246',
'lldb': 'cc5ea8a414c62c33e760517f8929a204', 'lldb': 'cc5ea8a414c62c33e760517f8929a204',
'lld': '173be02b7ff4e5e31fbb0a591a03d7a3',
} }
}, },
] ]
@ -409,6 +429,8 @@ def cmake_args(self):
if '+lldb' not in spec: if '+lldb' not in spec:
cmake_args.extend(['-DLLVM_EXTERNAL_LLDB_BUILD:Bool=OFF', cmake_args.extend(['-DLLVM_EXTERNAL_LLDB_BUILD:Bool=OFF',
'-DLLVM_TOOL_LLDB_BUILD:Bool=OFF']) '-DLLVM_TOOL_LLDB_BUILD:Bool=OFF'])
if '+lld' not in spec:
cmake_args.append('-DLLVM_TOOL_LLD_BUILD:Bool=OFF')
if '+internal_unwind' not in spec: if '+internal_unwind' not in spec:
cmake_args.append('-DLLVM_EXTERNAL_LIBUNWIND_BUILD:Bool=OFF') cmake_args.append('-DLLVM_EXTERNAL_LIBUNWIND_BUILD:Bool=OFF')
if '+libcxx' in spec: if '+libcxx' in spec:
@ -427,7 +449,15 @@ def cmake_args(self):
cmake_args.append('-DLLVM_LINK_LLVM_DYLIB:Bool=ON') cmake_args.append('-DLLVM_LINK_LLVM_DYLIB:Bool=ON')
if '+all_targets' not in spec: # all is default on cmake if '+all_targets' not in spec: # all is default on cmake
if spec.version < Version('3.9.0'):
targets = ['CppBackend', 'NVPTX', 'AMDGPU'] targets = ['CppBackend', 'NVPTX', 'AMDGPU']
else:
# Starting in 3.9.0 CppBackend is no longer a target (see
# LLVM_ALL_TARGETS in llvm's top-level CMakeLists.txt for
# the complete list of targets)
targets = ['NVPTX', 'AMDGPU']
if 'x86' in spec.architecture.target.lower(): if 'x86' in spec.architecture.target.lower():
targets.append('X86') targets.append('X86')
elif 'arm' in spec.architecture.target.lower(): elif 'arm' in spec.architecture.target.lower():
@ -435,7 +465,7 @@ def cmake_args(self):
elif 'aarch64' in spec.architecture.target.lower(): elif 'aarch64' in spec.architecture.target.lower():
targets.append('AArch64') targets.append('AArch64')
elif 'sparc' in spec.architecture.target.lower(): elif 'sparc' in spec.architecture.target.lower():
targets.append('sparc') targets.append('Sparc')
elif ('ppc' in spec.architecture.target.lower() or elif ('ppc' in spec.architecture.target.lower() or
'power' in spec.architecture.target.lower()): 'power' in spec.architecture.target.lower()):
targets.append('PowerPC') targets.append('PowerPC')
@ -452,6 +482,8 @@ def pre_install(self):
with working_dir(self.build_directory): with working_dir(self.build_directory):
# When building shared libraries these need to be installed first # When building shared libraries these need to be installed first
make('install-LLVMTableGen') make('install-LLVMTableGen')
if self.spec.version >= Version('4.0.0'):
# LLVMDemangle target was added in 4.0.0
make('install-LLVMDemangle') make('install-LLVMDemangle')
make('install-LLVMSupport') make('install-LLVMSupport')