From 496e4856916cb881da916539635e9bfa3e1406af Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Wed, 30 Dec 2015 10:13:46 -0800 Subject: removing check as it can cause failures in zsh --- share/spack/setup-env.sh | 1 - var/spack/packages/binutils/package.py | 5 ++ var/spack/packages/clang/package.py | 52 +++++++---- var/spack/packages/gcc/package.py | 32 ++++++- var/spack/packages/llvm/package.py | 154 +++++++++++++++++++++++++++++---- 5 files changed, 206 insertions(+), 38 deletions(-) diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 4faae0d2c9..6503728d8f 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -55,7 +55,6 @@ # avoids the need to come up with a user-friendly naming scheme for # spack dotfiles. ######################################################################## -arrtest[0]='test' || (echo 'Failure: arrays not supported in this version of bash.' && exit 2) function spack { # save raw arguments into an array before butchering them diff --git a/var/spack/packages/binutils/package.py b/var/spack/packages/binutils/package.py index 123f4598f6..a79fc5fb69 100644 --- a/var/spack/packages/binutils/package.py +++ b/var/spack/packages/binutils/package.py @@ -11,6 +11,7 @@ class Binutils(Package): # Add a patch that creates binutils libiberty_pic.a which is preferred by OpenSpeedShop and cbtf-krell variant('krellpatch', default=False, description="build with openspeedshop based patch.") + variant('gold', default=True, description="build the gold linker") patch('binutilskrell-2.24.patch', when='@2.24+krellpatch') variant('libiberty', default=False, description='Also install libiberty.') @@ -26,6 +27,10 @@ class Binutils(Package): '--enable-targets=all', '--with-sysroot=/'] + if '+gold' in spec: + configure_args.append('--enable-gold') + configure_args.append('--enable-plugins') + if '+libiberty' in spec: configure_args.append('--enable-install-libiberty') diff --git a/var/spack/packages/clang/package.py b/var/spack/packages/clang/package.py index e46e08d5f1..99e805d15d 100644 --- a/var/spack/packages/clang/package.py +++ b/var/spack/packages/clang/package.py @@ -36,20 +36,42 @@ class Clang(Package): homepage = 'http://clang.llvm.org' url = 'http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz' - depends_on('llvm@3.7.0', when='@3.7.0') - depends_on('llvm@3.6.2', when='@3.6.2') - depends_on('llvm@3.5.1', when='@3.5.1') - - version('3.7.0', '8f9d27335e7331cf0a4711e952f21f01', url='http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz') - version('3.6.2', 'ff862793682f714bb7862325b9c06e20', url='http://llvm.org/releases/3.6.2/cfe-3.6.2.src.tar.xz') - version('3.5.1', '93f9532f8f7e6f1d8e5c1116907051cb', url='http://llvm.org/releases/3.5.1/cfe-3.5.1.src.tar.xz') - - ########## - # @3.7.0 - resource(name='clang-tools-extra', - url='http://llvm.org/releases/3.7.0/clang-tools-extra-3.7.0.src.tar.xz', - md5='d5a87dacb65d981a427a536f6964642e', destination='tools', when='@3.7.0') - ########## + clang_url = 'http://llvm.org/releases/%(version)s/cfe-%(version)s.src.tar.xz' + + resources = { + 'clang-tools-extra' : { + 'url' : 'http://llvm.org/releases/%(version)s/clang-tools-extra-%(version)s.src.tar.xz', + 'destination' : 'tools' + }, + } + releases = [ + { + 'version' : '3.7.0', + 'md5':'8f9d27335e7331cf0a4711e952f21f01', + 'resources' : { 'clang-tools-extra' : 'd5a87dacb65d981a427a536f6964642e' } + }, + { + 'version' : '3.6.2', + 'md5':'ff862793682f714bb7862325b9c06e20', + 'resources' : { 'clang-tools-extra' : '3ebc1dc41659fcec3db1b47d81575e06' } + }, + { + 'version' : '3.5.1', + 'md5':'93f9532f8f7e6f1d8e5c1116907051cb', + 'resources' : { 'clang-tools-extra' : 'f13f31ed3038acadc6fa63fef812a246' } + }, + ] + + for release in releases: + version(release['version'], release['md5'], url=clang_url % release) + depends_on('llvm@%(version)s' % release, when='@%(version)s' % release) + + for name, md5 in release['resources'].items(): + resource(name=name, + url=resources[name]['url'] % release, + md5=md5, + destination=resources[name]['destination'], + when='@%(version)s' % release) def install(self, spec, prefix): env['CXXFLAGS'] = self.compiler.cxx11_flag @@ -92,4 +114,4 @@ class Clang(Package): # Link folder and files in lib llvm_dir = clang_lib_dir_at(spec['llvm'].prefix) clang_dir = clang_lib_dir_at(self.prefix) - do_link(llvm_dir, clang_dir) \ No newline at end of file + do_link(llvm_dir, clang_dir) diff --git a/var/spack/packages/gcc/package.py b/var/spack/packages/gcc/package.py index 7ec160d595..da90c22023 100644 --- a/var/spack/packages/gcc/package.py +++ b/var/spack/packages/gcc/package.py @@ -52,19 +52,45 @@ class Gcc(Package): depends_on("mpfr") depends_on("gmp") depends_on("mpc") # when @4.5: - depends_on("binutils~libiberty") + depends_on("binutils~libiberty+gold") # Save these until we can do optional deps. depends_on("isl", when=DEPENDS_ON_ISL_PREDICATE) #depends_on("ppl") #depends_on("cloog") + variant('lang_go', default=True, description="Include support for the go language") + variant('lang_fortran', default=True, description="Include support for the Fortran language") + variant('lang_c', default=True, description="Include support for the C language") + variant('lang_cxx', default=True, description="Include support for the C++ language") + variant('lang_ada', default=False, description="Include support for the ada language") + variant('lang_java', default=False, description="Include support for the java language") + variant('lang_objc', default=True, description="Include support for the Objective-C language") + variant('lang_objcxx', default=True, description="Include support for the Objective-C++ language") + variant('jit', default=False, description="Include support for JIT") + def install(self, spec, prefix): # libjava/configure needs a minor fix to install into spack paths. filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure', string=True) - enabled_languages = set(('c', 'c++', 'fortran', 'java', 'objc')) - if spec.satisfies("@4.7.1:"): + enabled_languages = set()#('c', 'c++', 'fortran', 'java', 'objc') + if '+lang_fortran' in spec: + enabled_languages.add('fortran') + if '+lang_c' in spec: + enabled_languages.add('c') + if '+lang_cxx' in spec: + enabled_languages.add('c++') + if '+lang_java' in spec: + enabled_languages.add('java') + if '+lang_objc' in spec: + enabled_languages.add('objc') + if '+lang_objcxx' in spec: + enabled_languages.add('obj-c++') + if '+lang_ada' in spec: + enabled_languages.add('ada') + if '+jit' in spec: + enabled_languages.add('jit') + if spec.satisfies("@4.7.1:") and '+lang_go' in spec: enabled_languages.add('go') # Generic options to compile GCC diff --git a/var/spack/packages/llvm/package.py b/var/spack/packages/llvm/package.py index a3307584e0..8a36a87367 100644 --- a/var/spack/packages/llvm/package.py +++ b/var/spack/packages/llvm/package.py @@ -3,8 +3,9 @@ # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. -# Written by David Beckingsale, david@llnl.gov, All rights reserved. -# LLNL-CODE-647188 +# Written by David Beckingsale, david@llnl.gov +# Heavily modified by others, including Tom Scogland, scogland1@llnl.gov +# All rights reserved. LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack # Please also see the LICENSE file for our notice and the LGPL. @@ -23,6 +24,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +import os class Llvm(Package): @@ -40,33 +42,147 @@ class Llvm(Package): version('3.5.1', '2d3d8004f38852aa679e5945b8ce0b14', url='http://llvm.org/releases/3.5.1/llvm-3.5.1.src.tar.xz') version('3.0', 'a8e5f5f1c1adebae7b4a654c376a6005', url='http://llvm.org/releases/3.0/llvm-3.0.tar.gz') # currently required by mesa package + variant('debug', default=False, description="Build a debug version of LLVM, this increases binary size considerably") + variant('clang', default=True, description="Build the LLVM C/C++/Objective-C compiler frontend") + variant('clang_extra', default=True, description="Build the clang extra tools") + variant('lldb', default=True, description="Build the LLVM debugger") + variant('internal_unwind', default=True, description="Build and use the libcxxabi built-in unwinder") + variant('compiler-rt', default=False, description="Compiler runtime including sanitizers and unwinding libraries") + variant('gold', default=True, description="Add support for the gold linker and build the gold linker plugin for LTO") + + # Universal dependency depends_on('python@2.7:') - variant('libcxx', default=False, description="Builds the LLVM Standard C++ library targeting C++11") + # lldb dependencies + depends_on('ncurses', when='+lldb') + depends_on('swig', when='+lldb') + depends_on('libedit', when='+lldb') + + # gold support + depends_on('binutils+gold', when='+gold') + + base_url = 'http://llvm.org/releases/%%(version)s/%(pkg)s-%%(version)s.src.tar.xz' + llvm_url = base_url % { 'pkg' : 'llvm'} + + resources = { + 'compiler-rt' : { + 'url' : base_url % { 'pkg' : 'compiler-rt'}, + 'destination' : 'projects', + 'placement' : 'compiler-rt', + }, + 'openmp' : { + 'url' : base_url % { 'pkg' : 'openmp'}, + 'destination' : 'projects', + 'placement' : 'openmp', + }, + 'libcxx' : { + 'url' : base_url % { 'pkg' : 'libcxx'}, + 'destination' : 'projects', + 'placement' : 'libcxx', + }, + 'libcxxabi' : { + 'url' : base_url % { 'pkg' : 'libcxxabi'}, + 'destination' : 'projects', + 'placement' : 'libcxxabi', + }, + 'clang' : { + 'url' : base_url % { 'pkg' : 'cfe'}, + 'destination' : 'tools', + 'placement' : 'clang', + }, + 'clang-tools-extra' : { + 'url' : base_url % { 'pkg' : 'clang-tools-extra'}, + 'destination' : 'tools/clang/tools', + 'placement' : 'clang-tools-extra', + }, + 'lldb' : { + 'url' : base_url % { 'pkg' : 'lldb'}, + 'destination' : 'tools', + 'placement' : 'lldb', + }, + 'polly' : { + 'url' : base_url % { 'pkg' : 'polly'}, + 'destination' : 'tools', + 'placement' : 'polly', + }, + 'llvm-libunwind' : { + 'url' : base_url % { 'pkg' : 'libunwind'}, + 'destination' : 'projects', + 'placement' : 'libunwind', + }, + } + releases = [ + { + 'version' : '3.7.0', + 'md5':'b98b9495e5655a672d6cb83e1a180f8e', + 'resources' : { + # FIXME: compiler-rt + # 'compiler-rt' : '383c10affd513026f08936b5525523f5', + 'openmp' : 'f482c86fdead50ba246a1a2b0bbf206f', + 'polly' : '32f93ffc9cc7e042df22089761558f8b', + 'libcxx' : '46aa5175cbe1ad42d6e9c995968e56dd', + 'libcxxabi' : '5aa769e2fca79fa5335cfae8f6258772', + 'clang' : '8f9d27335e7331cf0a4711e952f21f01', + 'clang-tools-extra' : 'd5a87dacb65d981a427a536f6964642e', + 'lldb' : 'e5931740400d1dc3e7db4c7ba2ceff68', + 'llvm-libunwind' : '9a75392eb7eb8ed5c0840007e212baf5', + } + }, + { + 'version' : '3.6.2', + 'md5':'0c1ee3597d75280dee603bae9cbf5cc2', + 'resources' : { + 'compiler-rt' : 'e3bc4eb7ba8c39a6fe90d6c988927f3c', + 'openmp' : '65dd5863b9b270960a96817e9152b123', + 'libcxx' : '22214c90697636ef960a49aef7c1823a', + 'libcxxabi' : '17518e361e4e228f193dd91e8ef54ba2', + 'clang' : 'ff862793682f714bb7862325b9c06e20', + 'clang-tools-extra' : '3ebc1dc41659fcec3db1b47d81575e06', + 'lldb' : '51e5eb552f777b950bb0ff326e60d5f0', + } + }, + { + 'version' : '3.5.1', + 'md5':'2d3d8004f38852aa679e5945b8ce0b14', + 'resources' : { + 'compiler-rt' : 'd626cfb8a9712cb92b820798ab5bc1f8', + 'openmp' : '121ddb10167d7fc38b1f7e4b029cf059', + 'libcxx' : '406f09b1dab529f3f7879f4d548329d2', + 'libcxxabi' : 'b22c707e8d474a99865ad3c521c3d464', + 'clang' : '93f9532f8f7e6f1d8e5c1116907051cb', + 'clang-tools-extra' : 'f13f31ed3038acadc6fa63fef812a246', + 'lldb' : 'cc5ea8a414c62c33e760517f8929a204', + } + }, + ] - ########## - # @3.7.0 - resource(name='compiler-rt', - url='http://llvm.org/releases/3.7.0/compiler-rt-3.7.0.src.tar.xz', md5='383c10affd513026f08936b5525523f5', - destination='projects', when='@3.7.0') - resource(name='openmp', - url='http://llvm.org/releases/3.7.0/openmp-3.7.0.src.tar.xz', md5='f482c86fdead50ba246a1a2b0bbf206f', - destination='projects', when='@3.7.0') - resource(name='libcxx', - url='http://llvm.org/releases/3.7.0/libcxx-3.7.0.src.tar.xz', md5='46aa5175cbe1ad42d6e9c995968e56dd', - destination='projects', placement='libcxx', when='+libcxx@3.7.0') - resource(name='libcxxabi', - url='http://llvm.org/releases/3.7.0/libcxxabi-3.7.0.src.tar.xz', md5='5aa769e2fca79fa5335cfae8f6258772', - destination='projects', placement='libcxxabi', when='+libcxx@3.7.0') - ########## + for release in releases: + version(release['version'], release['md5'], url=llvm_url % release) + + for name, md5 in release['resources'].items(): + resource(name=name, + url=resources[name]['url'] % release, + md5=md5, + destination=resources[name]['destination'], + when='@%(version)s' % release, + placement=resources[name].get('placement', None)) def install(self, spec, prefix): env['CXXFLAGS'] = self.compiler.cxx11_flag + build_type = 'Debug' if '+debug' in spec else 'Release' + + if '+clang' not in spec: + if '+clang_extra' in spec: + raise SpackException('The clang_extra variant requires the clang variant to be selected') + if '+lldb' in spec: + raise SpackException('The lldb variant requires the clang variant to be selected') with working_dir('spack-build', create=True): cmake('..', + '-DCMAKE_RELEASE_TYPE=' + build_type, '-DLLVM_REQUIRES_RTTI:BOOL=ON', '-DPYTHON_EXECUTABLE:PATH=%s/bin/python' % spec['python'].prefix, *std_cmake_args) - make() + make("VERBOSE=1") make("install") + -- cgit v1.2.3-60-g2f50