Better C++11 support, remove non-standalone llvm-compiler-rt.

- LLVM non-standalone add-ons are difficult to build outside LLVM.
- May have to wait for future versions of LLVM to build some of these
This commit is contained in:
Todd Gamblin
2014-09-18 23:22:03 -07:00
parent c55041e9d4
commit 9165a000a3
10 changed files with 161 additions and 62 deletions

View File

@@ -84,7 +84,7 @@ def __call__(self, *args, **kwargs):
def set_compiler_environment_variables(pkg):
assert(pkg.spec.concrete)
compiler = compilers.compiler_for_spec(pkg.spec.compiler)
compiler = pkg.compiler
# Set compiler variables used by CMake and autotools
os.environ['CC'] = 'cc'

124
lib/spack/spack/cmd/pkg.py Normal file
View File

@@ -0,0 +1,124 @@
##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://scalability-llnl.github.io/spack
# Please also see the LICENSE file 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 General Public License (as published by
# the Free Software Foundation) version 2.1 dated 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 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
##############################################################################
import os
from external import argparse
import llnl.util.tty as tty
from llnl.util.tty.colify import colify
import spack
from spack.util.executable import *
description = "Query packages associated with particular git revisions in spack."
def setup_parser(subparser):
sp = subparser.add_subparsers(
metavar='SUBCOMMAND', dest='pkg_command')
list_parser = sp.add_parser('list', help=pkg_list.__doc__)
list_parser.add_argument('rev', default='HEAD', nargs='?',
help="Revision to list packages for.")
diff_parser = sp.add_parser('diff', help=pkg_diff.__doc__)
diff_parser.add_argument('rev1', nargs='?', default='HEAD^',
help="Revision to compare against.")
diff_parser.add_argument('rev2', nargs='?', default='HEAD',
help="Revision to compare to rev1 (default is HEAD).")
add_parser = sp.add_parser('added', help=pkg_added.__doc__)
add_parser.add_argument('rev1', nargs='?', default='HEAD^',
help="Revision to compare against.")
add_parser.add_argument('rev2', nargs='?', default='HEAD',
help="Revision to compare to rev1 (default is HEAD).")
rm_parser = sp.add_parser('removed', help=pkg_removed.__doc__)
rm_parser.add_argument('rev1', nargs='?', default='HEAD^',
help="Revision to compare against.")
rm_parser.add_argument('rev2', nargs='?', default='HEAD',
help="Revision to compare to rev1 (default is HEAD).")
def get_git():
# cd to spack prefix to do git operations
os.chdir(spack.prefix)
# If this is a non-git version of spack, give up.
if not os.path.isdir('.git'):
tty.die("No git repo in %s. Can't use 'spack pkg'" % spack.prefix)
return which("git", required=True)
def list_packages(rev):
git = get_git()
relpath = spack.packages_path[len(spack.prefix + os.path.sep):] + os.path.sep
output = git('ls-tree', '--full-tree', '--name-only', rev, relpath,
return_output=True)
return sorted(line[len(relpath):] for line in output.split('\n') if line)
def pkg_list(args):
"""List packages associated with a particular spack git revision."""
colify(list_packages(args.rev))
def diff_packages(rev1, rev2):
p1 = set(list_packages(rev1))
p2 = set(list_packages(rev2))
return p1.difference(p2), p2.difference(p1)
def pkg_diff(args):
"""Compare packages available in two different git revisions."""
u1, u2 = diff_packages(args.rev1, args.rev2)
if u1:
print "%s:" % args.rev1
colify(sorted(u1), indent=4)
if u1: print
if u2:
print "%s:" % args.rev2
colify(sorted(u2), indent=4)
def pkg_removed(args):
"""Show packages removed since a commit."""
u1, u2 = diff_packages(args.rev1, args.rev2)
if u1: colify(sorted(u1))
def pkg_added(args):
"""Show packages added since a commit."""
u1, u2 = diff_packages(args.rev1, args.rev2)
if u2: colify(sorted(u2))
def pkg(parser, args):
action = { 'diff' : pkg_diff,
'list' : pkg_list,
'removed' : pkg_removed,
'added' : pkg_added }
action[args.pkg_command](args)

View File

@@ -94,6 +94,9 @@ class Compiler(object):
# Names of generic arguments used by this compiler
arg_rpath = '-Wl,-rpath,%s'
# argument used to get C++11 options
cxx11_flag = "-std=c++11"
def __init__(self, cspec, cc, cxx, f77, fc):
def check(exe):

View File

@@ -22,7 +22,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import llnl.util.tty as tty
from spack.compiler import *
from spack.version import ver
class Gcc(Compiler):
# Subclasses use possible names of C compiler
@@ -40,6 +42,15 @@ class Gcc(Compiler):
# MacPorts builds gcc versions with prefixes and -mp-X.Y suffixes.
suffixes = [r'-mp-\d\.\d']
@property
def cxx11_flag(self):
if self.version < ver('4.3'):
tty.die("Only gcc 4.3 and above support c++11.")
elif self.version < ver('4.7'):
return "-std=gnu++0x"
else:
return "-std=gnu++11"
@classmethod
def fc_version(cls, fc):
return get_compiler_version(

View File

@@ -37,6 +37,15 @@ class Intel(Compiler):
# Subclasses use possible names of Fortran 90 compiler
fc_names = ['ifort']
@property
def cxx11_flag(self):
if self.version < ver('11.1'):
tty.die("Only intel 11.1 and above support c++11.")
elif self.version < ver('13'):
return "-std=c++0x"
else:
return "-std=c++11"
@classmethod
def default_version(cls, comp):

View File

@@ -48,6 +48,7 @@
import spack
import spack.spec
import spack.error
import spack.compilers
import spack.hooks
import spack.build_environment as build_env
import spack.url as url
@@ -505,6 +506,14 @@ def prefix(self):
return self.spec.prefix
@property
def compiler(self):
"""Get the spack.compiler.Compiler object used to build this package."""
if not self.spec.concrete:
raise ValueError("Can only get a compiler for a concrete package.")
return spack.compilers.compiler_for_spec(self.spec.compiler)
def url_version(self, version):
"""Given a version, this returns a string that should be substituted into the
package's URL to download that version.