summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2016-05-16 09:06:03 -0700
committerTom Scogland <scogland1@llnl.gov>2016-05-22 11:16:00 -0700
commit404b7c7c4fe721f3b7236f6d02fb1330d4245858 (patch)
tree5219fe1d2dd0bdca4629896111d0119c1b9a5cda /var
parentd0870865817054288fbebb7dda626b6e8aeb0114 (diff)
downloadspack-404b7c7c4fe721f3b7236f6d02fb1330d4245858.tar.gz
spack-404b7c7c4fe721f3b7236f6d02fb1330d4245858.tar.bz2
spack-404b7c7c4fe721f3b7236f6d02fb1330d4245858.tar.xz
spack-404b7c7c4fe721f3b7236f6d02fb1330d4245858.zip
initial rust support
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/rust-bindgen/package.py13
-rw-r--r--var/spack/repos/builtin/packages/rust/package.py62
2 files changed, 75 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/rust-bindgen/package.py b/var/spack/repos/builtin/packages/rust-bindgen/package.py
new file mode 100644
index 0000000000..8d48ea096e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rust-bindgen/package.py
@@ -0,0 +1,13 @@
+from spack import *
+import os
+
+
+class RustBindgen(Package):
+ """The rust programming language toolchain"""
+ homepage = "http://www.rust-lang.org"
+ url = "https://github.com/crabtw/rust-bindgen"
+
+ extends("rust")
+
+ def install(self, spec, prefix):
+ cargo('install', '--root', prefix)
diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py
new file mode 100644
index 0000000000..abc10dc047
--- /dev/null
+++ b/var/spack/repos/builtin/packages/rust/package.py
@@ -0,0 +1,62 @@
+from spack import *
+import os
+
+
+def get_submodules():
+ git = which('git')
+ git('submodule', 'update', '--init', '--recursive')
+
+class Rust(Package):
+ """The rust programming language toolchain"""
+ homepage = "http://www.rust-lang.org"
+ url = "https://github.com/rust-lang/rust"
+
+ version('1.8.0', tag='1.8.0', git="https://github.com/rust-lang/rust")
+
+ resource(name='cargo',
+ git="https://github.com/rust-lang/cargo.git",
+ tag='0.10.0',
+ destination='cargo')
+
+ extendable = True
+
+ # Rust
+ depends_on("curl")
+ depends_on("git")
+ depends_on("cmake")
+ depends_on("python@:2.8")
+
+ # Cargo
+ depends_on("openssl")
+
+ def install(self, spec, prefix):
+ get_submodules()
+ configure('--prefix=%s' % prefix)
+
+ make()
+ make("install")
+
+ # Install cargo, rust package manager
+ with working_dir(os.path.join('cargo', 'cargo')):
+ get_submodules()
+ configure('--prefix=' + prefix,
+ '--local-rust-root=' + prefix)
+
+ make()
+ make("install")
+
+ def setup_dependent_package(self, module, ext_spec):
+ """
+ Called before python modules' install() methods.
+
+ In most cases, extensions will only need to have one or two lines::
+
+ cargo('build')
+ cargo('install', '--root', prefix)
+
+ or
+
+ cargo('install', '--root', prefix)
+ """
+ # Rust extension builds can have a global cargo executable function
+ module.cargo = Executable(join_path(self.spec.prefix.bin, 'cargo'))