Merge branch 'features/llvm' into develop
- merging parts of LLVM that can be built now. - need to wait for standalone builds for some of the others.
This commit is contained in:
		@@ -124,8 +124,19 @@ def expand_user(path):
 | 
			
		||||
    return path.replace('%u', username)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def mkdirp(*paths):
 | 
			
		||||
    for path in paths:
 | 
			
		||||
        if not os.path.exists(path):
 | 
			
		||||
            os.makedirs(path)
 | 
			
		||||
        elif not os.path.isdir(path):
 | 
			
		||||
            raise OSError(errno.EEXIST, "File alredy exists", path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@contextmanager
 | 
			
		||||
def working_dir(dirname):
 | 
			
		||||
def working_dir(dirname, **kwargs):
 | 
			
		||||
    if kwargs.get('create', False):
 | 
			
		||||
        mkdirp(dirname)
 | 
			
		||||
 | 
			
		||||
    orig_dir = os.getcwd()
 | 
			
		||||
    os.chdir(dirname)
 | 
			
		||||
    yield
 | 
			
		||||
@@ -137,14 +148,6 @@ def touch(path):
 | 
			
		||||
        os.utime(path, None)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def mkdirp(*paths):
 | 
			
		||||
    for path in paths:
 | 
			
		||||
        if not os.path.exists(path):
 | 
			
		||||
            os.makedirs(path)
 | 
			
		||||
        elif not os.path.isdir(path):
 | 
			
		||||
            raise OSError(errno.EEXIST, "File alredy exists", path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def join_path(prefix, *args):
 | 
			
		||||
    path = str(prefix)
 | 
			
		||||
    for elt in args:
 | 
			
		||||
 
 | 
			
		||||
@@ -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'
 | 
			
		||||
@@ -165,6 +165,9 @@ def set_module_variables_for_package(pkg):
 | 
			
		||||
    m.make  = MakeExecutable('make', pkg.parallel)
 | 
			
		||||
    m.gmake = MakeExecutable('gmake', pkg.parallel)
 | 
			
		||||
 | 
			
		||||
    # easy shortcut to os.environ
 | 
			
		||||
    m.env = os.environ
 | 
			
		||||
 | 
			
		||||
    # number of jobs spack prefers to build with.
 | 
			
		||||
    m.make_jobs = multiprocessing.cpu_count()
 | 
			
		||||
 | 
			
		||||
@@ -180,7 +183,7 @@ def set_module_variables_for_package(pkg):
 | 
			
		||||
 | 
			
		||||
    # standard CMake arguments
 | 
			
		||||
    m.std_cmake_args = ['-DCMAKE_INSTALL_PREFIX=%s' % pkg.prefix,
 | 
			
		||||
                        '-DCMAKE_BUILD_TYPE=None']
 | 
			
		||||
                        '-DCMAKE_BUILD_TYPE=RelWithDebInfo']
 | 
			
		||||
    if platform.mac_ver()[0]:
 | 
			
		||||
        m.std_cmake_args.append('-DCMAKE_FIND_FRAMEWORK=LAST')
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,9 @@ def setup_parser(subparser):
 | 
			
		||||
    subparser.add_argument(
 | 
			
		||||
        '--keep-stage', action='store_true', dest='keep_stage',
 | 
			
		||||
        help="Don't clean up staging area when command completes.")
 | 
			
		||||
    subparser.add_argument(
 | 
			
		||||
        '-n', '--name', dest='alternate_name', default=None,
 | 
			
		||||
        help="Override the autodetected name for the created package.")
 | 
			
		||||
    subparser.add_argument(
 | 
			
		||||
        '-f', '--force', action='store_true', dest='force',
 | 
			
		||||
        help="Overwrite any existing package file with the same name.")
 | 
			
		||||
@@ -121,30 +124,27 @@ def make_version_calls(ver_hash_tuples):
 | 
			
		||||
    return '\n'.join(format % ("'%s'" % v, h) for v, h in ver_hash_tuples)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_name():
 | 
			
		||||
    """Prompt user to input a package name."""
 | 
			
		||||
    name = ""
 | 
			
		||||
    while not name:
 | 
			
		||||
        new_name = raw_input("Name: ")
 | 
			
		||||
        if spack.db.valid_name(name):
 | 
			
		||||
            name = new_name
 | 
			
		||||
        else:
 | 
			
		||||
            print "Package name can only contain A-Z, a-z, 0-9, '_' and '-'"
 | 
			
		||||
    return name
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def create(parser, args):
 | 
			
		||||
    url = args.url
 | 
			
		||||
 | 
			
		||||
    # Try to deduce name and version of the new package from the URL
 | 
			
		||||
    name, version = spack.url.parse_name_and_version(url)
 | 
			
		||||
    if not name:
 | 
			
		||||
        tty.msg("Couldn't guess a name for this package.")
 | 
			
		||||
        name = get_name()
 | 
			
		||||
 | 
			
		||||
    # Use a user-supplied name if one is present
 | 
			
		||||
    name = kwargs.get(args, 'alternate_name', False)
 | 
			
		||||
    if args.name:
 | 
			
		||||
        name = args.name
 | 
			
		||||
 | 
			
		||||
    if not version:
 | 
			
		||||
        tty.die("Couldn't guess a version string from %s." % url)
 | 
			
		||||
 | 
			
		||||
    if not name:
 | 
			
		||||
        tty.die("Couldn't guess a name for this package. Try running:", "",
 | 
			
		||||
                "spack create --name <name> <url>")
 | 
			
		||||
 | 
			
		||||
    if not spack.db.valid_name(name):
 | 
			
		||||
        tty.die("Package name can only contain A-Z, a-z, 0-9, '_' and '-'")
 | 
			
		||||
 | 
			
		||||
    tty.msg("This looks like a URL for %s version %s." % (name, version))
 | 
			
		||||
    tty.msg("Creating template for package %s" % name)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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(
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -57,7 +58,7 @@
 | 
			
		||||
from spack.util.compression import allowed_archive, extension
 | 
			
		||||
 | 
			
		||||
"""Allowed URL schemes for spack packages."""
 | 
			
		||||
_ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file"]
 | 
			
		||||
_ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Package(object):
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user