summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@googlemail.com>2015-12-02 12:24:37 +0100
committerMassimiliano Culpo <massimiliano.culpo@googlemail.com>2015-12-02 12:24:37 +0100
commit39a3cfd4d9fc8d0981ba118de9a1e049fba4b144 (patch)
treea7bb83beedb172109aa8b4cd82ac27d8e0dbdafe
parent4b2168ab8ef5b5e69545a9bd82ef8804a4108d75 (diff)
downloadspack-39a3cfd4d9fc8d0981ba118de9a1e049fba4b144.tar.gz
spack-39a3cfd4d9fc8d0981ba118de9a1e049fba4b144.tar.bz2
spack-39a3cfd4d9fc8d0981ba118de9a1e049fba4b144.tar.xz
spack-39a3cfd4d9fc8d0981ba118de9a1e049fba4b144.zip
reource directive accepts 'basename' keyword
llvm : libc++ variant
-rw-r--r--lib/spack/spack/directives.py5
-rw-r--r--lib/spack/spack/package.py3
-rw-r--r--lib/spack/spack/resource.py4
-rw-r--r--var/spack/packages/llvm/package.py9
4 files changed, 17 insertions, 4 deletions
diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py
index 48a7df7462..07ef32294b 100644
--- a/lib/spack/spack/directives.py
+++ b/lib/spack/spack/directives.py
@@ -276,10 +276,12 @@ def resource(pkg, **kwargs):
* 'when' : represents the condition upon which the resource is needed (optional)
* 'destination' : path where to extract / checkout the resource (optional). This path must be a relative path,
and it must fall inside the stage area of the main package.
+ * 'basename' : basename of the resource source folder within destination (optional).
"""
when = kwargs.get('when', pkg.name)
destination = kwargs.get('destination', "")
+ basename = kwargs.get('basename', None)
# Check if the path is relative
if os.path.isabs(destination):
message = "The destination keyword of a resource directive can't be an absolute path.\n"
@@ -296,7 +298,8 @@ def resource(pkg, **kwargs):
resources = pkg.resources.setdefault(when_spec, [])
fetcher = from_kwargs(**kwargs)
name = kwargs.get('name')
- resources.append(Resource(name, fetcher, destination))
+ resources.append(Resource(name, fetcher, destination, basename))
+
class DirectiveError(spack.error.SpackError):
"""This is raised when something is wrong with a package directive."""
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index c10283a6ee..3f48231c75 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -681,7 +681,8 @@ class Package(object):
for resource in resources:
stage = resource.fetcher.stage
_expand_archive(stage, resource.name)
- link_path = join_path(self.stage.source_path, resource.destination, os.path.basename(stage.source_path))
+ basename = os.path.basename(stage.source_path) if resource.basename is None else resource.basename
+ link_path = join_path(self.stage.source_path, resource.destination, basename)
if not os.path.exists(link_path):
# Create a symlink
os.symlink(stage.source_path, link_path)
diff --git a/lib/spack/spack/resource.py b/lib/spack/spack/resource.py
index 00ee2d49e4..b20612686d 100644
--- a/lib/spack/spack/resource.py
+++ b/lib/spack/spack/resource.py
@@ -27,11 +27,13 @@ Describes an optional resource needed for a build. Typically a bunch of sources
package to enable optional features.
"""
+
class Resource(object):
"""
Represents an optional resource. Aggregates a name, a fetcher and a destination.
"""
- def __init__(self, name, fetcher, destination):
+ def __init__(self, name, fetcher, destination, basename):
self.name = name
self.fetcher = fetcher
self.destination = destination
+ self.basename = basename
diff --git a/var/spack/packages/llvm/package.py b/var/spack/packages/llvm/package.py
index b68aa82aff..872a6c082b 100644
--- a/var/spack/packages/llvm/package.py
+++ b/var/spack/packages/llvm/package.py
@@ -41,15 +41,22 @@ class Llvm(Package):
depends_on('python@2.7:')
+ variant('libcxx', default=False, description="Builds the LLVM Standard C++ library targeting C++11")
+
##########
# @3.7.0
- # TODO : Add support for libc++ <- libc++ABI <- libunwind with variant?
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', basename='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', basename='libcxxabi', when='+libcxx@3.7.0')
##########
def install(self, spec, prefix):