summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/gcc/package.py84
-rw-r--r--var/spack/repos/builtin/packages/go/package.py81
-rw-r--r--var/spack/repos/builtin/packages/the_platinum_searcher/package.py19
3 files changed, 103 insertions, 81 deletions
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
index f630b9b61a..0ef6b731ed 100644
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -1,33 +1,33 @@
##############################################################################
-# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
-# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/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 Lesser General Public License (as
-# published by the Free Software Foundation) version 2.1, February 1999.
+# 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 Lesser General Public License for more details.
+# 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
+# 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
##############################################################################
from spack import *
from contextlib import closing
from glob import glob
import sys
-import os
+
class Gcc(Package):
"""The GNU Compiler Collection includes front ends for C, C++,
@@ -50,10 +50,12 @@ class Gcc(Package):
version('4.6.4', 'b407a3d1480c11667f293bfb1f17d1a4')
version('4.5.4', '27e459c2566b8209ab064570e1b378f7')
- variant('binutils', default=sys.platform != 'darwin',
- description="Build via binutils")
- variant('gold', default=sys.platform != 'darwin',
- description="Build the gold linker plugin for ld-based LTO")
+ variant('binutils',
+ default=sys.platform != 'darwin',
+ description="Build via binutils")
+ variant('gold',
+ default=sys.platform != 'darwin',
+ description="Build the gold linker plugin for ld-based LTO")
depends_on("mpfr")
depends_on("gmp")
@@ -62,12 +64,9 @@ class Gcc(Package):
depends_on("binutils~libiberty", when='+binutils ~gold')
depends_on("binutils~libiberty+gold", when='+binutils +gold')
- if sys.platform != 'darwin':
- provides('go_compiler' when='@4.7.1:')
-
# TODO: integrate these libraries.
- #depends_on("ppl")
- #depends_on("cloog")
+ # depends_on("ppl")
+ # depends_on("cloog")
if sys.platform == 'darwin':
patch('darwin/gcc-4.9.patch1', when='@4.9.3')
patch('darwin/gcc-4.9.patch2', when='@4.9.3')
@@ -75,7 +74,7 @@ class Gcc(Package):
def install(self, spec, prefix):
# libjava/configure needs a minor fix to install into spack paths.
filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure',
- string=True)
+ string=True)
enabled_languages = set(('c', 'c++', 'fortran', 'java', 'objc'))
@@ -83,62 +82,59 @@ class Gcc(Package):
enabled_languages.add('go')
# Generic options to compile GCC
- options = ["--prefix=%s" % prefix,
- "--libdir=%s/lib64" % prefix,
+ options = ["--prefix=%s" % prefix, "--libdir=%s/lib64" % prefix,
"--disable-multilib",
"--enable-languages=" + ','.join(enabled_languages),
- "--with-mpc=%s" % spec['mpc'].prefix,
- "--with-mpfr=%s" % spec['mpfr'].prefix,
- "--with-gmp=%s" % spec['gmp'].prefix,
- "--enable-lto",
- "--with-quad"]
+ "--with-mpc=%s" % spec['mpc'].prefix, "--with-mpfr=%s" %
+ spec['mpfr'].prefix, "--with-gmp=%s" % spec['gmp'].prefix,
+ "--enable-lto", "--with-quad"]
# Binutils
if spec.satisfies('+binutils'):
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
- binutils_options = ["--with-sysroot=/",
- "--with-stage1-ldflags=%s %s" %
- (self.rpath_args, static_bootstrap_flags),
- "--with-boot-ldflags=%s %s" %
- (self.rpath_args, static_bootstrap_flags),
- "--with-gnu-ld",
- "--with-ld=%s/bin/ld" % spec['binutils'].prefix,
- "--with-gnu-as",
- "--with-as=%s/bin/as" % spec['binutils'].prefix]
+ binutils_options = [
+ "--with-sysroot=/", "--with-stage1-ldflags=%s %s" %
+ (self.rpath_args, static_bootstrap_flags),
+ "--with-boot-ldflags=%s %s" %
+ (self.rpath_args, static_bootstrap_flags), "--with-gnu-ld",
+ "--with-ld=%s/bin/ld" % spec['binutils'].prefix,
+ "--with-gnu-as",
+ "--with-as=%s/bin/as" % spec['binutils'].prefix
+ ]
options.extend(binutils_options)
# Isl
if 'isl' in spec:
isl_options = ["--with-isl=%s" % spec['isl'].prefix]
options.extend(isl_options)
- if sys.platform == 'darwin' :
- darwin_options = [ "--with-build-config=bootstrap-debug" ]
+ if sys.platform == 'darwin':
+ darwin_options = ["--with-build-config=bootstrap-debug"]
options.extend(darwin_options)
build_dir = join_path(self.stage.path, 'spack-build')
- configure = Executable( join_path(self.stage.source_path, 'configure') )
+ configure = Executable(join_path(self.stage.source_path, 'configure'))
with working_dir(build_dir, create=True):
# Rest of install is straightforward.
configure(*options)
- if sys.platform == 'darwin' : make("bootstrap")
- else: make()
+ if sys.platform == 'darwin':
+ make("bootstrap")
+ else:
+ make()
make("install")
self.write_rpath_specs()
-
@property
def spec_dir(self):
# e.g. lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
spec_dir = glob("%s/lib64/gcc/*/*" % self.prefix)
return spec_dir[0] if spec_dir else None
-
def write_rpath_specs(self):
"""Generate a spec file so the linker adds a rpath to the libs
the compiler used to build the executable."""
if not self.spec_dir:
tty.warn("Could not install specs for %s." %
- self.spec.format('$_$@'))
+ self.spec.format('$_$@'))
return
gcc = Executable(join_path(self.prefix.bin, 'gcc'))
@@ -149,5 +145,5 @@ class Gcc(Package):
out.write(line + "\n")
if line.startswith("*link:"):
out.write("-rpath %s/lib:%s/lib64 \\\n" %
- (self.prefix, self.prefix))
+ (self.prefix, self.prefix))
set_install_permissions(specs_file)
diff --git a/var/spack/repos/builtin/packages/go/package.py b/var/spack/repos/builtin/packages/go/package.py
index 71b1b9c18f..6fe212c800 100644
--- a/var/spack/repos/builtin/packages/go/package.py
+++ b/var/spack/repos/builtin/packages/go/package.py
@@ -1,6 +1,9 @@
import os
+import shutil
+import glob
from spack import *
+
class Go(Package):
"""The golang compiler and build environment"""
homepage = "https://golang.org"
@@ -10,43 +13,65 @@ class Go(Package):
# temporary fix until tags are pulled correctly
version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2')
- version('1.5.0', git='https://go.googlesource.com/go', tag='go1.5.0')
+ version('1.5.4', git='https://go.googlesource.com/go', tag='go1.5.4')
+ version('1.6.2', git='https://go.googlesource.com/go', tag='go1.6.2')
+
+ variant('test',
+ default=True,
+ description="Run tests as part of build, a good idea but quite"
+ " time consuming")
+ provides('golang')
- provides('go_compiler')
- # to-do, make non-c self-hosting compilers possible
+ # to-do, make non-c self-hosting compilers feasible without backflips
# should be go_compiler, but that creates an infinite loop
- depends_on('gcc', when='@1.5:')
+ depends_on('gcc@5:', when='@1.5:')
+ depends_on('git')
def install(self, spec, prefix):
- os.environ['GOROOT'] = os.getcwd()
- 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):
+ bash = which('bash')
+ with working_dir('src'):
+ if '+test' in spec:
+ bash('all.bash')
+ else:
+ bash('make.bash')
+
+ try:
+ os.makedirs(prefix)
+ except OSError:
+ pass
+ for f in glob.glob('*'):
+ if os.path.isdir(f):
+ shutil.copytree(f, os.path.join(prefix, f))
+ else:
+ shutil.copy2(f, os.path.join(prefix, f))
+
+ def setup_environment(self, spack_env, run_env):
+ # spack_env.set("GOROOT", self.spec.prefix)
+ # run_env.set("GOROOT", self.spec.prefix)
+ spack_env.set('GOROOT_FINAL', self.spec.prefix)
+ spack_env.set('GOROOT_BOOTSTRAP', self.spec['gcc'].prefix)
+
+ def setup_dependent_package(self, module, ext_spec):
+ # Add a go command/compiler for extensions
+ module.go = Executable(join_path(self.spec.prefix.bin, 'go'))
+
+ def setup_dependent_environment(self, spack_env, run_env, ext_spec):
"""Called before go modules' install() methods.
In most cases, extensions will only need to have one line::
- go('get', '<package>')
+ 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)
+ # spack_env.set("GOROOT", self.spec.prefix)
+ # run_env.set("GOROOT", self.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)
+ # spack_env.prepend_path('GOPATH', ':'.join(go_paths))
+ spack_env.set('GOPATH', ext_spec.package.stage.source_path)
diff --git a/var/spack/repos/builtin/packages/the_platinum_searcher/package.py b/var/spack/repos/builtin/packages/the_platinum_searcher/package.py
index 1dd54d3b98..c040da3699 100644
--- a/var/spack/repos/builtin/packages/the_platinum_searcher/package.py
+++ b/var/spack/repos/builtin/packages/the_platinum_searcher/package.py
@@ -1,19 +1,20 @@
from spack import *
+import os
+import shutil
+
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"
+ url = "https://github.com/monochromegane/the_platinum_searcher"
+
+ package = 'github.com/monochromegane/the_platinum_searcher/...'
- version('1.7.7', '08d7265e101bc1427d5d4b9903aa1166')
+ version('head', go=package)
- depends_on("go")
+ extends("go")
def install(self, spec, prefix):
- env = which('env')
- env()
- # Fetch all dependencies
- go('get', './...')
- # Build pt
- go('build')
+ go('install', self.package)
+ shutil.copytree('bin', os.path.join(prefix, 'bin'))