summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2015-12-30 11:22:11 -0800
committerTom Scogland <scogland1@llnl.gov>2016-05-14 18:06:41 -0700
commit0c33e8ac4859b3ce559055af87479418b8cc8fe4 (patch)
tree1e5cd7cbdd164eda3272f5f8b96a4c80fbbececc
parent4a6ec6377d5101d44a73e99e1a67cfd8f5f8a694 (diff)
downloadspack-0c33e8ac4859b3ce559055af87479418b8cc8fe4.tar.gz
spack-0c33e8ac4859b3ce559055af87479418b8cc8fe4.tar.bz2
spack-0c33e8ac4859b3ce559055af87479418b8cc8fe4.tar.xz
spack-0c33e8ac4859b3ce559055af87479418b8cc8fe4.zip
go and a basic go package
-rw-r--r--var/spack/packages/go/package.py49
-rw-r--r--var/spack/packages/the_platinum_searcher/package.py19
2 files changed, 68 insertions, 0 deletions
diff --git a/var/spack/packages/go/package.py b/var/spack/packages/go/package.py
new file mode 100644
index 0000000000..4e3f6fa8ec
--- /dev/null
+++ b/var/spack/packages/go/package.py
@@ -0,0 +1,49 @@
+import os
+from spack import *
+
+class Go(Package):
+ """The golang compiler and build environment"""
+ homepage = "https://golang.org"
+ url = "https://go.googlesource.com/go"
+
+ extendable = True
+
+ # temporary fix until tags are pulled correctly
+ version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2')
+
+ # to-do, make non-c self-hosting compilers possible
+ # depends_on('go@:1.4.2', when='@1.5:')
+
+ def install(self, spec, prefix):
+ os.environ['GOROOT'] = os.getcwd()
+ os.environ['GOBIN'] = join_path(os.getcwd(), 'bin')
+ os.environ['GOROOT_FINAL'] = prefix
+ bash = which('bash')
+ bash('-c', 'env')
+ bash('-c', 'pwd')
+ with working_dir('src'):
+ #TODO: crutch until the read-only-filesystem bug is fixed upstream
+ bash('all.bash', fail_on_error=False)
+ cp = which('cp')
+ bash('-c', 'cp -r ./* "{}"'.format(prefix))
+
+ def setup_dependent_environment(self, module, spec, ext_spec):
+ """Called before go modules' install() methods.
+
+ In most cases, extensions will only need to have one line::
+
+ go('get', '<package>')
+ """
+ # Add a go command for extensions
+ module.go = Executable(join_path(spec.prefix.bin, 'go'))
+ os.environ['GOROOT'] = spec.prefix
+
+ stage_path = os.path.realpath(ext_spec.package.stage.source_path)
+ print "PREFIX: {}".format(stage_path)
+ go_paths = [stage_path]
+ for d in ext_spec.traverse():
+ if d.package.extends(self.spec):
+ go_paths.append(d.prefix)
+ os.environ['GOPATH'] = ':'.join(go_paths)
+
+
diff --git a/var/spack/packages/the_platinum_searcher/package.py b/var/spack/packages/the_platinum_searcher/package.py
new file mode 100644
index 0000000000..1dd54d3b98
--- /dev/null
+++ b/var/spack/packages/the_platinum_searcher/package.py
@@ -0,0 +1,19 @@
+from spack import *
+
+class ThePlatinumSearcher(Package):
+ """Fast parallel recursive grep alternative"""
+ # FIXME: add a proper url for your package's homepage here.
+ homepage = "https://github.com/monochromegane/the_platinum_searcher"
+ url = "https://github.com/monochromegane/the_platinum_searcher/archive/v1.7.7.tar.gz"
+
+ version('1.7.7', '08d7265e101bc1427d5d4b9903aa1166')
+
+ depends_on("go")
+
+ def install(self, spec, prefix):
+ env = which('env')
+ env()
+ # Fetch all dependencies
+ go('get', './...')
+ # Build pt
+ go('build')